跳到正文

PubChem PUG REST API Guide, Plus Literature for Every Compound

摘要

SciSpace 发布处于早期访问阶段的 API,在 PubChem PUG REST 返回化合物标识、分子属性和生物测定记录之外,补充论文、专利、证据提取表和带引用的报告。

摘要由模型根据原文撰写,以原文为准。

正文 · 原文

What's new?

What's new?

Now you can research with Unlimited Agent Usage

PubChem PUG REST API Guide, Plus Literature for Every Compound

Resolve compounds, retrieve properties, and fetch bioassays with PubChem PUG REST. Then see how the SciSpace API, now in early access, adds papers, patents, extracted evidence and cited reports for each compound.

The PubChem PUG REST API documentation explains how to turn a compound name into identifiers, molecular properties, and biological assay records. Requests combine an input, an operation, and an output format, without an API key for the examples below.

This guide starts with aspirin in cURL and Python, then shows how the SciSpace API, now in early access, can add papers and patents for the same compound. The goal is a compound page that answers both “What is this molecule?” and “What evidence explains its activity?”

Keep those outputs distinct: store chemical records separately from literature-derived interpretations, but connect both to the same compound identity.

PubChem PUG REST API documentation: the essentials

The base URL ishttps://pubchem.ncbi.nlm.nih.gov/rest/pug. Append the input, operation, and format. For example, compound/name/aspirin/cids/JSON resolves a name to compound identifiers. Consult the official specification for valid combinations.

Three identifiers matter:

  • CID: a standardized compound record.
  • SID: a contributor's deposited substance record.
  • AID: a biological assay record.

Multiple deposited substances can correspond to one standardized compound. Do not treat these identifiers as interchangeable database keys.

For your application, retain the original query, selected CID, InChIKey, and retrieval timestamp. This gives reviewers a concrete identity to inspect before they trust downstream literature matches.

Which endpoints should you start with?

These paths are relative to the base URL. Compound operations are documented in the specification; assay operations also appear in the BioAssay access examples.

Task

Path

---|---

Resolve aspirin

/compound/name/aspirin/cids/JSON

Retrieve properties

/compound/cid/2244/property/MolecularFormula,MolecularWeight,InChIKey/JSON

Retrieve compound bioactivity

/compound/cid/2244/assaysummary/CSV

Read an assay description

/assay/aid/1000/description/JSON

Retrieve concise assay data

/assay/aid/1000/concise/CSV

Choose the operation that matches your interface. A compound detail page needs different data from an assay explorer.

How do you look up a compound with cURL?

Start with a name lookup, then retrieve selected properties using aspirin's CID,2244. These requests follow the official tutorial.

bash BASE='https://pubchem.ncbi.nlm.nih.gov/rest/pug' curl --fail --silent --show-error
"$BASE/compound/name/aspirin/cids/JSON" sleep 1 curl --fail --silent --show-error
"$BASE/compound/cid/2244/property/MolecularFormula,MolecularWeight,InChIKey/JSON" Use this as a smoke test before adding application logic. Preserve the response body and HTTP status separately when diagnosing failures.

For batches, supported operations accept comma-separated CIDs. For long inputs or structures containing reserved characters, use form-encoded POST data rather than a JSON body; the tutorial documents these input patterns.

Start with small batches and request only the properties your interface needs. Preserve each returned CID when joining results rather than assuming response order matches your input order.

Python example: compound name, properties, and bioassays

Installrequests with python -m pip install requests. This compact example resolves aspirin, checks ambiguity, retrieves properties, and prints the compound's assay summary. The request paths follow PubChem's tutorial and BioAssay examples.

python import time import requests BASE = "https://pubchem.ncbi.nlm.nih.gov/rest/pug" def get(path): time.sleep(0.3) response = requests.get(f"{BASE}/{path}", timeout=(10, 45)) response.raise_for_status() return response cids = get("compound/name/aspirin/cids/JSON").json()["IdentifierList"]["CID"] if len(cids) != 1: raise ValueError(f"Select a compound explicitly: {cids}") cid = cids[0] fields = "MolecularFormula,MolecularWeight,InChIKey" compound = {"query_name": "aspirin", **get(f"compound/cid/{cid}/property/{fields}/JSON").json()["PropertyTable"]["Properties"][0]} assays = get(f"compound/cid/{cid}/assaysummary/CSV") print(compound, assays.text, sep="\n") Thecompound dictionary becomes the identity payload for literature enrichment. Parse the CSV with csv.DictReader when you need individual observations instead of a downloadable table.

This is a teaching client, not production retry infrastructure. Add bounded retries for transient failures, coordinated request pacing, and an explicit missing-assay state. Do not silently choose the first result when another compound name returns several candidates.

How should you interpret bioassay results?

A compound-centeredassaysummary and an assay-centered concise table answer different questions. The assay description supplies experimental context, while reported activity reflects the submitter's assessment within that experiment.

For a useful research interface:

  • Keep the AID beside each observation.
  • Preserve target, experimental context, and measurement units when provided.
  • Link users to the assay description before offering a broader interpretation.
  • Keep retrieved observations separate from generated summaries.

Make that separation visible in your data model. For example, use an assay-results panel for source records and an evidence panel for paper-derived explanations. Ask reviewers to check the supporting experiment before accepting a generalized claim about the compound.

Pagination, limits, and errors that matter in production

Batching retrieves several known identifiers together. Pagination retrieves portions of an identifier list: requestlist_return=listkey, then use /compound/listkey/{key}/cids/JSON with zero-based listkey_start and listkey_count. These are not universal page and limit parameters.

PubChem request handling

As checked on October 21, 2026, PubChem asks each user, application, or organization to stay at or below five requests per second. Its default server-side request timeout is 30 seconds.

MonitorX-Throttling-Control and reduce traffic according to the worst feedback received. Dynamic throttling can change under load.

HTTP status

Client action

---|---

400

Correct malformed input

404

Check identity or represent missing data

503

Back off before retrying

504

Narrow the request before retrying

These actions follow PubChem's documented status distinctions.

Persist completed identifiers in your own job record so interrupted ingestion can resume without repeating successful work.

Where does PubChem stop for a research product?

PubChem does provide literature and patent links through cross-reference operations such asxrefs/PubMedID,PatentID. PUG-View also provides structured reports with annotations. It would be inaccurate to say PubChem has no literature context.

The additional work begins when your deliverable is a cited research answer rather than linked identifiers. Building that layer yourself means maintaining:

  • Separate literature and patent clients, including source-specific request handling.
  • Compound-name expansion and identity checks.
  • Deduplication and relevance ranking.
  • Open-access PDF discovery, fetching, and parsing.
  • Evidence extraction, summarization, and citation formatting.

Define an insufficient-evidence state before shipping. A compound page should explain what was found, which documents were readable, and what remains unresolved. “Literature for every compound” should mean a research workflow for every record, not a promise that relevant papers always exist.

What the SciSpace API adds for compound research tools

PubChem stops at structured records and linked identifiers: reading the papers and patents behind a compound, extracting comparable evidence and writing a cited brief stay with you. Keep direct PUG REST calls for deterministic chemical records.

The SciSpace API puts the full SciSpace Agent behind one call. It searches, reads, analyses and writes, and delivers the result as ready-to-use files.

API

What you send

What you get back

---|---|---

Search API

A research question in plain language, such as studies on aspirin's antiplatelet activity

A list of papers, each with all its relevant metadata, from one search across SciSpace's 280M+ paper index plus Google Scholar, PubMed and arXiv

Task API

A research task that includes the resolved compound identity (CID and InChIKey), such as finding papers and patents on the exact compound, separating derivatives, extracting methods, findings and limitations into a table, and writing a cited brief with evidence gaps

Links to every file the agent created (Markdown, Word, PowerPoint and more) plus any supporting text answer; the plan and progress stream live, and follow-ups continue in the same thread

What this adds on top of PubChem

  • Evidence beyond papers in one task. SciSpace's 280M+ paper index plus Google Scholar, PubMed and arXiv, Google Patents, 11 national and regional clinical-trial registries plus the WHO registry, and 77 public science databases such as PubChem, ChEMBL, UniProt, ClinVar and PDB.
  • One integration. Describe the task in plain language and the agent picks the tools (search, screening, extraction, analysis, writing), instead of you stitching together a literature API, a patent client, a PDF parser and an LLM.
  • Evidence tables. Data-extraction tables with AI-filled columns from full text, such as experimental system, outcome and limitations, which you can then filter, sort and combine.
  • Questions over your PDFs. Q&A over up to 10 PDFs at once with page-level citations, including figures and tables.
  • Finished files from one run. A cited brief as Markdown or Word, or a LaTeX report compiled to PDF with its BibTeX.
  • Live streaming. Each plan step and the answer stream as they are written, and follow-ups continue in the same thread, so users can dig into a finding without restating the compound.

When to use which

  • Use PUG REST when the required output is a CID, property row, or assay record. An existing PubChem integration can stay unchanged.
  • Choose SciSpace for the research layer: papers and patents, full-text questions, extracted comparisons and cited reports. Start your evaluation with a well-studied compound, an ambiguous name and a compound with sparse evidence, and require correct identity handling and honest gaps.

What it doesn't do

  • It does not read paywalled papers. It works from your own PDFs plus 50M+ open-access full texts.
  • It is not a web search API. For news, product docs or general web pages, use a web search API.
  • It does not query Semantic Scholar, Scopus, Web of Science, Lens or other sources not listed above.

The SciSpace API is in early access; it isn't open yet. At launch it's open to anyone: register on SciSpace and start, with no sales call. Every account gets $5 in free API credits, enough to try both APIs on real questions. The API is separate from SciSpace consumer plans; no consumer plan includes API usage.

Frequently asked questions

Last checked

PubChem documentation checked on October 21, 2026. SciSpace descriptions reflect the SciSpace API as of October 2026, which is in early access.


注意转载授权 · 阅读原文

来源:SciSpace · scispace.com

引用原文

SciSpace. PubChem PUG REST API Guide, Plus Literature for Every Compound[EB/OL]. (2026-11-03)[访问日期]. https://scispace.com/guides/pubchem-pug-rest-api-documentation.