# PubChem

> Look up any chemical from a workflow. PubChem is the world's largest open chemistry database, run by the US National Library of Medicine: around 120 million compounds, their properties, their names, the papers and patents that mention them, and 1.7 million biological experiments testing what they do. Turn a column of chemical names, brands or CAS numbers into formulas, weights, structures and drug likeness figures. Search a hundred million structures by what they contain rather than what they are called, or find the molecules that look like one you already have. Read what a compound has been tested against and what happened, or start from a gene and find the chemistry aimed at it. Download the structure as a file for modelling software, or as a clean drawing for a report. Every action takes whatever names a chemical, from a brand name to a SMILES string, and works out which it is. No account or API key required.

App · Research & Academia · 10 actions. Web page: https://docs.lodol.com/docs/integrations/pubchem

## Actions

### Download a structure file

Get the molecule itself as a file, ready to hand to something else. The structure file is what modelling, docking and drawing software reads, flat for a diagram or as a computed three dimensional shape for anything that cares about how the molecule sits. The image is a clean drawing of the structure, for dropping into a report, an email or a slide. Both come back as a real file a later step can attach or save.

**Inputs**

- Compound (`compound`, text, required): The compound to read. Give whatever you have: a name or a brand, a CAS number, a SMILES or InChI string, an InChI key, a molecular formula or a PubChem CID. Which one it is gets worked out from the value, and the answer says which reading it used.
- Search by (`search_by`, text): How to read the value. Leave this on working it out unless the value could be read two ways: 'CCO' is a real compound name as well as the structure of ethanol, and PubChem's name index wins by default. Choosing here settles it. One of: `auto` (Work it out from the value), `name` (Name, brand or CAS number), `cid` (PubChem CID), `smiles` (SMILES structure), `inchi` (InChI string), `inchikey` (InChI key), `formula` (Molecular formula). Default: `auto`.
- File (`file_format`, text): What to download. The flat structure file exists for every compound. The three dimensional one is computed and PubChem leaves it out for very large, charged or incompletely defined molecules, which comes back saying so. One of: `sdf_2d` (Structure file (SDF, flat)), `sdf_3d` (Structure file (SDF, 3D shape)), `png` (Structure drawing (PNG image)). Default: `sdf_2d`.

**Outputs**

- `cid` (number): PubChem's number for it
- `content_type` (text): The file's type
- `document_ref` (text): The saved file, for a later step to use
- `documents` (list): Every file this step saved, which is one
- `download_url` (text): A link that serves the file
- `file_format` (text): Which file was fetched
- `file_format_label` (text): That file in words
- `filename` (text): What the file is called
- `matched_by` (text): Which reading of the value found the compound: name, cid, smiles, inchi, inchikey or formula
- `matched_by_label` (text): That reading in words, for showing to somebody
- `name` (text): What it is called
- `query` (text): What was asked for, as given
- `size_bytes` (number): How big it is
- `url` (text): The compound's page on PubChem

**Example output**

```json
{
  "cid": 2244,
  "content_type": "chemical/x-mdl-sdfile",
  "document_ref": "doc_4f1a2c8d9b7e6a5c3d2b1a09",
  "documents": [
    {
      "content_type": "chemical/x-mdl-sdfile",
      "document_ref": "doc_4f1a2c8d9b7e6a5c3d2b1a09",
      "filename": "aspirin-cid-2244.sdf",
      "size_bytes": 3706,
      "url": "/actions/core/serve-document/doc_4f1a2c8d9b7e6a5c3d2b1a09?teamId=64b0000000000000000000aa"
    }
  ],
  "download_url": "/actions/core/serve-document/doc_4f1a2c8d9b7e6a5c3d2b1a09?teamId=64b0000000000000000000aa",
  "file_format": "sdf_2d",
  "file_format_label": "Structure file (SDF, flat)",
  "filename": "aspirin-cid-2244.sdf",
  "matched_by": "name",
  "matched_by_label": "Name, brand or CAS number",
  "name": "Aspirin",
  "query": "aspirin",
  "size_bytes": 3706,
  "url": "https://pubchem.ncbi.nlm.nih.gov/compound/2244"
}
```

### Find a compound

Turn whatever names a chemical into the chemical itself. Give a name, a brand, a CAS number, a structure drawn as SMILES or InChI, an InChI key, a molecular formula or a PubChem CID, and get back the formula, the weight, the structure as text, the properties that decide how a molecule behaves, and a plain language description of what it actually is. This is the step to put first: everything else here takes the same kinds of value, so once a spreadsheet column or a form answer has been run through this, the rest of the workflow knows exactly which molecule it is dealing with.

**Inputs**

- Compound (`compound`, text, required): The compound to read. Give whatever you have: a name or a brand, a CAS number, a SMILES or InChI string, an InChI key, a molecular formula or a PubChem CID. Which one it is gets worked out from the value, and the answer says which reading it used.
- Search by (`search_by`, text): How to read the value. Leave this on working it out unless the value could be read two ways: 'CCO' is a real compound name as well as the structure of ethanol, and PubChem's name index wins by default. Choosing here settles it. One of: `auto` (Work it out from the value), `name` (Name, brand or CAS number), `cid` (PubChem CID), `smiles` (SMILES structure), `inchi` (InChI string), `inchikey` (InChI key), `formula` (Molecular formula). Default: `auto`.
- How many matches (`limit`, number): A name can match more than one compound: 'glucose' matches the two mirror images and the form with no mirror image specified. Raise this to see them all rather than only the closest. From 1 to 25. Default: `1`.

**Outputs**

- `compound` (object): The closest match, repeated here so a later step can read it without picking an item out of a list
- `compounds` (list)
- `count` (number): How many compounds matched
- `matched_by` (text): Which reading of the value found the compound: name, cid, smiles, inchi, inchikey or formula
- `matched_by_label` (text): That reading in words, for showing to somebody
- `query` (text): What was asked for, as given

**Example output**

```json
{
  "compound": {
    "cid": 2244,
    "hydrogen_bond_acceptors": 4,
    "hydrogen_bond_donors": 1,
    "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/PNG",
    "inchikey": "BSYNRYMUTXBXSQ-UHFFFAOYSA-N",
    "iupac_name": "2-acetyloxybenzoic acid",
    "molecular_formula": "C9H8O4",
    "molecular_weight": 180.16,
    "name": "Aspirin",
    "polar_surface_area": 63.6,
    "rotatable_bonds": 3,
    "smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
    "url": "https://pubchem.ncbi.nlm.nih.gov/compound/2244",
    "xlogp": 1.2
  },
  "compounds": [
    {
      "cid": 2244,
      "description": "Acetylsalicylic acid is a member of the class of benzoic acids that is salicylic acid in which the hydrogen attached to the phenolic hydroxy group has been replaced by an acetoxy group.",
      "description_source": "ChEBI",
      "description_url": "https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:15365",
      "hydrogen_bond_acceptors": 4,
      "hydrogen_bond_donors": 1,
      "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/PNG",
      "inchikey": "BSYNRYMUTXBXSQ-UHFFFAOYSA-N",
      "iupac_name": "2-acetyloxybenzoic acid",
      "molecular_formula": "C9H8O4",
      "molecular_weight": 180.16,
      "name": "Aspirin",
      "polar_surface_area": 63.6,
      "rotatable_bonds": 3,
      "smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
      "url": "https://pubchem.ncbi.nlm.nih.gov/compound/2244",
      "xlogp": 1.2
    }
  ],
  "count": 1,
  "matched_by": "name",
  "matched_by_label": "Name, brand or CAS number",
  "query": "aspirin"
}
```

### Find similar compounds

Find the molecules that look like one you already have. PubChem compares the structures themselves rather than their names, so this surfaces the analogue nobody thought to name similarly: a generic beside a brand, a metabolite beside its parent, a cheaper reagent beside an expensive one. Set how alike they have to be, from 50 for a loose family resemblance to 95 and above for near twins. The compound you asked about always comes back first and is flagged, so a workflow can drop it in one step.

**Inputs**

- Compound (`compound`, text, required): The compound to compare everything against. A name, a CAS number, a SMILES or InChI string, an InChI key or a PubChem CID all work.
- Search by (`search_by`, text): How to read the value. Leave this on working it out unless the value could be read two ways: 'CCO' is a real compound name as well as the structure of ethanol, and PubChem's name index wins by default. Choosing here settles it. One of: `auto` (Work it out from the value), `name` (Name, brand or CAS number), `cid` (PubChem CID), `smiles` (SMILES structure), `inchi` (InChI string), `inchikey` (InChI key), `formula` (Molecular formula). Default: `auto`.
- How alike (`similarity`, number): The lowest score a compound has to reach to be returned, out of 100. Ninety is the usual starting point and finds close relatives. Drop towards 70 to widen the net, and expect many more hits: each ten points down roughly multiplies the results. From 50 to 100. Default: `90`.
- How many to return (`limit`, number): How many similar compounds to return, best first. From 1 to 100. Default: `25`.

**Outputs**

- `cid` (number): The compound everything was compared against
- `compounds` (list)
- `count` (number): How many compounds came back
- `matched_by` (text): Which reading of the value found the compound: name, cid, smiles, inchi, inchikey or formula
- `matched_by_label` (text): That reading in words, for showing to somebody
- `query` (text): What was asked for, as given
- `similarity` (number): The threshold that was used

**Example output**

```json
{
  "cid": 2244,
  "compounds": [
    {
      "cid": 2244,
      "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/PNG",
      "inchikey": "BSYNRYMUTXBXSQ-UHFFFAOYSA-N",
      "is_query_compound": true,
      "molecular_formula": "C9H8O4",
      "molecular_weight": 180.16,
      "name": "Aspirin",
      "smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
      "url": "https://pubchem.ncbi.nlm.nih.gov/compound/2244"
    },
    {
      "cid": 5161,
      "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/5161/PNG",
      "inchikey": "WVYADZUPLLSGPU-UHFFFAOYSA-N",
      "is_query_compound": false,
      "molecular_formula": "C14H10O5",
      "molecular_weight": 258.23,
      "name": "Salsalate",
      "smiles": "C1=CC=C(C(=C1)C(=O)OC2=CC=CC=C2C(=O)O)O",
      "url": "https://pubchem.ncbi.nlm.nih.gov/compound/5161"
    }
  ],
  "count": 2,
  "matched_by": "name",
  "matched_by_label": "Name, brand or CAS number",
  "query": "aspirin",
  "similarity": 90
}
```

### Get a bioassay

Read one biological experiment in full: what it set out to measure, the protein or organism it was aimed at, how it was run, how many compounds went through it and how many came out active, and which those were. The description and protocol are the researchers' own words, so this is where a result stops being a number and becomes something you can judge. Assay numbers come from 'List a compound's test results' or from looking up a gene.

**Inputs**

- Assay number (`assay_id`, number, required): PubChem's number for the experiment, its AID. Earlier steps return these, and they are the number in a pubchem.ncbi.nlm.nih.gov/bioassay/ link. At least 1.
- Compounds to list (`compounds`, text): Which of the tested compounds to return alongside the experiment. The active ones are what a result is usually about. A large screen can hold hundreds of thousands, so choose none when only the description is wanted. One of: `active` (The ones that worked), `inactive` (The ones that did not), `all` (Everything tested), `none` (None, just the experiment). Default: `active`.
- How many compounds (`limit`, number): How many of those compounds to list. From 1 to 200. Default: `25`.

**Outputs**

- `assay_id` (number): The experiment's number
- `comment` (text): What the researchers noted about the results
- `compound_counts` (object): How many compounds were tested and how the verdicts broke down
- `compounds` (list)
- `count` (number): How many compounds came back
- `description` (text): What it set out to measure, in the researchers' words
- `last_updated` (text): When the data last changed, as YYYY-MM-DD
- `listed` (text): Which compounds were asked for
- `method` (text): Screening, confirmatory or summary. A confirmatory result carries far more weight than a screening one
- `name` (text): What it was called
- `protocol` (text): How it was run
- `source` (text): Which laboratory or database deposited it
- `source_id` (text): Their own reference for it
- `targets` (list): What it was aimed at
- `url` (text): The experiment's page on PubChem

**Example output**

```json
{
  "assay_id": 1000,
  "comment": "Percent inhibition was determined by comparing the reaction rates of the compounds to the full reaction.",
  "compound_counts": {
    "active": 36,
    "all": 57,
    "inactive": 21,
    "inconclusive": 0,
    "probe": 0,
    "unspecified": 0
  },
  "compounds": [
    {
      "cid": 16749973,
      "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/16749973/PNG",
      "inchikey": "PXQFHLQHXRPYSN-UHFFFAOYSA-N",
      "molecular_formula": "C19H18N2O3S",
      "molecular_weight": 354.4,
      "name": "CID 16749973",
      "smiles": "CC1=CC=C(C=C1)S(=O)(=O)N2CCN(CC2)C(=O)C3=CC=CO3",
      "url": "https://pubchem.ncbi.nlm.nih.gov/compound/16749973"
    }
  ],
  "count": 1,
  "description": "Streptococcus pneumoniae takes the lives of nearly 4,000 people daily and antibiotic resistant strains are becoming an increasing problem.",
  "last_updated": "2008-03-05",
  "listed": "active",
  "method": "confirmatory",
  "name": "Screening for Inhibitors of the Mevalonate Pathway in Streptococcus Pneumoniae",
  "protocol": "Mevalonate Kinase Protocol for 1 mL cuvet assay",
  "source": "SRMLSC",
  "source_id": "SPE-MK-Sec",
  "targets": [
    {
      "accession": "YP_815859",
      "gene_id": null,
      "gene_symbol": null,
      "name": "mevalonate kinase"
    }
  ],
  "url": "https://pubchem.ncbi.nlm.nih.gov/bioassay/1000"
}
```

### Get compound details

Build one table of chemistry across a whole list of compounds. Hand it the column out of a spreadsheet, a form or an earlier step, up to a hundred at a time, tick the facts you want, and get a row per compound with those columns filled in. Anything PubChem cannot place comes back in its own list rather than being quietly dropped, so a run over real data says exactly which rows need a human. This is the enrichment step: names in, formulas, weights, solubility and drug likeness out.

**Inputs**

- Compounds (`compounds`, list, required): The compounds to look up, up to a hundred. Each one can be a name, a brand, a CAS number, a SMILES or InChI string, an InChI key or a PubChem CID, and they can be mixed freely.
- Search by (`search_by`, text): How to read the value. Leave this on working it out unless the value could be read two ways: 'CCO' is a real compound name as well as the structure of ethanol, and PubChem's name index wins by default. Choosing here settles it. One of: `auto` (Work it out from the value), `name` (Name, brand or CAS number), `cid` (PubChem CID), `smiles` (SMILES structure), `inchi` (InChI string), `inchikey` (InChI key), `formula` (Molecular formula). Default: `auto`.
- Facts to include (`properties`, list): Which columns the table should carry. The default is the set that identifies a compound and sizes it up. Fat solubility, polar surface area, hydrogen bond donors and acceptors, and rotatable bonds are the numbers behind Lipinski's rule of five, which is the usual first read on whether a molecule could be a drug. One or more of: `name`, `iupac_name` (Systematic name), `molecular_formula` (Molecular formula), `molecular_weight` (Molecular weight), `exact_mass` (Exact mass), `monoisotopic_mass` (Monoisotopic mass), `smiles`, `connectivity_smiles` (SMILES without stereochemistry), `inchi`, `inchikey` (InChI key), and 20 more. Default: `["name", "molecular_formula", "molecular_weight", "smiles", "inchikey", "iupac_name", "xlogp", "polar_surface_area", "hydrogen_bond_donors", "hydrogen_bond_acceptors", "rotatable_bonds"]`.

**Outputs**

- `compounds` (list)
- `count` (number): How many compounds came back
- `not_found` (list): The values PubChem could not place
- `properties` (list): The columns the table carries
- `requested` (number): How many were asked for

**Example output**

```json
{
  "compounds": [
    {
      "cid": 2244,
      "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/PNG",
      "matched_by": "name",
      "molecular_formula": "C9H8O4",
      "molecular_weight": 180.16,
      "name": "Aspirin",
      "query": "aspirin",
      "url": "https://pubchem.ncbi.nlm.nih.gov/compound/2244",
      "xlogp": 1.2
    },
    {
      "cid": 3672,
      "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/3672/PNG",
      "matched_by": "name",
      "molecular_formula": "C13H18O2",
      "molecular_weight": 206.28,
      "name": "Ibuprofen, (+-)-",
      "query": "ibuprofen",
      "url": "https://pubchem.ncbi.nlm.nih.gov/compound/3672",
      "xlogp": 3.5
    }
  ],
  "count": 2,
  "not_found": [
    {
      "query": "widget cleaner",
      "reason": "PubChem has nothing matching 'widget cleaner'. Check the spelling, or set 'Search by' if it is a structure rather than a name."
    }
  ],
  "properties": [
    "name",
    "molecular_formula",
    "molecular_weight",
    "xlogp"
  ],
  "requested": 3
}
```

### List a compound's names

One chemical goes by hundreds of names: a trade name, a systematic name, a catalogue code, the spelling a supplier uses and the spelling a regulator uses. This lists them all for one compound, so two records that look unrelated can be matched up. CAS registry numbers are pulled out into their own list, because that is the number an order form or a safety sheet asks for and it is otherwise buried among the names.

**Inputs**

- Compound (`compound`, text, required): The compound to read. Give whatever you have: a name or a brand, a CAS number, a SMILES or InChI string, an InChI key, a molecular formula or a PubChem CID. Which one it is gets worked out from the value, and the answer says which reading it used.
- Search by (`search_by`, text): How to read the value. Leave this on working it out unless the value could be read two ways: 'CCO' is a real compound name as well as the structure of ethanol, and PubChem's name index wins by default. Choosing here settles it. One of: `auto` (Work it out from the value), `name` (Name, brand or CAS number), `cid` (PubChem CID), `smiles` (SMILES structure), `inchi` (InChI string), `inchikey` (InChI key), `formula` (Molecular formula). Default: `auto`.
- Only names containing (`contains`, text): Keep only the names with this text in them, ignoring capitals. Useful for pulling out a supplier's catalogue codes, or for checking whether a particular spelling is one PubChem knows.
- How many names (`limit`, number): How many names to return. They come back commonest first, so the default is usually plenty. From 1 to 500. Default: `50`.

**Outputs**

- `cas_numbers` (list): Every CAS registry number on the record. More than one is normal: a compound can be registered again as a hydrate or a different salt
- `cid` (number): PubChem's number for it
- `count` (number): How many names came back
- `matched_by` (text): Which reading of the value found the compound: name, cid, smiles, inchi, inchikey or formula
- `matched_by_label` (text): That reading in words, for showing to somebody
- `name` (text): The name it is most commonly filed under
- `names` (list): The names, commonest first
- `query` (text): What was asked for, as given
- `total` (number): How many it has in all
- `url` (text): The compound's page on PubChem

**Example output**

```json
{
  "cas_numbers": [
    "50-78-2",
    "98201-60-6",
    "11126-35-5"
  ],
  "cid": 2244,
  "count": 5,
  "matched_by": "name",
  "matched_by_label": "Name, brand or CAS number",
  "name": "aspirin",
  "names": [
    "aspirin",
    "ACETYLSALICYLIC ACID",
    "2-Acetoxybenzoic acid",
    "Acylpyrin",
    "Ecotrin"
  ],
  "query": "aspirin",
  "total": 695,
  "url": "https://pubchem.ncbi.nlm.nih.gov/compound/2244"
}
```

### List a compound's references

Find out who has written about a chemical and who holds it. Returns the papers that mention it, linked straight to PubMed; the patents that claim it, linked to Google Patents; the databases and suppliers that carry a record for it, with links back to those records; and the catalogue numbers they file it under. Use it to gauge how well studied something is before committing to it, to watch a competitor's patent activity, or to find where else to buy a reagent. Well studied compounds have six figures of patents, so the counts come back in full and the lists are trimmed.

**Inputs**

- Compound (`compound`, text, required): The compound to read. Give whatever you have: a name or a brand, a CAS number, a SMILES or InChI string, an InChI key, a molecular formula or a PubChem CID. Which one it is gets worked out from the value, and the answer says which reading it used.
- Search by (`search_by`, text): How to read the value. Leave this on working it out unless the value could be read two ways: 'CCO' is a real compound name as well as the structure of ethanol, and PubChem's name index wins by default. Choosing here settles it. One of: `auto` (Work it out from the value), `name` (Name, brand or CAS number), `cid` (PubChem CID), `smiles` (SMILES structure), `inchi` (InChI string), `inchikey` (InChI key), `formula` (Molecular formula). Default: `auto`.
- What to look for (`reference_types`, list): Which kinds of reference to fetch. Each one is real work for PubChem, so asking only for what is needed keeps the step quick: patents alone can move several megabytes for a common drug. One or more of: `papers`, `patents`, `sources` (Contributing databases), `source_links` (Links to the original records), `registry_ids` (Catalogue and registry numbers), `genes`, `organisms`, `structures` (Solved 3D structures). Default: `["papers", "patents", "sources"]`.
- How many of each (`limit`, number): How many of each kind to list. The full count is always returned whatever this is set to. From 1 to 500. Default: `25`.

**Outputs**

- `cid` (number): PubChem's number for it
- `matched_by` (text): Which reading of the value found the compound: name, cid, smiles, inchi, inchikey or formula
- `matched_by_label` (text): That reading in words, for showing to somebody
- `query` (text): What was asked for, as given
- `references` (object): One list per kind asked for. Papers, patents, genes, organisms and solved structures carry a link each; contributing databases and catalogue numbers are plain text
- `shown_per_type` (number): How many of each kind were listed
- `totals` (object): How many exist of each kind asked for, before trimming
- `url` (text): The compound's page on PubChem

**Example output**

```json
{
  "cid": 2519,
  "matched_by": "name",
  "matched_by_label": "Name, brand or CAS number",
  "query": "caffeine",
  "references": {
    "papers": [
      {
        "id": "10214707",
        "url": "https://pubmed.ncbi.nlm.nih.gov/10214707/"
      },
      {
        "id": "10337936",
        "url": "https://pubmed.ncbi.nlm.nih.gov/10337936/"
      }
    ],
    "patents": [
      {
        "id": "US-10238600-B2",
        "url": "https://patents.google.com/patent/US-10238600-B2"
      }
    ],
    "sources": [
      "KEGG",
      "DTP/NCI"
    ]
  },
  "shown_per_type": 2,
  "totals": {
    "papers": 11139,
    "patents": 79318,
    "sources": 590
  },
  "url": "https://pubchem.ncbi.nlm.nih.gov/compound/2519"
}
```

### List a compound's test results

Read what a chemical has actually been tested against and what each experiment concluded. PubChem holds over a million biological assays, and a widely studied compound appears in thousands of them: this returns a row per result with the experiment, the verdict, the protein it was tested against and the potency where one was measured, plus a tally of how the verdicts break down. Filter to the active results to see only where something worked, which is how to tell a molecule with a real biological story from one that has simply been screened a lot.

**Inputs**

- Compound (`compound`, text, required): The compound to read. Give whatever you have: a name or a brand, a CAS number, a SMILES or InChI string, an InChI key, a molecular formula or a PubChem CID. Which one it is gets worked out from the value, and the answer says which reading it used.
- Search by (`search_by`, text): How to read the value. Leave this on working it out unless the value could be read two ways: 'CCO' is a real compound name as well as the structure of ethanol, and PubChem's name index wins by default. Choosing here settles it. One of: `auto` (Work it out from the value), `name` (Name, brand or CAS number), `cid` (PubChem CID), `smiles` (SMILES structure), `inchi` (InChI string), `inchikey` (InChI key), `formula` (Molecular formula). Default: `auto`.
- Verdicts to keep (`outcomes`, list): Which results to return. All of them by default. Most results in a screening library are inactive, so narrowing to active is usually what makes the answer readable. The tally always covers every verdict, whatever is kept here. One or more of: `Active`, `Inactive`, `Inconclusive`, `Unspecified`, `Probe`. Default: `["Active", "Inactive", "Inconclusive", "Unspecified", "Probe"]`.
- How many results (`limit`, number): How many results to return. A heavily screened compound has thousands, and the tally above covers all of them whatever this is set to. From 1 to 500. Default: `50`.

**Outputs**

- `cid` (number): PubChem's number for it
- `count` (number): How many results came back
- `matched_by` (text): Which reading of the value found the compound: name, cid, smiles, inchi, inchikey or formula
- `matched_by_label` (text): That reading in words, for showing to somebody
- `matching` (number): How many matched the verdicts kept
- `outcome_counts` (object): How the verdicts break down across everything
- `query` (text): What was asked for, as given
- `results` (list)
- `tested_in_assays` (number): How many separate experiments it appears in
- `total` (number): How many results there are in all
- `url` (text): The compound's page on PubChem

**Example output**

```json
{
  "cid": 1983,
  "count": 2,
  "matched_by": "cid",
  "matched_by_label": "PubChem CID",
  "matching": 49,
  "outcome_counts": {
    "Active": 49,
    "Inactive": 3425,
    "Inconclusive": 351,
    "Probe": 0,
    "Unspecified": 1127
  },
  "query": "1983",
  "results": [
    {
      "assay_id": 1188,
      "assay_name": "DSSTox (EPAFHM) EPA Fathead Minnow Acute Toxicity",
      "assay_type": "Other",
      "cid": 1983,
      "outcome": "Active",
      "substance_id": 48415047,
      "url": "https://pubchem.ncbi.nlm.nih.gov/bioassay/1188"
    },
    {
      "assay_id": 1195,
      "assay_name": "DSSTox (FDAMDD) FDA Maximum Recommended Daily Dose Database",
      "assay_type": "Other",
      "cid": 1983,
      "outcome": "Active",
      "substance_id": 48415502,
      "url": "https://pubchem.ncbi.nlm.nih.gov/bioassay/1195"
    }
  ],
  "tested_in_assays": 2861,
  "total": 4952,
  "url": "https://pubchem.ncbi.nlm.nih.gov/compound/1983"
}
```

### Look up a gene, protein, pathway or organism

Work the other way round: start from the biology and find the chemistry aimed at it. Name a gene, a protein, a biological pathway or an organism and get what it is, what else it is called, which species it belongs to, and every experiment PubChem holds that was aimed at it. Those experiment numbers feed straight into 'Get a bioassay', which is how to go from 'we are interested in this gene' to the compounds that have actually been tested against it.

**Inputs**

- Kind (`target_type`, text, required): What sort of thing is being looked up. PubChem files each one separately and there is no free text search across them, so this has to match what the value below actually is. One of: `gene`, `protein`, `pathway`, `organism`. Default: `gene`.
- Name or identifier (`target`, text, required): A gene by its symbol or its NCBI number, a protein by its accession, a pathway by its full accession including the source, or an organism by its name or its taxonomy number.
- Include the experiments (`include_assays`, true/false): Whether to list the experiments aimed at it. A well studied gene has thousands, so turn this off when only the identity is wanted. Pathways never carry experiments and always come back without them. Default: `true`.
- How many experiments (`limit`, number): How many experiment numbers to list. From 1 to 500. Default: `25`.

**Outputs**

- `assay_count` (number): How many experiments were aimed at it
- `assays` (list)
- `assays_listed` (true/false): Whether the experiments were looked up. False means the count below says nothing either way
- `category` (text): How the source classifies the pathway
- `common_name` (text): An organism's everyday name
- `description` (text): What it is and what it does
- `full_name` (text): Its full name
- `id` (text): PubChem's identifier for it: a number for a gene or an organism, an accession for a protein or a pathway
- `lineage` (object): An organism's classification, genus upwards
- `matched_by` (text): Which index answered
- `name` (text): Its short name
- `organism` (text): Which species a gene or protein belongs to
- `organism_id` (number): That species' taxonomy number
- `query` (text): What was asked for
- `rank` (text): Where an organism sits, e.g. species
- `source` (text): Which database a pathway came from
- `source_url` (text): That database's page for the pathway
- `synonyms` (list): What else it is called
- `target_type` (text): What kind of thing was looked up
- `target_type_label` (text): That kind in words

**Example output**

```json
{
  "assay_count": 5194,
  "assays": [
    {
      "assay_id": 1433,
      "url": "https://pubchem.ncbi.nlm.nih.gov/bioassay/1433"
    },
    {
      "assay_id": 1622,
      "url": "https://pubchem.ncbi.nlm.nih.gov/bioassay/1622"
    }
  ],
  "assays_listed": true,
  "description": "The protein encoded by this gene is a transmembrane glycoprotein that is a member of the protein kinase superfamily.",
  "full_name": "epidermal growth factor receptor",
  "id": 1956,
  "matched_by": "genesymbol",
  "name": "EGFR",
  "organism": "Homo sapiens (human)",
  "organism_id": 9606,
  "query": "EGFR",
  "synonyms": [
    "ERBB",
    "ERBB1",
    "HER1"
  ],
  "target_type": "gene",
  "target_type_label": "Gene"
}
```

### Search by structure

Search a hundred million compounds by shape rather than by name. Draw a fragment and ask what contains it, to find every molecule built around a particular ring or group. Or name a whole molecule and ask what it is part of, to find the salts, esters and mixtures it turns up in. Or ask for the exact structure, which is how to check whether something has already been catalogued. Or ask for everything sharing a molecular formula, which is how to find the isomers that weigh the same and behave differently.

**Inputs**

- Structure (`structure`, text, required): What to search for. A SMILES string for a structure or a fragment, a SMARTS pattern for a looser one, an InChI string, a PubChem CID, or a molecular formula when the match below is set to the formula.
- Match (`match`, text): How to compare. Containing the fragment is the usual one and finds every molecule built around it. Being part of the structure is the reverse, and finds the salts and mixtures a molecule appears in. Exactly this structure is the check for whether something is already catalogued, and the formula finds the isomers. One of: `contains` (Contains this fragment), `contained_in` (Is part of this structure), `identical` (Is exactly this structure), `same_formula` (Has this molecular formula). Default: `contains`.
- Read the structure as (`structure_type`, text): How to read the value above. Leave this on working it out unless you mean a SMARTS pattern, which looks like SMILES and cannot be told apart from it. Ignored when matching on the molecular formula. One of: `auto` (Work it out from the value), `smiles` (SMILES structure), `smarts` (SMARTS pattern), `inchi` (InChI string), `cid` (PubChem CID). Default: `auto`.
- How many to return (`limit`, number): How many compounds to return. A common fragment matches millions, so this is what keeps the answer usable. From 1 to 200. Default: `25`.

**Outputs**

- `compounds` (list)
- `count` (number): How many compounds came back
- `match` (text): How it was compared
- `match_label` (text): That comparison in words
- `query` (text): What was searched for
- `reached_limit` (true/false): True when the answer was cut off at the limit, so there are more to be had
- `read_as` (text): How the value was read

**Example output**

```json
{
  "compounds": [
    {
      "cid": 5564,
      "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/5564/PNG",
      "inchikey": "XEFQLINVKFYRCS-UHFFFAOYSA-N",
      "molecular_formula": "C12H7Cl3O2",
      "molecular_weight": 289.5,
      "name": "Triclosan",
      "smiles": "C1=CC(=C(C=C1Cl)O)OC2=C(C=C(C=C2)Cl)Cl",
      "url": "https://pubchem.ncbi.nlm.nih.gov/compound/5564"
    },
    {
      "cid": 6643,
      "image_url": "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/6643/PNG",
      "inchikey": "NRZWYNLTFLDQQX-UHFFFAOYSA-N",
      "molecular_formula": "C11H16O",
      "molecular_weight": 164.24,
      "name": "4-tert-Pentylphenol",
      "smiles": "CCC(C)(C)C1=CC=C(C=C1)O",
      "url": "https://pubchem.ncbi.nlm.nih.gov/compound/6643"
    }
  ],
  "count": 2,
  "match": "contains",
  "match_label": "Contains this fragment",
  "query": "c1ccccc1O",
  "reached_limit": true,
  "read_as": "smiles"
}
```
