# PubChem: chemical compounds, bioassays, targets and patents · Search

Get health and medical data with PubChem: chemical compounds, bioassays, targets and patents · Search from Alexandria through one Spiral API key. Start here to turn a drug, chemical or structure into a PubChem CID for get, similar, bioassays, targets and patents. Unknown names and structures, and formulas PubChem has no compound for, return an empty list; a SMILES or InChI PubChem cannot read is invalid_input. It runs in the background and returns structured JSON. Pay as you go, with no subscription.

- Provider: Alexandria
- Category: Health
- Runs: In the background
- Returns: json
- Tool id: `alexandria` / `pubchem-ncbi-nlm-nih-gov/compounds/search`
- Page: https://spiral.ai/tools/alexandria/pubchem-ncbi-nlm-nih-gov/compounds/search

## Pricing

$0.00873 per call.

## Limits

- Longest queue wait: 1 hour
- Run deadline: 5 minutes
- Longest run, end to end: 225 minutes
- Largest inline input: 1 MB
- Largest input file: 2 GB
- Largest output: 5 GB

## Input

| Field | Kind | Allowed | Default | Description |
| --- | --- | --- | --- | --- |
| `query` (required) | text |  | — | A name or synonym ("Ozempic", "aspirin", "152459-95-5"), SMILES ("CC(=O)OC1=CC=CC=C1C(=O)O"), InChI, InChIKey, molecular formula in Hill order ("C9H8O4") or CID. |
| `kind` | one of | auto, cid, name, smiles, inchikey, inchi, formula | auto | How to read query; auto guesses from its shape (a formula is Hill order with counts, "CO" reads as a formula, so set smiles for methanol written that way). |
| `limit` | number | 1 to 50 | 10 | Compounds per page. |
| `offset` | number | 0 to 100000 | 0 | Compounds to skip, from next_offset. |

## Example

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "alexandria",
    "model": "pubchem-ncbi-nlm-nih-gov/compounds/search",
    "input": {
      "query": "<query>"
    }
  }'
```

Try it in the Playground: https://spiral.ai/start?provider=alexandria&model=pubchem-ncbi-nlm-nih-gov%2Fcompounds%2Fsearch

## Common questions

### PubChem: chemical compounds, bioassays, targets and patents · Search

**How much does PubChem: chemical compounds, bioassays, targets and patents · Search cost?**

$0.00873 per call. You pay as you go from one Spiral balance, with no subscription, and a failed run is not charged.

**How do I use PubChem: chemical compounds, bioassays, targets and patents · Search through an API?**

Send `POST /v1/runs` with `"provider": "alexandria"`, `"model": "pubchem-ncbi-nlm-nih-gov/compounds/search"` and the input fields on this page, using one Spiral API key. It runs in the background: poll the run, or name a webhook to be told when it finishes.

**Do I need an account with Alexandria to use PubChem: chemical compounds, bioassays, targets and patents · Search?**

No. Spiral runs it on its own Alexandria account and charges your Spiral balance.

**Can my AI agent use PubChem: chemical compounds, bioassays, targets and patents · Search?**

Yes. Agents find and run it through Spiral's MCP server, CLI or agent skill, with the same API key.

