Skip to Content
🧬 BioQuery is in beta. We'd love your feedback!
APIAPI Endpoints

API Endpoints

Complete reference for all BioQuery API endpoints.

Query Endpoints

Create Query

Run a new query and get results.

POST /v1/query

Request Body

FieldTypeRequiredDescription
querystringYesNatural language query

Example Request

curl -X POST https://api.bioquery.io/v1/query \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "Is DDR1 expression higher in papillary RCC vs clear cell RCC?" }'

Response

{ "id": "card_abc123xyz", "status": "completed", "created_at": "2024-01-15T10:30:00Z", "query": { "original": "Is DDR1 expression higher in papillary RCC vs clear cell RCC?", "parsed": { "gene": "DDR1", "cancer_types": ["KIRP", "KIRC"], "analysis_type": "differential_expression" }, "sql": "SELECT sample_id, cancer_type, gene_expression FROM tcga.expression WHERE gene_symbol = 'DDR1' AND cancer_type IN ('KIRP', 'KIRC')" }, "results": { "answer": "DDR1 expression is significantly higher in papillary RCC (KIRP) compared to clear cell RCC (KIRC), with a 2.3-fold increase (p < 0.001, Wilcoxon rank-sum test).", "statistics": { "p_value": 0.00032, "fold_change": 2.3, "effect_size": 0.85, "test": "wilcoxon_ranksum" }, "sample_sizes": { "KIRP": 290, "KIRC": 533 } }, "figure": { "type": "boxplot", "plotly_json": { ... } }, "methods": "Gene expression data were obtained from The Cancer Genome Atlas (TCGA). DDR1 mRNA expression (log2 TPM+1) was compared between papillary renal cell carcinoma (KIRP, n=290) and clear cell renal cell carcinoma (KIRC, n=533) using a Wilcoxon rank-sum test." }

Get Query Card

Retrieve a previously created Query Card by ID.

GET /v1/cards/{card_id}

Path Parameters

ParameterTypeDescription
card_idstringThe Query Card ID

Example Request

curl https://api.bioquery.io/v1/cards/card_abc123xyz \ -H "Authorization: Bearer YOUR_API_KEY"

Response

Returns the full Query Card object (same format as Create Query response).


Get Methods Text

Get publication-ready methods text for a Query Card.

GET /v1/cards/{card_id}/methods

Path Parameters

ParameterTypeDescription
card_idstringThe Query Card ID

Query Parameters

ParameterTypeDefaultDescription
regeneratebooleanfalseForce regeneration of methods text

Example Request

curl https://api.bioquery.io/v1/cards/bq-2025-01-15-a7f3x/methods \ -H "Authorization: Bearer YOUR_API_KEY"

Response

Gene expression data were obtained from The Cancer Genome Atlas (TCGA) via ISB-CGC BigQuery tables. RNA-seq expression values (TPM, hg38) were extracted for DDR1 across 2 cancer type(s) (KIRP, KIRC). Statistical analysis was performed using wilcoxon_rank_sum with n=823 total samples.

Get Citations

Get auto-generated citations in multiple formats.

GET /v1/cards/{card_id}/cite

Path Parameters

ParameterTypeDescription
card_idstringThe Query Card ID

Example Request

curl https://api.bioquery.io/v1/cards/bq-2025-01-15-a7f3x/cite \ -H "Authorization: Bearer YOUR_API_KEY"

Response

{ "bibtex": "@misc{bioquery_bq_2025_01_15_a7f3x,\n author = {BioQuery},\n title = {DDR1 Differential Expression - Query Card bq-2025-01-15-a7f3x},\n year = {2025},\n url = {https://bioquery.io/card/bq-2025-01-15-a7f3x}\n}", "apa": "BioQuery. (2025). DDR1 differential expression [Query Card bq-2025-01-15-a7f3x]. Retrieved from https://bioquery.io/card/bq-2025-01-15-a7f3x", "mla": "\"BioQuery: DDR1 Differential Expression.\" BioQuery, 2025, https://bioquery.io/card/bq-2025-01-15-a7f3x.", "url": "https://bioquery.io/card/bq-2025-01-15-a7f3x", "data_sources": [ { "name": "TCGA", "citation": "The Cancer Genome Atlas Research Network. Comprehensive genomic characterization defines human glioblastoma genes and core pathways. Nature 455, 1061–1068 (2008).", "url": "https://www.cancer.gov/tcga" } ] }

Get Card Context

Get projects, explorations, and studies that contain this card.

GET /v1/cards/{card_id}/context

Path Parameters

ParameterTypeDescription
card_idstringThe Query Card ID

Example Response

{ "projects": [ {"project_id": "proj_123", "name": "DDR1 Research"} ], "explorations": [ {"exploration_id": "exp_456", "name": "RCC Gene Analysis"} ], "studies": [ {"study_id": "study_789", "title": "DDR1 as RCC Biomarker", "view_count": 142} ] }

Fork Card

Create a derivative copy of an existing card, optionally with modifications.

POST /v1/cards/{card_id}/fork

Path Parameters

ParameterTypeDescription
card_idstringThe Query Card ID to fork

Request Body

FieldTypeRequiredDescription
genestringNoDifferent gene to analyze
cancer_typesarrayNoDifferent cancer types
exact_copybooleanNoIf true, create exact copy without re-executing

Example Request

# Fork with a different gene curl -X POST https://api.bioquery.io/v1/cards/bq-2025-01-15-a7f3x/fork \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"gene": "DDR2"}'

Response

{ "new_card_id": "bq-2025-01-16-b8g4y", "parent_card_id": "bq-2025-01-15-a7f3x", "message": "Forked with modifications: gene=DDR2" }

Rerun Card

Re-execute the original query with the latest data to check if results have changed.

POST /v1/cards/{card_id}/rerun

Path Parameters

ParameterTypeDescription
card_idstringThe Query Card ID to rerun

Example Request

curl -X POST https://api.bioquery.io/v1/cards/bq-2025-01-15-a7f3x/rerun \ -H "Authorization: Bearer YOUR_API_KEY"

Response

{ "new_card_id": "bq-2025-01-16-c9h5z", "original_card_id": "bq-2025-01-15-a7f3x", "data_changed": true, "comparison": { "sample_count_change": { "original": 823, "new": 831, "delta": 8 }, "p_value_change": { "original": 0.00032, "new": 0.00028, "percent_change": 12.5 } }, "message": "Query re-executed with latest data - results have changed!" }

Search Cards

Search for Query Cards by content.

GET /v1/cards/search

Query Parameters

ParameterTypeRequiredDescription
qstringYesSearch query
genestringNoFilter by gene
cancer_typestringNoFilter by cancer type
analysis_typestringNoFilter by analysis type
limitintegerNoMax results (default 20, max 100)
offsetintegerNoPagination offset

Example Request

curl "https://api.bioquery.io/v1/cards/search?q=DDR1+kidney&gene=DDR1&limit=10" \ -H "Authorization: Bearer YOUR_API_KEY"

Response

{ "cards": [ { "id": "bq-2025-01-15-a7f3x", "query": { "natural_language": "Is DDR1 higher in KIRP vs KIRC?" }, "created_at": "2025-01-15T10:30:00Z" } ], "total": 3, "limit": 10, "offset": 0 }

List Query Cards

Get a list of your Query Cards.

GET /v1/cards

Query Parameters

ParameterTypeDefaultDescription
limitinteger20Number of cards to return (max 100)
offsetinteger0Pagination offset
sortstring”created_at”Sort field
orderstring”desc”Sort order (asc/desc)

Example Request

curl "https://api.bioquery.io/v1/cards?limit=10&offset=0" \ -H "Authorization: Bearer YOUR_API_KEY"

Response

{ "cards": [ { "id": "card_abc123xyz", "query": "Is DDR1 higher in KIRP vs KIRC?", "created_at": "2024-01-15T10:30:00Z", "analysis_type": "differential_expression" }, ... ], "total": 42, "limit": 10, "offset": 0 }

Data Endpoints

List Cancer Types

Get available cancer types and their TCGA codes.

GET /v1/data/cancer-types

Example Response

{ "cancer_types": [ { "code": "BRCA", "name": "Breast invasive carcinoma", "sample_count": 1098 }, { "code": "LUAD", "name": "Lung adenocarcinoma", "sample_count": 533 }, ... ] }

List Genes

Get available genes.

GET /v1/data/genes

Query Parameters

ParameterTypeDescription
searchstringFilter by gene symbol prefix
limitintegerNumber of results (default 100)

Example Request

curl "https://api.bioquery.io/v1/data/genes?search=DDR&limit=10" \ -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{ "genes": [ {"symbol": "DDR1", "name": "Discoidin domain receptor tyrosine kinase 1"}, {"symbol": "DDR2", "name": "Discoidin domain receptor tyrosine kinase 2"} ] }

Export Endpoints

Export Figure

Export a Query Card figure in various formats.

GET /v1/cards/{card_id}/export/{format}

Path Parameters

ParameterTypeDescription
card_idstringThe Query Card ID
formatstringExport format: png, svg, or json

Query Parameters (PNG only)

ParameterTypeDefaultDescription
widthinteger800Image width in pixels
heightinteger600Image height in pixels
scalenumber2Scale factor for DPI

Example Request

# PNG export curl "https://api.bioquery.io/v1/cards/card_abc123xyz/export/png?width=1200&height=800" \ -H "Authorization: Bearer YOUR_API_KEY" \ -o figure.png # SVG export curl "https://api.bioquery.io/v1/cards/card_abc123xyz/export/svg" \ -H "Authorization: Bearer YOUR_API_KEY" \ -o figure.svg

Response Codes

CodeDescription
200Success
201Created (new Query Card)
400Bad Request (invalid query or parameters)
401Unauthorized (invalid API key)
403Forbidden (no API access)
404Not Found (card doesn’t exist)
429Too Many Requests (rate limited)
500Internal Server Error

See Error Handling for detailed error responses.