Search Compounds
pubchem_search_compoundsSearch PubChem for chemical compounds using names, SMILES, InChIKeys, or molecular formulas. Find structurally related compounds through substructure, superstructure, or Tanimoto similarity searches with optional property retrieval.
Instructions
Search PubChem for chemical compounds. Five search modes:
identifier: Resolve compound names, SMILES, or InChIKeys to CIDs (batch up to 25)
formula: Find compounds by molecular formula (Hill notation, e.g. "C6H12O6")
substructure: Find compounds containing a substructure (SMILES or CID)
superstructure: Find compounds that are substructures of the query
similarity: Find structurally similar compounds by 2D Tanimoto similarity
Optionally hydrate results with properties to avoid a follow-up details call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| searchType | Yes | Search strategy: "identifier" (name/SMILES/InChIKey lookup), "formula", "substructure", "superstructure", or "similarity". | |
| identifierType | No | Required for identifier search. Type of chemical identifier: "name", "smiles", or "inchikey". | |
| identifiers | No | Required for identifier search. Array of identifiers to resolve (1-25). Examples: ["aspirin", "ibuprofen"] for name, ["CC(=O)OC1=CC=CC=C1C(=O)O"] for SMILES. | |
| formula | No | Required for formula search. Molecular formula in Hill notation (e.g. "C6H12O6", "CaH2O2"). | |
| allowOtherElements | No | Formula search only. When true, includes compounds with additional elements beyond the formula. | |
| query | No | Required for substructure/superstructure/similarity searches. A SMILES string or PubChem CID (as string) for the query structure. | |
| queryType | No | Required for structure/similarity searches. Format of the query: "smiles" or "cid". | |
| threshold | No | Similarity search only. Minimum Tanimoto similarity (70-100). 90+ for close analogs, 70-80 for scaffold hops. Default: 90. | |
| maxResults | No | Maximum CIDs to return (1-200). Default: 20. | |
| properties | No | Optional: fetch these properties for each result, avoiding a follow-up details call. E.g. ["MolecularFormula", "MolecularWeight", "CanonicalSMILES"]. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| searchType | Yes | The search strategy used. | |
| totalFound | Yes | Total CIDs found (before maxResults cap). | |
| results | Yes | Matching compounds. |