Back to Claude Scientific Skills

cBioPortal API

scientific-skills/database-lookup/references/cbioportal.md

2.38.07.1 KB
Original Source

cBioPortal API

Base URL

https://www.cbioportal.org/api

Auth

No authentication for the public instance. Private/institutional instances (e.g. genie.cbioportal.org) require a data access token via Authorization: Bearer <token> header.

Common Headers

Accept: application/json
Content-Type: application/json

Common Query Parameters

Most list endpoints support these:

ParameterTypeDescriptionDefault
projectionstringDetail level: ID, SUMMARY, DETAILED, METASUMMARY
pageNumberintZero-based page index0
pageSizeintResults per page10000000
sortBystringProperty to sort byvaries
directionstringASC or DESCASC

Key Endpoints

Studies

MethodEndpointDescription
GET/studiesList all cancer studies
GET/studies/{studyId}Get a single study
POST/studies/fetchFetch multiple studies by ID

Example:

GET https://www.cbioportal.org/api/studies?projection=SUMMARY&pageSize=10
GET https://www.cbioportal.org/api/studies/brca_tcga

Response fields: studyId, name, description, cancerTypeId, pmid, citation, allSampleCount, referenceGenome, publicStudy, importDate

Cancer Types

MethodEndpointDescription
GET/cancer-typesList all cancer types
GET/cancer-types/{cancerTypeId}Get one cancer type

Response fields: cancerTypeId, name, shortName, dedicatedColor, parent

Genes

MethodEndpointDescription
GET/genesList all genes (paginated)
GET/genes/{geneId}Gene by Hugo symbol or Entrez ID
GET/genes/{geneId}/aliasesGene aliases
POST/genes/fetchFetch multiple genes

Example:

GET https://www.cbioportal.org/api/genes/TP53

Response: {"entrezGeneId": 7157, "hugoGeneSymbol": "TP53", "type": "protein-coding"}

Molecular Profiles

MethodEndpointDescription
GET/molecular-profilesAll profiles across all studies
GET/studies/{studyId}/molecular-profilesProfiles in a study
GET/molecular-profiles/{molecularProfileId}Single profile

Profile types (molecularAlterationType): MUTATION_EXTENDED, COPY_NUMBER_ALTERATION, MRNA_EXPRESSION, PROTEIN_LEVEL, METHYLATION

Example:

GET https://www.cbioportal.org/api/studies/brca_tcga/molecular-profiles

Mutations

MethodEndpointDescription
GET/molecular-profiles/{profileId}/mutationsMutations in a profile
POST/molecular-profiles/{profileId}/mutations/fetchFiltered mutation query
POST/mutations/fetchMulti-profile mutation fetch

Parameters for GET:

ParameterTypeDescription
sampleListIdstringSample list to query (e.g. brca_tcga_all)
entrezGeneIdintFilter by gene
projectionstringSUMMARY, DETAILED, ID, META

Example — TP53 mutations in TCGA breast cancer:

GET https://www.cbioportal.org/api/molecular-profiles/brca_tcga_mutations/mutations?sampleListId=brca_tcga_all&entrezGeneId=7157&projection=DETAILED

POST body for multi-gene fetch:

json
{
  "sampleListId": "brca_tcga_all",
  "entrezGeneIds": [7157, 672]
}

Response fields: entrezGeneId, sampleId, patientId, proteinChange, mutationType, mutationStatus, chr, startPosition, endPosition, referenceAllele, variantAllele, variantType, ncbiBuild, tumorAltCount, tumorRefCount

Copy Number Alterations

MethodEndpointDescription
GET/molecular-profiles/{profileId}/discrete-copy-numberCNA data
POST/molecular-profiles/{profileId}/discrete-copy-number/fetchFiltered CNA query
POST/discrete-copy-number/fetchMulti-profile CNA fetch

Molecular Data (expression, methylation)

MethodEndpointDescription
GET/molecular-profiles/{profileId}/molecular-dataExpression/methylation data
POST/molecular-data/fetchMulti-profile molecular data fetch

Clinical Data

MethodEndpointDescription
GET/studies/{studyId}/clinical-dataClinical data for a study
POST/clinical-data/fetchMulti-study clinical data
GET/studies/{studyId}/clinical-attributesAvailable clinical attributes

Parameters for GET:

ParameterTypeDescription
clinicalDataTypestringPATIENT or SAMPLE
attributeIdstringe.g. OS_STATUS, OS_MONTHS, CANCER_TYPE

Example:

GET https://www.cbioportal.org/api/studies/brca_tcga/clinical-data?clinicalDataType=PATIENT&attributeId=OS_STATUS&projection=SUMMARY

Patients & Samples

MethodEndpointDescription
GET/studies/{studyId}/patientsPatients in a study
GET/studies/{studyId}/samplesSamples in a study
POST/patients/fetchMulti-study patient fetch
POST/samples/fetchMulti-study sample fetch

Sample Lists

MethodEndpointDescription
GET/studies/{studyId}/sample-listsPredefined sample groups
GET/sample-lists/{sampleListId}Single sample list

Gene Panels

MethodEndpointDescription
GET/gene-panelsAll gene panels
GET/gene-panels/{genePanelId}Panel details with gene list
POST/gene-panel-data/fetchWhich panels cover which samples

Treatments

MethodEndpointDescription
POST/treatments/patientPatient-level treatment data
POST/treatments/sampleSample-level treatment data

System

MethodEndpointDescription
GET/healthServer health check
GET/infoPortal version, DB schema version

Typical Workflow

  1. Find studies: GET /studies — browse available cancer studies, get studyId values
  2. Get molecular profiles: GET /studies/{studyId}/molecular-profiles — find profile IDs (e.g. brca_tcga_mutations, brca_tcga_gistic)
  3. Get sample lists: GET /studies/{studyId}/sample-lists — find sample list IDs (e.g. brca_tcga_all, brca_tcga_sequenced)
  4. Query data: Use the profile ID and sample list ID to fetch mutations, CNA, expression, or clinical data

Rate Limits

No published rate limits. Be courteous — avoid hammering with many concurrent requests. For bulk data needs, cBioPortal offers downloadable datasets at https://docs.cbioportal.org/downloads/.

Tips

  • Study IDs follow a pattern: {cancer_type}_{source} (e.g. brca_tcga, luad_tcga, prad_mskcc_2017)
  • Molecular profile IDs extend the study ID: {studyId}_mutations, {studyId}_gistic, {studyId}_rna_seq_v2_mrna
  • Use projection=DETAILED to get the richest response including nested objects
  • POST /fetch endpoints are for batch queries across multiple studies, genes, or samples — they're the most flexible way to query
  • Gene lookup accepts both Hugo symbols (TP53) and Entrez IDs (7157)
  • The Swagger UI at https://www.cbioportal.org/api/swagger-ui/index.html documents every endpoint interactively