BYTETOOLS

PubChem API

Free NIH PubChem API with no key: 100M+ chemical compounds with formulas, molecular weight, structures, synonyms, safety and bioactivity data. Tested.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 20 Aug 2026

What is the PubChem API?

The PubChem PUG REST API is a free, key-free API from the US National Institutes of Health providing data on more than 100 million chemical compounds — molecular formula and weight, structures, synonyms, safety information and bioactivity.

PubChem is the world's largest open chemistry database, run by the NIH. You can look up compounds by name, CID, SMILES, InChI or molecular formula, and request exactly the properties you need in one request.

The property-selection syntax is what makes it efficient: `/property/MolecularFormula,MolecularWeight/JSON` returns just those fields rather than an enormous compound record. Requesting the full record when you need two numbers is the usual mistake.

Quick facts

Base URL
https://pubchem.ncbi.nlm.nih.gov/rest/pug
Authentication
No API key required.
Rate limit
5 requests per second and 400 per minute per IP.
Pricing
Free public domain US government data.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the PubChem API

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

1. Look up compound properties by name

GET https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/aspirin/property/MolecularFormula,MolecularWeight/JSON

curl
curl 'https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/aspirin/property/MolecularFormula,MolecularWeight/JSON'
JavaScript (fetch)
const res = await fetch("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/aspirin/property/MolecularFormula,MolecularWeight/JSON");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/aspirin/property/MolecularFormula,MolecularWeight/JSON", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "PropertyTable": {
    "Properties": [
      {
        "CID": 2244,
        "MolecularFormula": "C9H8O4",
        "MolecularWeight": "180.16"
      }
    ]
  }
}

Parameters

ParameterTypeRequiredDescription
compound/name/<name>pathOptionalLook up by common or chemical name. compound/name/aspirin
compound/cid/<cid>pathOptionalLook up by PubChem Compound ID. compound/cid/2244
property/<list>/JSONpathOptionalComma-separated properties to return. property/MolecularFormula/JSON
compound/smiles/<smiles>pathOptionalLook up by SMILES string. compound/smiles/CCO

Response fields

PropertyTable.Propertiesarray
One entry per matched compound.
...CIDinteger
PubChem Compound ID — the canonical identifier.
...MolecularFormulastring
Chemical formula, e.g. C9H8O4.
...MolecularWeightstring
Molecular weight, returned as a string.
...CanonicalSMILESstring
SMILES structure notation, when requested.
...IUPACNamestring
Systematic IUPAC name, when requested.

What you can build with the PubChem API

  • Build a chemical compound lookup for education or research
  • Convert between chemical names, formulas and structures
  • Enrich a drug database with molecular properties
  • Validate chemical identifiers in a laboratory system

Common errors and how to fix them

404 PUGREST.NotFound

The compound name is not recognised.

Fix: Try a systematic name, a synonym, or search by SMILES/InChI instead of a colloquial name.

503 PUGREST.ServerBusy

Rate limit exceeded.

Fix: Stay under 5 requests per second; PubChem enforces this strictly.

Huge responses

You requested the full compound record.

Fix: Use the /property/ path to select only the fields you need.

PubChem API — frequently asked questions

Is the PubChem API free?

Yes, completely free with no API key. It is public domain data published by the US National Institutes of Health.

How do I get just the molecular weight?

Use the property path: /compound/name/aspirin/property/MolecularWeight/JSON. Requesting the full compound record returns megabytes you do not need.

Can I search by chemical structure?

Yes, PubChem accepts SMILES and InChI identifiers as lookup keys, alongside names and CIDs.

What is the rate limit?

Five requests per second and 400 per minute per IP, enforced strictly with a 503 ServerBusy response.

Tools that pair with this API

Alternatives to PubChem API

If PubChem does not fit, these health & medical apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.

APIWhat it doesAuthCORSLast verified
openFDAFree FDA openFDA API with no key: drug labels, adverse event reports, recalls, device and food safety data from official US regulatory records. Tested example.No keyYes19 Aug 2026
RxNormFree NIH RxNorm API with no key: normalised drug names, ingredients, brand-generic mapping and clinical drug identifiers from the US National Library of Medicine.No keyYes19 Aug 2026
ClinicalTrials.govFree ClinicalTrials.gov API with no key: 500,000+ clinical studies worldwide with conditions, interventions, eligibility, locations and results. Tested example.No keyNo19 Aug 2026
WHO Global Health ObservatoryFree World Health Organization API with no key: 2,000+ health indicators by country and year — life expectancy, mortality, immunisation and disease data. Tested.No keyNo19 Aug 2026
NCBI E-utilities (PubMed)Free NCBI E-utilities API with no key: search 35M+ biomedical citations in PubMed, plus GenBank, protein and other NCBI databases. Tested curl example.No keyYes20 Aug 2026
CDC Environmental Public Health TrackingFree CDC Environmental Public Health Tracking API with no key: asthma, air quality, drinking water, heat illness, lead poisoning and climate health measures by state and county.No keyYes21 Aug 2026
All Health & Medical APIs

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