Data source: PubChem (NCBI)
https://context.gnist.ai/rest/pubchem/
AuthenticationAll requests require a Gnist-API-Key header (or api_key query parameter).
Free tier: 100 calls/day. Get your API key.
Tools (5)
get_compoundLook 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
identifier | string | required | 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)O... |
namespace | string | optional | How to interpret the identifier. One of: "name" (default), "cid", "inchikey", "smiles". (default: "name") |
{
"identifier": "example"
}search_compoundsSearch 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | required | Chemical name or keyword (e.g., "aspirin", "beta-lactam", "serotonin"). |
max_results | integer | optional | Number of results to return (1–50, default 10). (default: 10) |
{
"query": "example"
}get_compound_propertiesFetch 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
cid | integer | required | PubChem Compound ID (e.g., 2244 for aspirin). Found in search_compounds results. |
properties | any | optional | Optional list of specific property names to fetch. If omitted, returns all standard properties. Available properties include: MolecularFormula, MolecularWeight, CanonicalSMILES, IsomericSMILES, InC... |
{
"cid": 1
}find_similar_compoundsFind 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
cid | integer | required | PubChem Compound ID to use as the query structure. |
threshold | integer | optional | Tanimoto 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_results | integer | optional | Number of similar compounds to return (1–50, default 10). (default: 10) |
{
"cid": 1
}report_feedbackReport 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'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (default: "general") |
{
"feedback": "example"
}Quick Start
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"}'
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())