> ## Documentation Index
> Fetch the complete documentation index at: https://proto.evodesign.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PubChem

> [PubChem](https://pubchem.ncbi.nlm.nih.gov/) is a public repository of chemical structures, their computed properties, and bioactivity data, maintained by the [National Center for Biotechnology Information (NCBI)](https://www.ncbi.nlm.nih.gov/). The `pubchem-fetch` tool resolves a single small-molecule identifier (CID, name, SMILES, InChI, or InChIKey) against the PubChem PUG REST API and returns the canonical structure descriptors, computed physicochemical properties, and optionally synonyms, textual descriptions, and BioAssay identifiers. It runs on CPU and requires only network access.

<div class="page-hero"><img class="page-hero-banner" src="https://proto-bio.github.io/proto-assets/images/tool/pubchem/hero.png" alt="PubChem" /><div class="tool-org-badges page-hero-badges"><a href="/docs/tools/organizations/ncbi" class="tool-org-badge tool-org-badge-light" style={{background: "#c0c0c0"}} title="NCBI"><img src="https://mintcdn.com/bio-pro/_UGa2jUMKeVPCbLk/assets/images/cached/6c0bd51170aa.png?fit=max&auto=format&n=_UGa2jUMKeVPCbLk&q=85&s=aece837308f5961d47623da652f395a2" alt="" class="tool-org-badge-logo" width="200" height="200" data-path="assets/images/cached/6c0bd51170aa.png" /> NCBI</a></div></div>

<Note>
  **License:** PubChem retrieves data from the PubChem database, in the public domain (U.S. Government public domain). The client wrapper code is MIT-licensed. Please refer to [the data terms](https://www.ncbi.nlm.nih.gov/home/about/policies/) for full terms.
</Note>

<p class="entity-disclaimer">Proto is not affiliated with NCBI. This toolkit is open source and builds on the implementation produced by this organization. Product names, logos, and trademarks are the property of their respective owners.</p>

<hr class="entity-rule" />

<input type="radio" name="tab-pubchem" id="none-pubchem" class="tab-radio-input" />

<input type="radio" name="tab-pubchem" id="website-pubchem" class="tab-radio-input" defaultChecked />

<input type="radio" name="tab-pubchem" id="paper-pubchem" class="tab-radio-input" />

<input type="radio" name="tab-pubchem" id="cite-pubchem" class="tab-radio-input" />

<input type="radio" name="tab-pubchem" id="source-pubchem" class="tab-radio-input" />

<input type="radio" name="tab-pubchem" id="notebook-pubchem" class="tab-radio-input" />

<input type="radio" name="tab-pubchem" id="proto-pubchem" class="tab-radio-input" />

<div class="tool-tab-bar">
  <span class="tool-tab-wrap"><label for="website-pubchem" class="tool-tab tab-open badge-website"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10" /><path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" /></svg> Website</label><label for="none-pubchem" class="tool-tab tab-close badge-website"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10" /><path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" /></svg> Website</label></span> <span class="tool-tab-wrap"><label for="paper-pubchem" class="tool-tab tab-open badge-paper"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><polyline points="14 2 14 8 20 8" /><line x1="16" y1="13" x2="8" y2="13" /><line x1="16" y1="17" x2="8" y2="17" /><polyline points="10 9 9 9 8 9" /></svg> Publication</label><label for="none-pubchem" class="tool-tab tab-close badge-paper"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><polyline points="14 2 14 8 20 8" /><line x1="16" y1="13" x2="8" y2="13" /><line x1="16" y1="17" x2="8" y2="17" /><polyline points="10 9 9 9 8 9" /></svg> Publication</label></span> <span class="tool-tab-wrap"><label for="cite-pubchem" class="tool-tab tab-open badge-cite"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" /><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" /></svg> Cite</label><label for="none-pubchem" class="tool-tab tab-close badge-cite"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" /><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" /></svg> Cite</label></span> <span class="tool-tab-wrap"><label for="source-pubchem" class="tool-tab tab-open badge-source"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Tool Source</label><label for="none-pubchem" class="tool-tab tab-close badge-source"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Tool Source</label></span> <span class="tool-tab-wrap"><label for="notebook-pubchem" class="tool-tab tab-open badge-notebook"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" /><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" /></svg> Open as Notebook</label><label for="none-pubchem" class="tool-tab tab-close badge-notebook"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" /><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" /></svg> Open as Notebook</label></span> <span class="tool-tab-wrap"><label for="proto-pubchem" class="tool-tab tab-open badge-proto"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" /></svg> Open on Proto</label><label for="none-pubchem" class="tool-tab tab-close badge-proto"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" /></svg> Open on Proto</label></span>
</div>

<a href="https://pubchem.ncbi.nlm.nih.gov/" target="_blank" class="tab-panel website-panel" data-tab="website-pubchem">
  <div class="website-info">
    <img src="https://www.google.com/s2/favicons?domain=pubchem.ncbi.nlm.nih.gov&sz=32" class="website-favicon" width="24" height="24" />

    <span class="website-url">pubchem.ncbi.nlm.nih.gov</span>
  </div>

  <span class="panel-goto-btn website-goto-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10" /><path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" /></svg> Visit website</span></span>
</a>

<a href="https://doi.org/10.1093/nar/gkac956" target="_blank" class="tab-panel paper-panel" data-tab="paper-pubchem">
  <div class="paper-info">
    <div class="paper-title">PubChem 2023 update</div>
    <div class="paper-meta">Sunghwan Kim, Jie Chen, ... Evan E. Bolton</div>
    <div class="paper-meta paper-venue">Nucleic Acids Research (2023)</div>
  </div>

  <span class="panel-goto-btn pub-goto-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><polyline points="14 2 14 8 20 8" /><line x1="16" y1="13" x2="8" y2="13" /><line x1="16" y1="17" x2="8" y2="17" /><polyline points="10 9 9 9 8 9" /></svg> Read paper</span></span>
</a>

<div class="tab-panel cite-panel" data-tab="cite-pubchem">
  <div class="cite-code-wrap">
    ```bibtex theme={null}
    @article{kim2023pubchem,
      title={{PubChem} 2023 update},
      author={Kim, Sunghwan and Chen, Jie and Cheng, Tiejun and Gindulyte, Asta and He, Jia and He, Siqian and Li, Qingliang and Shoemaker, Benjamin A. and Thiessen, Paul A. and Yu, Bo and Zaslavsky, Leonid and Zhang, Jian and Bolton, Evan E.},
      journal={Nucleic Acids Research},
      volume={51},
      number={D1},
      pages={D1373--D1380},
      year={2023},
      publisher={Oxford University Press},
      doi={10.1093/nar/gkac956}
    }
    ```
  </div>

  <span class="panel-goto-btn cite-copy-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" /><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" /></svg> Copy citation</span></span>
</div>

<a href="https://github.com/evo-design/proto-tools/tree/47e34afa5ea240a3b406e323dc38aa5dc85f223e/proto_tools/tools/database_retrieval/pubchem" target="_blank" class="tab-panel source-panel" data-tab="source-pubchem">
  <div class="source-info">
    <img src="https://github.com/evo-design.png?size=40" class="source-avatar" width="36" height="36" />

    <span class="source-path">evo-design/proto-tools<span class="source-subpath">/proto\_tools/tools/database\_retrieval/pubchem</span></span>
  </div>

  <span class="panel-goto-btn source-goto-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" /></svg> View source</span></span>
</a>

<a href="https://github.com/evo-design/proto-tools/blob/47e34afa5ea240a3b406e323dc38aa5dc85f223e/proto_tools/tools/database_retrieval/pubchem/examples/example.ipynb" target="_blank" class="tab-panel notebook-panel" data-tab="notebook-pubchem">
  <div class="notebook-info">
    <span class="notebook-icon">
      <svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
        <path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" />

        <path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" />
      </svg>
    </span>

    <span class="notebook-label">Open Notebook</span>
  </div>

  <span class="panel-goto-btn notebook-goto-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" /><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" /></svg> Open notebook</span></span>
</a>

<div class="tab-panel proto-panel" data-tab="proto-pubchem">
  <div class="proto-info">
    <div class="proto-cloud">
      <svg class="proto-cloud-bg" viewBox="0 0 640 512" xmlns="http://www.w3.org/2000/svg">
        <path d="M0 336c0 79.5 64.5 144 144 144H512c70.7 0 128-57.3 128-128c0-61.9-44-113.6-102.4-125.4c4.1-10.7 6.4-22.4 6.4-34.6c0-53-43-96-96-96c-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32C167.6 32 96 103.6 96 192c0 2.7 .1 5.4 .2 8.1C40.2 219.8 0 273.2 0 336z" />
      </svg>

      <img noZoom src="https://mintcdn.com/bio-pro/KVh0EKV-IKblvXR8/assets/logo/evo-logo-light.svg?fit=max&auto=format&n=KVh0EKV-IKblvXR8&q=85&s=0cb66034ba45618505501aee6ea5f5c1" class="proto-panel-logo block dark:hidden" alt="Proto" width="198" height="151" data-path="assets/logo/evo-logo-light.svg" />

      <img noZoom src="https://mintcdn.com/bio-pro/KVh0EKV-IKblvXR8/assets/logo/evo-logo-dark.svg?fit=max&auto=format&n=KVh0EKV-IKblvXR8&q=85&s=2c9e23a14635e60384a434e220788f54" class="proto-panel-logo hidden dark:block" alt="Proto" width="198" height="151" data-path="assets/logo/evo-logo-dark.svg" />
    </div>
  </div>

  <div class="proto-actions">
    <a href="https://proto.evodesign.org/tools/pubchem-fetch" target="_blank" class="proto-action-btn"><span>PubChem Fetch</span><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="7" y1="17" x2="17" y2="7" /><polyline points="7 7 17 7 17 17" /></svg></a>
  </div>
</div>

<div class="entity-contributors"><span class="entity-contributors-label">Toolkit contributors</span><span class="entity-contributors-people"><a class="entity-contributor" href="https://github.com/bviggiano" target="_blank" rel="noopener" title="bviggiano: 10 commits"><img noZoom class="entity-contributor-avatar" src="https://avatars.githubusercontent.com/u/21143637?v=4&s=64" alt="" loading="lazy" /><span class="entity-contributor-login">bviggiano</span></a><a class="entity-contributor" href="https://github.com/dguo8412" target="_blank" rel="noopener" title="dguo8412: 6 commits"><img noZoom class="entity-contributor-avatar" src="https://avatars.githubusercontent.com/u/46211285?v=4&s=64" alt="" loading="lazy" /><span class="entity-contributor-login">dguo8412</span></a><a class="entity-contributor" href="https://github.com/leba01" target="_blank" rel="noopener" title="leba01: 1 commit"><img noZoom class="entity-contributor-avatar" src="https://avatars.githubusercontent.com/u/124846286?v=4&s=64" alt="" loading="lazy" /><span class="entity-contributor-login">leba01</span></a></span></div>

| Function              | Description                                                                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| --------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `run_pubchem_fetch()` | Resolve small-molecule identifiers (CID, name, SMILES, InChIKey) against PubChem PUG REST and ret... | <a href="#api-run-pubchem-fetch" class="func-table-btn func-api-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" /></svg> Docs</a> <a href="https://github.com/evo-design/proto-tools/blob/47e34afa5ea240a3b406e323dc38aa5dc85f223e/proto_tools/tools/database_retrieval/pubchem/pubchem_fetch.py#L329" target="_blank" class="func-table-btn func-source-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a> |

## Background

[PubChem](https://pubchem.ncbi.nlm.nih.gov/) ([Kim et al., 2023](https://doi.org/10.1093/nar/gkac956)) is a freely accessible chemistry resource hosted by [NCBI](https://www.ncbi.nlm.nih.gov/). It aggregates compound records with well-defined chemical structures, depositor-supplied substance records, and bioassay results contributed by hundreds of data sources. Each unique compound is assigned a stable Compound Identifier (CID), and standardized structure representations and computed descriptors are derived from a uniform processing pipeline.

Internally, the tool calls the [PUG REST](https://pubchem.ncbi.nlm.nih.gov/docs/pug-rest) endpoint at `https://pubchem.ncbi.nlm.nih.gov/rest/pug`. It first resolves the supplied identifier to one or more CIDs. A name, SMILES, or InChIKey is sent as a URL-encoded GET against the matching `/compound/{domain}/{value}/cids/JSON` endpoint, an InChI is submitted via POST, and a CID skips resolution entirely. It then fetches the configured property bundle from `/compound/cid/{cid}/property/{properties}/JSON`, and optionally retrieves synonyms, descriptions, and BioAssay identifiers through additional endpoints. Results reflect the live database at query time rather than a fixed release snapshot.

### Learning Resources

* [PUG REST documentation](https://pubchem.ncbi.nlm.nih.gov/docs/pug-rest) (PubChem) - official reference for the request grammar, compound domains, property names, and response formats.
* [Programmatic access](https://pubchem.ncbi.nlm.nih.gov/docs/programmatic-access) (PubChem) - overview of the programmatic interfaces and the published usage policies and rate limits.

## Tools

<a name="api-run-pubchem-fetch" />

<div class="tool-section-card tool-section-card--fetch">
  ### PubChem Fetch (`pubchem-fetch`)

  Resolves a single small-molecule identifier to a PubChem CID and returns the requested property bundle, the full list of matched CIDs, and optionally synonyms, textual descriptions, BioAssay identifiers, the source URL, and the raw property record.

  #### API Reference

  <div class="api-model-section api-input-section">
    <a href="https://github.com/evo-design/proto-tools/blob/47e34afa5ea240a3b406e323dc38aa5dc85f223e/proto_tools/tools/database_retrieval/pubchem/pubchem_fetch.py#L111" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Input: PubChemFetchInput">
      <ParamField path="cid" type="integer">
        PubChem Compound Identifier (e.g. 2244 for aspirin).
      </ParamField>

      <ParamField path="name" type="string">
        Common or systematic name (e.g. 'aspirin').
      </ParamField>

      <ParamField path="smiles" type="string">
        SMILES string (e.g. 'CC(=O)Oc1ccccc1C(=O)O').
      </ParamField>

      <ParamField path="inchi" type="string">
        Standard InChI string (e.g. 'InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/...').
      </ParamField>

      <ParamField path="inchikey" type="string">
        Standard InChIKey (e.g. 'BSYNRYMUTXBXSQ-UHFFFAOYSA-N').
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-config-section">
    <a href="https://github.com/evo-design/proto-tools/blob/47e34afa5ea240a3b406e323dc38aa5dc85f223e/proto_tools/tools/database_retrieval/pubchem/pubchem_fetch.py#L140" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Config: PubChemFetchConfig">
      <ParamField path="properties" type="List[string]">
        PubChem property names to request. Defaults to a 16-property bundle covering the common name (Title), structure (SMILES, InChI), mass, and basic descriptor counts (TPSA, HBA, HBD, etc.).
      </ParamField>

      <ParamField path="include_synonyms" type="boolean" default="False">
        If True, also fetch the compound's synonyms (one extra HTTP call). Returns up to 50 synonyms.
      </ParamField>

      <ParamField path="include_description" type="boolean" default="False">
        If True, also fetch the compound's textual descriptions (one extra HTTP call to `/description/JSON`).
      </ParamField>

      <ParamField path="include_aids" type="boolean" default="False">
        If True, also fetch the list of BioAssay IDs that tested this compound (one extra HTTP call to `/aids/JSON`). For common compounds this can return thousands of assay IDs.
      </ParamField>

      <ParamField path="verbose" type="integer" default="0">
        Verbosity level (0=quiet, 1=info, 2=debug, 3=raw subprocess stderr). `True` is coerced to `1` and `False` to `0`.
      </ParamField>

      <ParamField path="device" type="string" default="cpu">
        Device to run the tool on.
      </ParamField>

      <ParamField path="timeout" type="integer" default="3600">
        Maximum execution time in seconds. `None` waits indefinitely.
      </ParamField>

      <ParamField path="seed" type="integer">
        Random seed. When set, tools run reproducibly up to small GPU float noise (see `BaseToolOutput.approx_equal`), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-output-section">
    <a href="https://github.com/evo-design/proto-tools/blob/47e34afa5ea240a3b406e323dc38aa5dc85f223e/proto_tools/tools/database_retrieval/pubchem/pubchem_fetch.py#L179" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Output: PubChemFetchOutput">
      <ResponseField name="cid" type="integer" required>
        Resolved PubChem CID.
      </ResponseField>

      <ResponseField name="all_matched_cids" type="List[integer]">
        All CIDs returned by the resolver (length 1 for unambiguous queries; may be longer for ambiguous names).
      </ResponseField>

      <ResponseField name="title" type="string">
        Common compound name (e.g. 'Aspirin'), distinct from the IUPAC systematic name in `iupac_name`.
      </ResponseField>

      <ResponseField name="molecular_formula" type="string">
        Hill-system molecular formula.
      </ResponseField>

      <ResponseField name="molecular_weight" type="number">
        Average molecular weight in g/mol.
      </ResponseField>

      <ResponseField name="smiles" type="string">
        PubChem canonical SMILES with stereochemistry (the API field formerly named IsomericSMILES).
      </ResponseField>

      <ResponseField name="connectivity_smiles" type="string">
        Connectivity-only SMILES, with stereochemistry stripped (the API field formerly named CanonicalSMILES).
      </ResponseField>

      <ResponseField name="inchi" type="string">
        Standard InChI string.
      </ResponseField>

      <ResponseField name="inchikey" type="string">
        Standard InChIKey hash.
      </ResponseField>

      <ResponseField name="iupac_name" type="string">
        IUPAC systematic name.
      </ResponseField>

      <ResponseField name="exact_mass" type="number">
        Exact (monoisotopic) mass in Da.
      </ResponseField>

      <ResponseField name="tpsa" type="number">
        Topological polar surface area in angstroms-squared.
      </ResponseField>

      <ResponseField name="complexity" type="integer">
        Bertz / Hendrickson / Ihlenfeldt complexity.
      </ResponseField>

      <ResponseField name="charge" type="integer">
        Net formal charge.
      </ResponseField>

      <ResponseField name="hbond_donor_count" type="integer">
        Number of hydrogen-bond donors.
      </ResponseField>

      <ResponseField name="hbond_acceptor_count" type="integer">
        Number of hydrogen-bond acceptors.
      </ResponseField>

      <ResponseField name="rotatable_bond_count" type="integer">
        Number of rotatable bonds.
      </ResponseField>

      <ResponseField name="heavy_atom_count" type="integer">
        Number of non-hydrogen atoms.
      </ResponseField>

      <ResponseField name="synonyms" type="List[string]">
        Up to 50 synonyms (empty when `include_synonyms` is False).
      </ResponseField>

      <ResponseField name="descriptions" type="List[string]">
        Textual descriptions of the compound, one per source (empty when `include_description` is False).
      </ResponseField>

      <ResponseField name="bioassay_ids" type="List[integer]">
        BioAssay IDs that have tested this compound (empty when `include_aids` is False). For common compounds this can return thousands of IDs.
      </ResponseField>

      <ResponseField name="source_url" type="string" required>
        URL of the PubChem property request.
      </ResponseField>

      <ResponseField name="raw_property_record" type="Dict[string, any]">
        Complete property record from PubChem for advanced programmatic access.
      </ResponseField>
    </Accordion>
  </div>

  #### Applications

  Use this to resolve a ligand to its canonical structure and properties before structure-based or chemical-constraint work: convert a user-supplied name or SMILES into a canonical CID and standardized SMILES/InChI/InChIKey before docking, deduplicate or join compound sets on canonical identifiers, or pull descriptor counts for rule-of-five style filtering. PubChem CIDs anchor cross-references into other chemistry resources. Pair this with [NCBI E-utilities](https://bio-pro.mintlify.app/tools/database-retrieval/ncbi) to pull linked literature or biomolecule records once a CID is resolved.

  #### Usage Tips

  * **Ambiguous names resolve to multiple CIDs.** A generic name can match many compounds. The tool deterministically selects the first CID and records the full list in `all_matched_cids`. Pass a CID directly when the identity must be exact.
  * **Prefer CID inputs for large batches.** Supplying a CID skips the resolution call and reduces the request count per query, which matters under the rate limits.
  * **Synonym, description, and BioAssay retrieval each add a request.** Enabling them issues an extra HTTP call, and for common compounds the BioAssay list can return thousands of identifiers.
  * **Results track the live database.** The same call can return updated structures or properties as PubChem ingests new depositions. It is not pinned to a release.
</div>

## Toolkit Notes

These apply to every PubChem tool in this toolkit (`pubchem-fetch`).

* **Requires network access.** The tool calls the live PubChem PUG REST API. It does not run offline and keeps no local copy of the database.
* **Subject to PUG REST throttling.** PubChem applies dynamic per-user throttling, with limits of no more than 5 requests per second, 400 requests per minute, and 300 seconds of running time per minute. Exceeding them returns HTTP 503.

<Tip>
  **Example notebook:** See the [full working example](https://github.com/evo-design/proto-tools/blob/47e34afa5ea240a3b406e323dc38aa5dc85f223e/proto_tools/tools/database_retrieval/pubchem/examples/example.ipynb) for a copy-paste-ready walkthrough.
</Tip>

## Infrastructure Guides

The following guides cover how to run tools efficiently and at scale.

<CardGroup cols={2}>
  <Card title="Tool Persistence" icon="repeat" href="/docs/tools/guides/tool-persistence">Keep a tool's model warm across calls instead of reloading it every invocation.</Card>
  <Card title="Device Management" icon="cpu" href="/docs/tools/guides/device-management">How GPUs are allocated to tools and how to target specific devices.</Card>
  <Card title="Parallel Execution" icon="layers" href="/docs/tools/guides/parallel-execution">Fan a batch of inputs out across multiple GPUs.</Card>
</CardGroup>
