# PubChem API

> PubChem returns chemical details and safety data, available as a workflow and API.

Get chemical returns compound names, identifiers, formula, weight, description, and structure image for a common name or CAS number. Get chemical safety returns reported hazards, first aid, flash point, and exposure limits for a chemical name or CAS number.

- Page: https://fous.com/tools/pubchem
- Handle: `@pubchem`
- Category: [Science](https://fous.com/tools/category/science)
- Source website: https://pubchem.ncbi.nlm.nih.gov
- Last verified: Sep 29, 2026

## Methods

### Get chemical

Operation `get_chemical`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Get a chemical’s formula, molecular weight, names, description, and structure image from its common name or CAS number. Descriptions and CAS numbers may be unavailable for some compounds.

**Input**

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

**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.",
      "examples": [
        "acetone",
        "caffeine",
        "58-08-2"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "chemical": "acetone"
    },
    {
      "chemical": "caffeine"
    },
    {
      "chemical": "58-08-2"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `name` | string | `"Acetone"` | Compound name. |
| `smiles` | string or null | `"CC(=O)C"` | SMILES molecular structure. |
| `inchikey` | string or null | `"CSCPPACGZOOCGX-UHFFFAOYSA-N"` | InChIKey structure identifier. |
| `cas_number` | string or null | `"67-64-1"` | CAS registry number if listed among PubChem synonyms. |
| `iupac_name` | string or null | `"propan-2-one"` | IUPAC chemical name. |
| `description` | string or null | `"Acetone is a methyl ketone that consists of propane bearing an oxo group at C2."` | Brief plain-text description. |
| `pubchem_cid` | integer | `180` | PubChem compound ID. |
| `pubchem_url` | string | `"https://pubchem.ncbi.nlm.nih.gov/compound/180"` | PubChem compound page. |
| `common_synonyms` | array |  | Up to ten other names for the chemical. |
| `molecular_formula` | string or null | `"C3H6O"` | Molecular formula. |
| `structure_image_url` | string | `"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/180/PNG?record_type=2d"` | 2D chemical structure PNG link. |
| `molecular_weight_g_per_mol` | number or null | `58.08` | Molecular weight in grams per mole. |

**Example input**

```json
{
  "chemical": "acetone"
}
```

**Example output**

```json
{
  "name": "Acetone",
  "smiles": "CC(=O)C",
  "inchikey": "CSCPPACGZOOCGX-UHFFFAOYSA-N",
  "cas_number": "67-64-1",
  "iupac_name": "propan-2-one",
  "description": "Acetone is a methyl ketone that consists of propane bearing an oxo group at C2.",
  "pubchem_cid": 180,
  "pubchem_url": "https://pubchem.ncbi.nlm.nih.gov/compound/180",
  "common_synonyms": [
    "2-propanone",
    "propanone",
    "propan-2-one"
  ],
  "molecular_formula": "C3H6O",
  "structure_image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/180/PNG?record_type=2d",
  "molecular_weight_g_per_mol": 58.08
}
```

### Get chemical safety

Operation `get_chemical_safety`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Get PubChem hazard labels, route-specific first aid, flash point, and workplace exposure limits for a chemical name or CAS number. Fields absent from the compound record are null; common product names may resolve to their underlying compound, which is identified by its returned name.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `chemical` | string | yes | `"acetone"` | Common chemical name or CAS number, for example acetone, bleach, or 67-64-1. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "chemical"
  ],
  "properties": {
    "chemical": {
      "type": "string",
      "description": "Common chemical name or CAS number, for example acetone, bleach, or 67-64-1.",
      "examples": [
        "acetone",
        "bleach",
        "67-64-1"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "chemical": "acetone"
    },
    {
      "chemical": "bleach"
    },
    {
      "chemical": "67-64-1"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `name` | string | `"Acetone"` | PubChem name of the matched compound. |
| `first_aid` | object |  |  |
| `first_aid.eyes` | string or null | `"Rinse with plenty of water (remove contact lenses if easily possible). Refer for medical attention."` |  |
| `first_aid.skin` | string or null | `"Remove contaminated clothes. Rinse skin with plenty of water or shower."` |  |
| `first_aid.swallowing` | string or null | `"Rinse mouth. Do NOT induce vomiting. Refer for medical attention ."` |  |
| `first_aid.breathing_in` | string or null | `"Fresh air, rest. Refer for medical attention."` |  |
| `flash_point` | string or null | `"0 °F (NTP, 1992)"` | Reported flash point with units. |
| `signal_word` | string or null | `"Danger"` | GHS signal word, Danger or Warning, when reported. |
| `ghs_hazard_codes` | array or null |  | GHS H-codes corresponding to the hazard statements. |
| `hazard_pictograms` | array or null |  | GHS pictogram names and images. |
| `hazard_pictograms[].name` | string | `"Flammable"` |  |
| `hazard_pictograms[].image_link` | string | `"https://pubchem.ncbi.nlm.nih.gov/images/ghs/GHS02.svg"` |  |
| `hazard_statements` | array or null |  | GHS hazards in plain words. |
| `pubchem_compound_id` | integer | `180` | PubChem compound ID. |
| `safety_section_link` | string | `"https://pubchem.ncbi.nlm.nih.gov/compound/180#section=Safety-and-Hazards"` | PubChem Safety and Hazards section. |
| `workplace_exposure_limits` | string or null | `"OSHA: Permissible Exposure Limit: Table Z-1 8-hr Time Weighted Avg: 1000 ppm (2400 mg/cu m).; OSHA: Vacated 1989 OSHA P` | Reported OSHA or other workplace exposure limits with units. |

**Example input**

```json
{
  "chemical": "acetone"
}
```

**Example output**

```json
{
  "name": "Acetone",
  "first_aid": {
    "eyes": "Rinse with plenty of water (remove contact lenses if easily possible). Refer for medical attention.",
    "skin": "Remove contaminated clothes. Rinse skin with plenty of water or shower.",
    "swallowing": "Rinse mouth. Do NOT induce vomiting. Refer for medical attention .",
    "breathing_in": "Fresh air, rest. Refer for medical attention."
  },
  "flash_point": "0 °F (NTP, 1992)",
  "signal_word": "Danger",
  "ghs_hazard_codes": [
    "H225",
    "H319",
    "H336"
  ],
  "hazard_pictograms": [
    {
      "name": "Flammable",
      "image_link": "https://pubchem.ncbi.nlm.nih.gov/images/ghs/GHS02.svg"
    },
    {
      "name": "Irritant",
      "image_link": "https://pubchem.ncbi.nlm.nih.gov/images/ghs/GHS07.svg"
    }
  ],
  "hazard_statements": [
    "Highly Flammable liquid and vapor",
    "Causes serious eye irritation",
    "May cause drowsiness or dizziness"
  ],
  "pubchem_compound_id": 180,
  "safety_section_link": "https://pubchem.ncbi.nlm.nih.gov/compound/180#section=Safety-and-Hazards",
  "workplace_exposure_limits": "OSHA: Permissible Exposure Limit: Table Z-1 8-hr Time Weighted Avg: 1000 ppm (2400 mg/cu m).; OSHA: Vacated 1989 OSHA PEL TWA 750 ppm (1800 mg/cu m); STEL 1000 ppm (2400 mg/cu m) is still enforced in …"
}
```

## Quick start

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@pubchem",
  "visibility": "public",
  "operation": "get_chemical",
  "version": 1,
  "input": {
    "chemical": "acetone"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

body = json.loads("{\n  \"api\": \"@pubchem\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_chemical\",\n  \"version\": 1,\n  \"input\": {\n    \"chemical\": \"acetone\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=180) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_000),
  body: JSON.stringify({
  "api": "@pubchem",
  "visibility": "public",
  "operation": "get_chemical",
  "version": 1,
  "input": {
    "chemical": "acetone"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/pubchem`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `get_chemical`: Get chemical. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `get_chemical_safety`: Get chemical safety. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-pubchem https://api.fous.com/mcp/tools/pubchem --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## Use cases

- Look up a compound’s formula and molecular weight.
- Compare chemical names and structure identifiers.
- Review reported hazard labels and pictograms.
- Find first-aid guidance by exposure route.
- Check reported flash points and workplace exposure limits.

## FAQ

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this PubChem tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. With pay as you go, a credit costs 1¢. Monthly plans cost less per credit.

### Do I need a PubChem account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from pubchem.ncbi.nlm.nih.gov when you run it. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified on Sep 29, 2026.

### What are a chemical’s molecular formula and weight?

Get chemical returns the molecular formula and molecular weight for a common chemical name or CAS number.

### What hazards are reported for a chemical?

Get chemical safety returns reported hazard statements, codes, signal word, and pictograms for a chemical name or CAS number.

### What first aid is listed for chemical exposure?

Get chemical safety returns reported first-aid information, including guidance for eyes, skin, swallowing, and breathing in.

## Related

- [PubMed API](https://fous.com/tools/pubmed.md): PubMed searches medical and life-science articles by topic and retrieves one article’s abstract and publication details; abstracts and free full-text links may be unavailable.
- [Drugs.com API](https://fous.com/tools/drugs-com.md): Drugs.com provides public medicine guides, interaction and food or lifestyle warnings for 2–10 medicines, pill matches by imprint, color, or shape, and listed US cash prices by strength, form, and quantity.
- [FDA API](https://fous.com/tools/fda.md): FDA provides drug safety data, latest matching drug labels, common reported side effects, and newest-first drug, food, and device recalls; recent drug and device recalls may be missing, and weekly food statuses may lag.
- [CPSC API](https://fous.com/tools/cpsc.md): U.S. Consumer Product Safety Commission recalls and product safety information.
- [npm API](https://fous.com/tools/npm.md): npm provides package details, search results and latest versions, plus weekly download and publish data; daily and historical download counts may lag by a day or more.
- [Crossref API](https://fous.com/tools/crossref.md): Find scholarly works and format citations from their registered metadata.
- [Google Patents API](https://fous.com/tools/google-patents.md): Google Patents searches public records and provides patent details and company summaries; legal status is estimated, and citations, claims, and company breakdowns have record limits.
- [Open Food Facts API](https://fous.com/tools/open-food-facts.md): Open Food Facts provides public packaged-food information, including ingredients, allergens, nutrition, and product classifications; coverage varies, and search results favor popular products.
- [All Science tools](https://fous.com/tools/category/science)
