BYTETOOLS

ClinPGx (PharmGKB) API

Free ClinPGx API, formerly PharmGKB, with no key: pharmacogenomic gene records, allele definitions, CPIC guideline status and drug-gene relationships. No account needed.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the ClinPGx (PharmGKB) API?

The ClinPGx API — the service formerly published as PharmGKB — is a free, key-free interface to curated pharmacogenomics knowledge. Gene records return chromosomal coordinates in two genome builds, allele definition sources, CPIC and PharmVar participation flags, and links to the curating literature.

Pharmacogenomics asks which genetic variants change how a patient metabolises a drug, and CYP2D6 — the example here — is its canonical case, affecting a long list of common medications. ClinPGx curates that evidence: which star alleles exist, which are functional, which guidelines have been issued, and which publications underpin each claim. The `cpicGene` and `pharmVarGene` booleans are quick indicators of whether a gene has reached the level of evidence where clinical guidance exists.

Watch for the rebrand when reading older material. PharmGKB was folded into ClinPGx and the API host moved with it — `api.pharmgkb.org` no longer resolves, and `www.pharmgkb.org/v1/...` now serves the ClinPGx single-page application as HTML rather than JSON, which produces a confusing HTML-instead-of-JSON failure rather than a clean error. The current host is `api.clinpgx.org`. Note too that allele definitions arrive as a spreadsheet filename rather than inline data, so the API points at the definition table rather than serving it. Everything here is research and reference knowledge about drug-gene relationships, not prescribing guidance for an individual.

Quick facts

Base URL
https://api.clinpgx.org/v1
Authentication
No API key or account for the public data endpoints. ClinPGx and PharmGKB content is released under CC BY-SA 4.0, so attribution and share-alike obligations apply to anything you redistribute.
Rate limit
No published limit. ClinPGx publishes bulk downloads, which are the right route for anything systematic.
Pricing
Free. Data is CC BY-SA 4.0.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the ClinPGx (PharmGKB) API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Fetch the pharmacogenomic gene record for CYP2D6

GET https://api.clinpgx.org/v1/data/gene?symbol=CYP2D6&view=base

curl
curl 'https://api.clinpgx.org/v1/data/gene?symbol=CYP2D6&view=base' \
  -H 'Accept: application/json'
JavaScript (fetch)
const res = await fetch("https://api.clinpgx.org/v1/data/gene?symbol=CYP2D6&view=base", {
  headers: {
    "Accept": "application/json",
  },
});
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

headers = {
    "Accept": "application/json",
}

res = requests.get("https://api.clinpgx.org/v1/data/gene?symbol=CYP2D6&view=base", headers=headers, timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
{
  "data": [
    {
      "objCls": "Gene",
      "id": "PA128",
      "symbol": "CYP2D6",
      "name": "cytochrome P450 family 2 subfamily D member 6",
      "alleleFile": "CYP2D6_allele_definition_table.xlsx",
      "alleleFunctionSource": "CPIC",
      "alleleType": "Named Alleles",
      "amp": true,
      "buildVersion": "GRCh38.p7",
      "cbStart": "q13.1",
      "cbStop": "q13.2",
      "chr": {
        "objCls": "Chromosome",
        "id": "PA525",
        "name": "chr22"
      },
      "chrStartPosB37": 42522501,
      "chrStartPosB38": 42125531,
      "chrStopPosB37": 42526883,
      "chrStopPosB38": 42130881,
      "cpicGene": true,
      "hasNonStandardHaplotypes": false,
      "hideHaplotypes": false,
      "history": [],
      "pharmVarGene": true,
      "strand": "minus",
      "vipCitation": {
        "id": 7144344,
        "title": "Cytochrome P450 2D6.",
        "_sameAs": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4373606",
        "authors": [
          "Owen Ryan P",
          "Sangkuhl Katrin",
          "Klein Teri E",
          "Altman Russ B"
        ],
        "crossReferences": [
          {
            "id": 1449247412,
            "resource": "PubMed Central",
            "resourceId": "PMC4373606",
            "_url": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4373606"
          },
          {
            "id": 562114580,
            "resource": "PubMed",
            "resourceId": "19512959",
            "_url": "https://www.ncbi.nlm.nih.gov/pubmed/19512959"
          },
          {
            "id": 1449247413,
            "resource":

Parameters

ParameterTypeRequiredDescription
symbolqueryOptionalHGNC gene symbol to look up. CYP2D6
viewqueryOptionalLevel of detail: `base`, `min` or `max`. `max` pulls in related annotations and is much larger. base
(endpoint) /data/genepathOptionalGene records with pharmacogenomic curation. /v1/data/gene
(endpoint) /data/chemicalpathOptionalDrug and chemical records, including which genes affect their metabolism. /v1/data/chemical
(endpoint) /data/guidelineAnnotationpathOptionalCPIC and other consortium dosing guideline annotations. /v1/data/guidelineAnnotation
(endpoint) /data/clinicalAnnotationpathOptionalVariant-level clinical annotations with evidence levels. /v1/data/clinicalAnnotation

Response fields

data[]array
Results are always wrapped in a `data` array, even for a single gene.
data[].idstring
ClinPGx accession, such as `PA128`. The stable key across the whole resource.
data[].symbol / namestring
HGNC symbol and full gene name.
data[].cpicGeneboolean
True when CPIC has published prescribing guidance involving this gene — the strongest signal of clinical actionability.
data[].pharmVarGeneboolean
True when PharmVar curates star-allele nomenclature for the gene.
data[].alleleFile / alleleFunctionSourcestring
Filename of the allele definition table and the body that assigns allele function, such as CPIC.
data[].chrStartPosB37 / chrStartPosB38integer
Coordinates in both GRCh37 and GRCh38. Never mix the two.
data[].strandstring
`plus` or `minus`. CYP2D6 is on the minus strand, which matters when interpreting variant notation.
data[].vipCitationobject
The Very Important Pharmacogene summary article, with authors and PubMed cross-references.

What you can build with the ClinPGx (PharmGKB) API

  • Check whether a gene has CPIC prescribing guidance
  • Look up which drugs are affected by a pharmacogene
  • Resolve gene coordinates in both GRCh37 and GRCh38
  • Build a pharmacogenomics reference for a research tool
  • Trace a drug-gene claim back to its curating publication

Common errors and how to fix them

HTML returned instead of JSON

The request went to www.pharmgkb.org or api.pharmgkb.org.

Fix: `api.pharmgkb.org` is now NXDOMAIN and the www host serves the ClinPGx web app. Use `api.clinpgx.org`.

Empty data array

The symbol did not match.

Fix: Symbols must be current HGNC form. Older aliases are not always resolved; check the symbol before querying.

Enormous response

`view=max` pulls in every related annotation.

Fix: Start with `view=base` and request richer views only for the specific records that need them.

Allele definitions not in the response

`alleleFile` is a filename, not data.

Fix: Star-allele definition tables are published as separate downloadable spreadsheets. The API points at them rather than embedding them.

ClinPGx (PharmGKB) API — frequently asked questions

Is the ClinPGx API free?

Yes, the public data endpoints are free with no key or account. The content is licensed CC BY-SA 4.0, so redistribution requires attribution and carries a share-alike obligation.

What happened to the PharmGKB API?

PharmGKB became ClinPGx and the API moved to `api.clinpgx.org`. The old `api.pharmgkb.org` host no longer resolves at all, and `www.pharmgkb.org/v1/...` returns the web application's HTML — a confusing failure mode if your code predates the change.

What does the cpicGene flag mean?

That the Clinical Pharmacogenetics Implementation Consortium has published prescribing guidance involving the gene. It is the clearest available marker that a gene-drug relationship has enough evidence behind it to have reached formal clinical guidelines.

Can I use this to decide a patient's medication dose?

No. ClinPGx is a curated research knowledge base describing published gene-drug evidence and the existence of guidelines. Applying pharmacogenomics to an individual requires a validated clinical test and a qualified prescriber working from the guidelines themselves.

Tools that pair with this API

ClinPGx (PharmGKB) is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.