Get Compound Interactions
pubchem_get_compound_interactionsFetch drug-food interactions and assay-named molecular targets for a PubChem compound, paged by kind with source and outcome counts.
Instructions
Get a compound's interaction data: drug-food interactions, and the molecular targets its bioassays name — one entry per target as kinds defines it, with its assay counts by outcome and most potent active value, Active targets first, most potent first. Each entry carries its originating source. Results are paged per kind, with the record total and the next offset reported for each. Drug-food coverage is richest for approved drugs; target covers any compound PubChem has assay data for, and pubchem_get_bioactivity lists one target's assays when given the entry's GeneID or accession. Drug-drug interactions (DrugBank) are unavailable while PubChem's SDQ service refuses automated requests: an explicit drug-drug request is reported in failedKinds while the other kinds still return.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cid | Yes | PubChem Compound ID. Resolve from name/SMILES with pubchem_search_compounds. | |
| kinds | No | Interaction kinds to fetch. "drug-food" (dietary interactions, from PUG View), "target" (molecular targets from the compound's assay summary: one entry per Gene ID with the accessions the table pairs with it, and one per identifier it never pairs, so a Gene ID and an accession that no row pairs are separate entries even when they name the same protein), "drug-drug" (interactions with other drugs, from PubChem's SDQ service, which refuses automated requests, so it is reported in failedKinds). Default: ["drug-food"]. | |
| offset | No | Zero-based start position within each requested kind, counted in records (molecular targets, for target) rather than returned entries. The same offset applies to every kind in the call, and the kinds advance at different rates — when paging past the first page, request one kind per call and pass that kind's nextOffset. Default: 0. | |
| maxEntries | No | Max entries per kind per page. The per-call cap is 50: a larger value (up to 1000) reads a page of 50 per kind and is reported in cappedInputs. Well-studied drugs have a long tail of interactions; use offset to reach the ones past this page. Default: 10. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cid | No | PubChem Compound ID. | |
| error | No | Present when the call failed. Absent on success. | |
| notice | No | Guidance when a kind failed, when no interaction data was found, when the offset runs past every requested kind, when target names could not be retrieved, or when further pages remain. Absent when this page is complete and every kind resolved. | |
| offset | No | Zero-based start position read within each requested kind. | |
| paging | No | Per-kind page position, one entry per requested kind that was retrieved. A kind listed in failedKinds is absent — its position is unknown, not exhausted. | |
| entries | No | Interaction entries across the requested kinds. | |
| truncated | No | True when at least one requested kind has source records remaining past this page. Which kinds, and how many records each holds, is in paging[].truncated / paging[].totalRecords. | |
| nextOffset | No | Offset to pass on the next call, reported when exactly one requested kind has records remaining. Omitted when none do, and when several do — those advance to different positions, so read paging[].nextOffset instead. | |
| failedKinds | No | Interaction kinds that could not be retrieved (comma-separated). The returned entries cover the kinds that succeeded. The notice says, per failed kind, whether a retry can help: a timeout, rate limit, network error, unreadable response, or upstream 5xx other than 501 can clear, while an HTTP 400, 403, or 501, a response in a shape the server does not expect, or a refusal from PubChem's SDQ service (drug-drug) does not. | |
| cappedInputs | No | Inputs that asked for more than their per-call cap, with the value requested and the value served. An ID batch lists the IDs past the cap in unprocessed. Omitted when every input was within its cap. | |
| returnedCount | No | Total interaction entries returned across all kinds. | |
| requestedKinds | No | Interaction kinds requested (comma-separated). |