An open API for medications
Drugs, classes, interactions, indications, and 2D structures — structured, versioned, free. A developer-first reference layer for the world’s pharmacopeia, available over REST, GraphQL, and first-party SDKs.
One fetch away from every prescription.
Predictable URLs. JSON in, JSON out. Every response is validated with Zod against the same schema that generates these docs, the SDKs, and the OpenAPI document — so the shape never surprises you.
{
"slug": "metformin",
"name": "Metformin",
"jurisdiction": "US-FDA",
"classes": [
{ "slug": "biguanide", "name": "Biguanide", "kind": "epc" }
],
"mechanism": {
"summary": "Decreases hepatic glucose production via inhibition of mitochondrial glycerophosphate dehydrogenase …",
"targets": ["AMP-activated protein kinase (AMPK)"]
},
"indications": [
{ "text": "Type 2 diabetes mellitus", "icd10": ["E11"] }
],
"identifiers": {
"rxcui": "6809",
"atc": ["A10BA02"],
"drugbank": "DB00331"
}
}// npm i @pharmacopeia/client
import { Pharmacopeia } from "@pharmacopeia/client";
const pc = new Pharmacopeia();
const metformin = await pc.getDrug("metformin");
const pairs = await pc.checkInteractions([
"warfarin",
"ibuprofen",
]);- Strongly-typed schema for drugs, classes, interactions, and indications.
- Open data — every entity has a verifiable source URL and hash.
- Generated docs, SDKs, and OpenAPI 3.1 from the same Zod schema.
Explore the dataset
Every entity is keyed by a stable slug and links back to the canonical public source it came from.
Mechanism, indications, dosing, identifiers, and 2D structures rendered offline from PubChem.
Pharmacological classes from FDA EPC, WHO ATC, MoA, and MeSH.
- StatinHMG-CoA Reductase InhibitorEPC
- BiguanidesA10BAATC
- ACE inhibitorEC 3.4.15.1MoA
- Antidepressive AgentsD000928MeSH
Walk the WHO Anatomical Therapeutic Chemical hierarchy, levels 1–5.
A · Alimentary tract and metabolism └─ A10 · Drugs used in diabetes └─ A10B · Blood glucose lowering └─ A10BA · Biguanides └─ metformin
Tripartite network of drugs, mechanism-of-action classes, and molecular targets.
Brand-to-generic crosswalk. Land on Glucophage, pivot to metformin.
- Glucophagemetformin
- Lipitoratorvastatin
- Tylenolacetaminophen
- Zoloftsertraline
Tools built on the API
Small reference utilities that demonstrate what the public API can do.
Pick a set of drugs and check them pairwise, severity-graded.
- warfarin × ibuprofenmajor
- sertraline × tramadolcontraindicated
- metformin × iodine contrastmoderate
Two or three drugs side by side across class, mechanism, and identifiers.
Paste a SMILES, find the nearest indexed drugs by 2D Tanimoto.
- salicylic-acid0.89
- diflunisal0.74
- mesalamine0.62
Find drugs, ingredients, classes, and brands by name or synonym.
- Metformindrug
- Glucophagebrand
- Biguanideclass
- A10BA · Biguanidesatc
Retrieval your LLM can cite
Every record is chunked into small, citable passages. Search them by meaning over plain REST — then reach for the grounded tier when a model needs a verifiable source behind every token.
Ask what you mean, not what you can spell. Embedding-backed when available, lexical fallback otherwise — same shape either way.
- nebivololmechanism0.82
- metoprololwarnings0.77
- propranololcautions0.71
The key-gated tier for LLM consumers: every passage carries a citation and a character-span grounding map back to its source.
Assess renal function before initiating and at least annually; metformin is contraindicated below an eGFR of 30 mL/min/1.73m².c1
// POST /api/v1/grounded — retrieval built for LLMs
const res = await fetch("/api/v1/grounded", {
method: "POST",
headers: { Authorization: "Bearer pk_live_…" },
body: JSON.stringify({ query: "metformin renal dosing" }),
});
const { passages, citations } = await res.json();
// every passage.grounding span maps to a citation with
// sourceUrl, sourceHash, extractedAt, confidenceBuild with it
REST, GraphQL, and typed clients for TypeScript and Python — all generated from the same Zod schema, so the contract never drifts.
Make your first request in under a minute. No key required.
curl https://pharmacopeia.dev/api/v1/drug/metformin
Interactive Scalar reference over the OpenAPI 3.1 document.
GET/api/v1/drugsGET/api/v1/drug/{slug}GET/api/v1/drug/{slug}/similarPOST/api/v1/interactions/checkPOST/api/v1/structure-searchGET/api/v1/atc
Field-selected GraphQL surface with a built-in GraphiQL IDE.
{ drug(slug: "metformin") { name classes { name kind } mechanism { summary targets } } }
@pharmacopeia/client on npm · pharmacopeia on PyPI. Typed end-to-end.
# TypeScript npm i @pharmacopeia/client # Python pip install pharmacopeia
A community project, made by and for the people who build with medical data.
pharmacopeia is unaffiliated with the FDA, NIH, or any regulatory agency. We host structured facts (mechanism, identifiers, dosing) and link out to the canonical source for every field. Educational and informational use only.