# Chemistry API
> Chemical compound data as an API, powered by NIH PubChem (>100 million compounds). Look up any compound by common name, PubChem CID or SMILES and get its molecular formula, molecular and exact mass, IUPAC name, canonical SMILES, InChI and InChIKey, plus physicochemical properties (XLogP, TPSA, formal charge, hydrogen-bond donor/acceptor counts, rotatable bonds, heavy-atom count). List a compound's synonyms and trade/registry names, or resolve a name to PubChem CIDs. Ideal for cheminformatics, lab software, education, drug-discovery tooling and scientific data pipelines.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/chemistry-api/..."
```

## Pricing
- **Free** (Free) — 3,500 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 50,000 calls/Mo, 8 req/s
- **Pro** ($16/Mo) — 250,000 calls/Mo, 20 req/s
- **Mega** ($42/Mo) — 1,250,000 calls/Mo, 50 req/s

## Endpoints

### Chemistry

#### `GET /v1/compound` — Full compound record by name / cid / smiles

**Parameters:**
- `name` (query, required, string) — Compound name, e.g. aspirin (or use cid / smiles) Example: `aspirin`
- `cid` (query, optional, string) — PubChem CID, e.g. 2244
- `smiles` (query, optional, string) — SMILES string, e.g. CCO

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/chemistry-api/v1/compound?name=aspirin"
```

**Response:**
```json
{
    "data": {
        "cid": 2244,
        "input": {
            "name": "aspirin"
        },
        "title": "Aspirin",
        "properties": {
            "tpsa": 63.6,
            "inchi": "InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)",
            "xlogp": 1.2,
            "charge": 0,
            "smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
            "inchikey": "BSYNRYMUTXBXSQ-UHFFFAOYSA-N",
            "exact_mass": 180.04225873,
            "iupac_name": "2-acetyloxybenzoic acid",
            "heavy_atom_count": 13,
            "molecular_weight": 180.16,
            "molecular_formula": "C9H8O4",
            "monoisotopic_mass": 180.04225873,
            "h_bond_donor_count": 1,
            "connectivity_smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
            "rotatable_bond_count": 3,
            "h_bond_acceptor_count": 4
        },
        "description": "Aspirin can cause developmental toxicity and female reproductive toxicity according to an independent committee of scientific and health experts.",
        "pubchem_url": "https://pubchem.ncbi.nlm.nih.gov/compound/2244"
    },
    "meta": {
        "timestamp": "2026-05-31T07:34:15.576Z",
        "request_id": "1c3f85d2-1cb3-44c3-b1da-a2d82bd668a9"
    },
    "status": "ok",
    "message": "Compound retrieved",
    "success": true
}
```

#### `GET /v1/search` — Resolve a name to PubChem CIDs

**Parameters:**
- `q` (query, required, string) — Compound name to resolve Example: `caffeine`
- `limit` (query, optional, string) — Max CIDs (1-100, default 25) Example: `25`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/chemistry-api/v1/search?q=caffeine&limit=25"
```

**Response:**
```json
{
    "data": {
        "cids": [
            2519
        ],
        "count": 1,
        "query": "caffeine",
        "total": 1
    },
    "meta": {
        "timestamp": "2026-05-31T07:34:15.765Z",
        "request_id": "4bf483e0-7ea2-4ff6-a94a-5d1aa1ba6589"
    },
    "status": "ok",
    "message": "Compounds searched",
    "success": true
}
```

#### `GET /v1/synonyms` — Names & synonyms for a compound

**Parameters:**
- `name` (query, required, string) — Compound name (or cid / smiles) Example: `aspirin`
- `limit` (query, optional, string) — Max synonyms (1-1000, default 50) Example: `50`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/chemistry-api/v1/synonyms?name=aspirin&limit=50"
```

**Response:**
```json
{
    "data": {
        "cid": 2244,
        "count": 50,
        "input": {
            "name": "aspirin"
        },
        "total": 697,
        "synonyms": [
            "aspirin",
            "ACETYLSALICYLIC ACID",
            "50-78-2",
            "2-Acetoxybenzoic acid",
            "2-(Acetyloxy)benzoic acid",
            "Acylpyrin",
            "O-Acetylsalicylic acid",
            "o-Acetoxybenzoic acid",
            "Acenterine",
            "Acetophen",
            "Ecotrin",
            "Salicylic acid acetate",
            "Aceticyl",
            "Acetosalin",
            "Polopiryna",
            "Aspirdrops",
            "Pharmacin",
            "Premaspin",
            "Salcetogen",
            "Acetonyl",
            "Benaspir",
            "Empirin",
            "Endydol",
            "Measurin",
            "Rhodine",
            "Saletin",
            "Temperal",
            "Adiro",
            "Ecolen",
            "Acetosalic acid",
            "Rheumintabletten",
            "Solprin acid",
            "o-Carboxyphenyl acetate",
            "Acidum acetylsalicylicum",
            "2-acetyloxybenzoic acid",
            "Enterosarine",
            "Acetisal",
            "Acetylsal",
            "Aspirine",
            "Bialpirina",
            "Bialpirinia",
            "Entericin",
            "Enterophen",
            "Globentyl",
            "Salacetin",
            "Solpyron",
            "Acesal",
            "Acisal",
            "Asagran",
  
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Source & property list

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/chemistry-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "Live chemical-compound data from PubChem (>100M compounds). Resolve any compound by common name, PubChem CID or SMILES; get molecular properties, synonyms and the canonical PubChem record link.",
        "source": "NIH PubChem (PUG REST)",
        "endpoints": [
            "/v1/compound",
            "/v1/synonyms",
            "/v1/search",
            "/v1/meta"
        ],
        "lookup_by": [
            "name",
            "cid",
            "smiles"
        ],
        "properties": [
            "molecular_formula",
            "molecular_weight",
            "iupac_name",
            "smiles",
            "connectivity_smiles",
            "inchi",
            "inchikey",
            "xlogp",
            "exact_mass",
            "monoisotopic_mass",
            "tpsa",
            "charge",
            "h_bond_donor_count",
            "h_bond_acceptor_count",
            "rotatable_bond_count",
            "heavy_atom_count"
        ]
    },
    "meta": {
        "timestamp": "2026-05-31T07:34:16.299Z",
        "request_id": "8cf4de88-53a7-44f3-af94-b54135949537"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/chemistry-api
OpenAPI spec: https://www.oanor.com/api/chemistry-api/openapi.json
