# NIH API: Get chemical facts by name or CAS number

> Looks up a chemical on PubChem by common name or CAS number and returns its formula, molecular weight, names, description, SMILES, InChIKey and 2D structure image link.

Unofficial. Not affiliated with or endorsed by NIH.

- Page: https://fous.com/methods/pubchem.ncbi.nlm.nih.gov/get-chemical
- Method: `pubchem.ncbi.nlm.nih.gov/get_chemical`, version 1
- Website: pubchem.ncbi.nlm.nih.gov
- Returns: name, molecular formula and weight, IUPAC name, CAS number, synonyms, description, structure image URL, PubChem URL, CID, SMILES, InChIKey
- Effect: read (it gets data and changes nothing)
- Sign-in: none needed
- Cost: 1 credit per completed run (1¢ with pay as you go); failed runs are free
- Verified: Nov 2, 2026

## Inputs

| Field | Type | Required | In the run below | Description |
|---|---|---|---|---|
| `chemical` | string | yes | `"caffeine"` | Common chemical name or CAS number, for example caffeine or 58-08-2. |

## Output

From a run on Oct 23, 2026, shortened. Its input:

```json
{
  "chemical": "caffeine"
}
```

Its output:

```json
{
  "name": "Caffeine",
  "smiles": "CN1C=NC2=C1C(=O)N(C(=O)N2C)C",
  "inchikey": "RYYVLZVUVIJVGH-UHFFFAOYSA-N",
  "cas_number": "58-08-2",
  "iupac_name": "1,3,7-trimethylpurine-2,6-dione",
  "description": "Caffeine is a trimethylxanthine in which the three methyl groups are located at positions 1, 3, and 7.",
  "pubchem_cid": 2519,
  "pubchem_url": "https://pubchem.ncbi.nlm.nih.gov/compound/2519",
  "common_synonyms": [
    "Guaranine",
    "1,3,7-Trimethylxanthine",
    "Methyltheobromine"
  ],
  "molecular_formula": "C8H10N4O2",
  "structure_image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2519/PNG?record_type=2d",
  "molecular_weight_g_per_mol": 194.19
}
```

## Run it

From code, with a Fous API key in `FOUS_API_KEY`; the answer's `data` holds the output:

```bash
curl https://api.fous.com/v1/runs \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"method":"pubchem.ncbi.nlm.nih.gov/get_chemical","input":{"chemical":"caffeine"}}'
```

From an AI agent connected to the Fous MCP server: its `run` with the same method and input. To connect one, give it `set up https://fous.com/SKILL.md`.

## Ask your agent

- What is the molecular formula and molecular weight of caffeine?
- Look up CAS 50-78-2 and give me its SMILES and InChIKey.
- Can you find the IUPAC name and synonyms for aspirin on PubChem?
- I need the structure image link and PubChem CID for nicotine, please.
- Which chemical has CAS number 64-17-5, and what is its description on nih.gov?

## Input schema

```json
{
  "type": "object",
  "required": [
    "chemical"
  ],
  "properties": {
    "chemical": {
      "type": "string",
      "minLength": 1,
      "description": "Common chemical name or CAS number, for example caffeine or 58-08-2."
    }
  }
}
```

## Output schema

```json
{
  "type": "object",
  "required": [
    "name",
    "molecular_formula",
    "molecular_weight_g_per_mol",
    "iupac_name",
    "cas_number",
    "common_synonyms",
    "description",
    "structure_image_url",
    "pubchem_url",
    "pubchem_cid",
    "smiles",
    "inchikey"
  ],
  "properties": {
    "name": {
      "type": "string",
      "description": "Compound name."
    },
    "smiles": {
      "type": [
        "string",
        "null"
      ],
      "description": "SMILES molecular structure.",
      "x-fous-developer": true
    },
    "inchikey": {
      "type": [
        "string",
        "null"
      ],
      "description": "InChIKey structure identifier.",
      "x-fous-developer": true
    },
    "cas_number": {
      "type": [
        "string",
        "null"
      ],
      "description": "CAS registry number if listed among PubChem synonyms."
    },
    "iupac_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "IUPAC chemical name."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Brief plain-text description."
    },
    "pubchem_cid": {
      "type": "integer",
      "description": "PubChem compound ID.",
      "x-fous-developer": true
    },
    "pubchem_url": {
      "type": "string",
      "description": "PubChem compound page."
    },
    "common_synonyms": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Up to ten other names for the chemical."
    },
    "molecular_formula": {
      "type": [
        "string",
        "null"
      ],
      "description": "Molecular formula."
    },
    "structure_image_url": {
      "type": "string",
      "description": "2D chemical structure PNG link."
    },
    "molecular_weight_g_per_mol": {
      "type": [
        "number",
        "null"
      ],
      "description": "Molecular weight in grams per mole."
    }
  }
}
```

## See more

- [NIH API: Get chemical safety](https://fous.com/methods/pubchem.ncbi.nlm.nih.gov/get-chemical-safety.md): Looks up a chemical on PubChem by name or CAS number and returns its GHS hazard labels, route-specific first aid, flash point and workplace exposure limits.
- [NIH API: Search PubMed articles](https://fous.com/methods/pubmed.ncbi.nlm.nih.gov/search-articles.md): Finds PubMed medical and life-science articles by topic, with publication details and free full-text links when PubMed confirms them.
- [NIH API: Get PubMed article](https://fous.com/methods/pubmed.ncbi.nlm.nih.gov/get-article.md): Gets the full PubMed abstract and publication details for one article by title, PubMed link, or PubMed number (PMID). A title is searched in PubMed titles first and must closely match a found article. Some articles have no abstract or free full text.
- [NIH API: Search grants](https://fous.com/methods/reporter.nih.gov/search-grants.md): Finds NIH research grants by topic, organisation, or researcher name. Searches the last five fiscal years by default.
- [NIH API: Search diagnosis codes](https://fous.com/methods/clinicaltables.nlm.nih.gov/search-diagnosis-codes.md): Finds ICD-10-CM diagnosis codes and official names from a plain-language condition description, retrying with simplified wording when the first search finds nothing.
- [NIH API: Explain ICD-10-CM diagnosis code](https://fous.com/methods/clinicaltables.nlm.nih.gov/explain-diagnosis-code.md): Explains an ICD-10-CM diagnosis code with its official name, category, chapter, and whether it is billable, using the NLM Clinical Tables diagnosis table.
- [Drugs.com API: Identify pill by imprint](https://fous.com/methods/drugs.com/identify-pill.md): Finds possible pill matches on the Drugs.com pill identifier by imprint, optionally narrowed by color and shape, with each pill's labeler.
- [Drugs.com API: Get drug overview](https://fous.com/methods/drugs.com/get-drug.md): Looks up a medicine by brand or generic name on Drugs.com and returns a plain-language overview: class, uses, availability, schedule, dosage forms, side effects, and pregnancy and breastfeeding notes.
- [All NIH methods](https://fous.com/methods/nih.gov.md)
