pubchem.md
150 lines · skills/database-lookup/references/pubchem.md at 5f2bc03
PubChem PUG REST API
Raw lines 1 to 2URL Pattern
/{domain}/{namespace}/{identifiers}/{operation}/{output}- domain:
compound,substance,assay - namespace:
cid,name,smiles,inchi,inchikey,fastformula - operation:
record,property,synonyms,description,cids,xrefs - output:
JSON,XML,CSV,TXT,SDF,PNG
Key Endpoints
Raw lines 20 to 21Search by CID
GET /compound/cid/{cid}/JSONExample: /compound/cid/2244/JSON
Multiple CIDs: /compound/cid/2244,5988,3672/JSON
Search by SMILES
GET /compound/smiles/{smiles}/JSONFor SMILES with special characters, use POST:
POST /compound/smiles/JSON
Content-Type: application/x-www-form-urlencoded
smiles=CC(=O)OC1=CC=CC=C1C(=O)ORaw lines 36 to 46Search by InChI (POST only — InChI strings are too long for URLs)
POST /compound/inchi/JSON
Content-Type: application/x-www-form-urlencoded
inchi=InChI=1S/C9H8O4/...Raw lines 52 to 58Search by molecular formula
GET /compound/fastformula/{formula}/JSONExample: /compound/fastformula/C9H8O4/JSON
Property retrieval
GET /compound/{namespace}/{id}/property/{property_list}/JSONProperties are comma-separated. Available properties:
MolecularFormula, MolecularWeight, ConnectivitySMILES, SMILES, InChI, InChIKey, IUPACName, XLogP, ExactMass, MonoisotopicMass, TPSA, Complexity, Charge, HBondDonorCount, HBondAcceptorCount, RotatableBondCount, HeavyAtomCount, CID
Example:
/compound/cid/2244/property/MolecularFormula,MolecularWeight,ConnectivitySMILES,IUPACName/JSONResponse:
{
"PropertyTable": {
"Properties": [
{
"CID": 2244,
"MolecularFormula": "C9H8O4",
"MolecularWeight": "180.16",
"IUPACName": "2-acetyloxybenzoic acid",
"ConnectivitySMILES": "CC(=O)OC1=CC=CC=C1C(O)=O"
}
]
}
}Raw lines 65 to 94Cross-references (patents, registry IDs)
GET /compound/cid/{cid}/xrefs/PatentID/JSON
GET /compound/cid/{cid}/xrefs/RegistryID/JSONRaw lines 110 to 115Fast similarity search (synchronous CID result)
POST /compound/fastsimilarity_2d/smiles/cids/JSON
smiles=CC(=O)OC1=CC=CC=C1C(=O)O&Threshold=90Raw lines 116 to 1212D structure image
GET /compound/cid/{cid}/PNG
GET /compound/cid/{cid}/PNG?image_size=300x300Raw lines 122 to 127Rate Limits
- Max 5 requests per second
- Max 400 requests per minute
- Batch CIDs with commas; use POST when the URL becomes long and keep batches small enough to meet time/payload limits. Endpoint-specific limits differ.
- Throttle error returns
PUGREST.ServerBusyfault code
Error Format
{
"Fault": {
"Code": "PUGREST.NotFound",
"Message": "No CID found",
"Details": ["..."]
}
}fastsimilarity_2d returns IdentifierList.CID synchronously; do not look for an asynchronous ListKey in a successful fast-search response. Older SMILES property aliases may still be accepted but returned JSON keys use the current names above. Official contract: https://pubchem.ncbi.nlm.nih.gov/docs/pug-rest