GnistAI GnistAI
Log in

PubChem

Chemical compound data — structures, properties, bioactivity, and safety information.

Overview   |   MCP   |   REST API   |   OpenAPI   |   CLI   |   Tutorial   |   Toolkits   |   Home
status: healthy status status healthy healthy tools: 5 tools tools 5 5 type: api wrapper type type api wrapper api wrapper lifecycle: maintained lifecycle lifecycle maintained maintained Science

Data source: PubChem (NCBI)

REST Bridge Endpoint https://context.gnist.ai/rest/pubchem/
Authentication

All requests require a Gnist-API-Key header (or api_key query parameter).

Free tier: 100 calls/day. Get your API key.

Tools (5)

get_compound

Look up a chemical compound by name, CID, InChIKey, or SMILES.

PubChem covers 100M+ chemical structures. Returns molecular formula, weight,
SMILES, InChI, IUPAC name, and key physicochemical descriptors.

Args:
identifier: The compound identifier. Examples:
- By name: "aspirin", "caffeine", "glucose"
- By CID: "2244" (aspirin's PubChem CID)
- By InChIKey: "BSYNRYMUTXBXSQ-UHFFFAOYSA-N"
- By SMILES: "CC(=O)Oc1ccccc1C(=O)O"
namespace: How to interpret the identifier. One of:
"name" (default), "cid", "inchikey", "smiles".

Returns:
Compound record with cid, iupac_name, molecular_formula, molecular_weight,
canonical_smiles, isomeric_smiles, inchi, inchikey, xlogp, exact_mass,
tpsa, hbond_donors, hbond_acceptors, rotatable_bonds, heavy_atom_count,
charge, and complexity.

ParameterTypeRequiredDescription
identifierstringrequiredThe compound identifier. Examples: - By name: "aspirin", "caffeine", "glucose" - By CID: "2244" (aspirin's PubChem CID) - By InChIKey: "BSYNRYMUTXBXSQ-UHFFFAOYSA-N" - By SMILES: "CC(=O)O...
namespacestringoptionalHow to interpret the identifier. One of: "name" (default), "cid", "inchikey", "smiles". (default: "name")
Request Body
{
  "identifier": "example"
}
search_compounds

Search PubChem for chemical compounds by name or keyword.

Returns a compact list of matching compounds (CID, IUPAC name, formula, weight).
Use get_compound with the returned CID for full details.

Args:
query: Chemical name or keyword (e.g., "aspirin", "beta-lactam", "serotonin").
max_results: Number of results to return (1–50, default 10).

Returns:
List of matching compounds with cid, iupac_name, molecular_formula, molecular_weight.

ParameterTypeRequiredDescription
querystringrequiredChemical name or keyword (e.g., "aspirin", "beta-lactam", "serotonin").
max_resultsintegeroptionalNumber of results to return (1–50, default 10). (default: 10)
Request Body
{
  "query": "example"
}
get_compound_properties

Fetch physicochemical properties for a PubChem compound by CID.

Returns a richer property set than get_compound, including stereochemistry
counts, covalent units, and monoisotopic mass.

Args:
cid: PubChem Compound ID (e.g., 2244 for aspirin). Found in search_compounds results.
properties: Optional list of specific property names to fetch. If omitted, returns
all standard properties. Available properties include:
MolecularFormula, MolecularWeight, CanonicalSMILES, IsomericSMILES,
InChI, InChIKey, IUPACName, XLogP, ExactMass, MonoisotopicMass,
TPSA, Complexity, Charge, HBondDonorCount, HBondAcceptorCount,
RotatableBondCount, HeavyAtomCount, CovalentUnitCount,
AtomStereoCount, BondStereoCount.

Returns:
Dict of property name → value for the requested properties.

ParameterTypeRequiredDescription
cidintegerrequiredPubChem Compound ID (e.g., 2244 for aspirin). Found in search_compounds results.
propertiesanyoptionalOptional list of specific property names to fetch. If omitted, returns all standard properties. Available properties include: MolecularFormula, MolecularWeight, CanonicalSMILES, IsomericSMILES, InC...
Request Body
{
  "cid": 1
}
find_similar_compounds

Find structurally similar compounds using 2D Tanimoto similarity.

Uses PubChem's fast 2D fingerprint similarity search. Useful for identifying
drug analogs, structural scaffolds, or related molecules.

Args:
cid: PubChem Compound ID to use as the query structure.
threshold: Tanimoto similarity threshold (0–100, default 90). Higher values
return only very close structural matches. 90 is a common threshold for
drug analog searches.
max_results: Number of similar compounds to return (1–50, default 10).

Returns:
List of similar compounds with cid, iupac_name, molecular_formula, molecular_weight.

ParameterTypeRequiredDescription
cidintegerrequiredPubChem Compound ID to use as the query structure.
thresholdintegeroptionalTanimoto similarity threshold (0–100, default 90). Higher values return only very close structural matches. 90 is a common threshold for drug analog searches. (default: 90)
max_resultsintegeroptionalNumber of similar compounds to return (1–50, default 10). (default: 10)
Request Body
{
  "cid": 1
}
report_feedback

Report a bug, feature request, or general feedback for this data source.

Use this when something doesn't work as expected, when you'd like
a new feature, or when you have suggestions for improvement.

Args:
feedback: Describe the issue or suggestion.
feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: "general")
Request Body
{
  "feedback": "example"
}

Quick Start

Shell
curl -X POST "https://context.gnist.ai/rest/pubchem/get_compound" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"identifier": "example"}'
Python
import httpx

resp = httpx.post(
    "https://context.gnist.ai/rest/pubchem/get_compound",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={
  "identifier": "example"
},
)
print(resp.json())

Related Toolkits (Science)

Resources