Nih APIpubmed.ncbi.nlm.nih.gov ↗
Search and retrieve PubMed biomedical literature: abstracts, MeSH terms, author affiliations, clinical queries, citation matching, and NCBI E-utilities access.
What is the Nih API?
This API exposes 11 endpoints for querying and retrieving data from PubMed, covering everything from keyword search to full article metadata. The get_article_details endpoint returns structured author lists with affiliations, abstract text, MeSH keywords, DOI, PMCID, and up to 10 similar article PMIDs for a single record. Other endpoints support clinical query filters, date-range filtering, publication type tagging, citation resolution, and direct NCBI E-utilities access.
curl -X GET 'https://api.parse.bot/scraper/7ddf510a-9bab-463f-8e03-f25423a326e3/search_articles?page=1&sort=relevance&limit=5&query=cancer' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace pubmed-ncbi-nlm-nih-gov-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""PubMed SDK walkthrough — search, drill into details, explore similar articles."""
from parse_apis.pubmed_api import PubMed, Sort, ClinicalCategory, Utility, ArticleNotFound
client = PubMed()
# Search for recent cancer articles sorted by date, capped at 5 total items.
for summary in client.articles.search(query="immunotherapy", sort=Sort.DATE, limit=5):
print(summary.title, summary.journal, summary.date)
# Drill into the first result's full details.
article = client.articles.search(query="CRISPR", limit=1).first()
if article:
detail = article.details()
print(detail.title, detail.doi, detail.publication_date)
for author in detail.authors[:3]:
print(author.name, author.affiliations)
# Walk the article's similar articles sub-resource.
for sim in detail.similar.list(limit=3):
print(sim.title, sim.journal)
# Clinical queries: narrow therapy results for a condition.
for hit in client.articles.clinical_search(query="asthma", category=ClinicalCategory.DIAGNOSIS, limit=3):
print(hit.pmid, hit.title)
# Typed error handling on a point-lookup.
try:
detail = client.articles.get(pmid="99999999999")
print(detail.abstract)
except ArticleNotFound as exc:
print(f"Article not found: PMID {exc.pmid}")
# Quick count without fetching articles.
stats = client.articles.count(query="Alzheimer")
print(stats.query, stats.total_count)
# Direct E-utilities access for advanced use cases.
raw = client.eutilsresponses.query(utility=Utility.ESEARCH, params='{"db": "pubmed", "term": "BRCA1", "retmode": "json", "retmax": "3"}')
print(raw.esearchresult)
print("exercised: articles.search / details / similar.list / clinical_search / get / count / eutilsresponses.query")
Full-text search over PubMed articles by keyword. Paginates via page number. Each result includes PMID, title, authors, journal, publication date, DOI, and URL. Sort controls ordering; limit controls page size.
| Param | Type | Description |
|---|---|---|
| page | integer | Page number for pagination |
| sort | string | Sort order for results |
| limit | integer | Number of results per page (max 100) |
| queryrequired | string | Search keyword or query string |
{
"type": "object",
"fields": {
"page": "integer current page number",
"limit": "integer results per page",
"total": "integer total number of matching results",
"articles": "array of article summaries with pmid, title, authors, journal, date, doi, url"
},
"sample": {
"data": {
"page": 1,
"limit": 5,
"total": 5631045,
"articles": [
{
"doi": "10.1093/qjmed/hcag147",
"url": "https://pubmed.ncbi.nlm.nih.gov/42268677/",
"date": "2026 Jun 10",
"pmid": "42268677",
"title": "Global burden of non-communicable diseases attributable to ambient fine particulate matter pollution in adults aged 65 years and older from 1990 to 2021.",
"authors": [
"Zheng Z",
"Hairong Z"
],
"journal": "QJM"
}
]
},
"status": "success"
}
}About the Nih API
Search and Retrieval
The search_articles endpoint accepts a query string and returns paginated article summaries, each carrying pmid, title, authors, journal, date, doi, and url. Pagination is controlled by page and limit (up to 100 per page), with a total field indicating the full result count. For more precise targeting, advanced_search accepts PubMed field-tag syntax — for example, ("lung cancer"[Title]) AND Nature[Journal] or date ranges using 2020:2024[PDAT] — and returns the same article summary shape.
Filtering by Type, Journal, and Date
search_by_journal narrows results to a specific journal using the journal parameter, with an optional query to filter within it. search_by_article_type appends a [Publication Type] tag to any query, filtering for types like Clinical Trial, Review, or Meta-Analysis. search_with_date_filter accepts start_date and end_date in YYYY/MM/DD format and returns matching pmids plus a total count — useful as a first pass before fetching full details. get_search_results_count returns only a total_count for a query without pulling article records, which is useful for scoping result volume before committing to pagination.
Clinical and Citation Utilities
clinical_queries_search appends a PubMed Clinical Queries filter based on category and scope, narrowing results to clinically relevant literature. single_citation_matcher uses NCBI's ecitmatch utility to resolve a known citation — identified by journal, year, and optionally volume, issue, first_page, and author — to a specific PMID, returning full article details including abstract and similar_pmids. get_similar_articles returns up to 10 related article summaries for a given PMID using PubMed's built-in relatedness algorithm; very recently indexed articles may return fewer results.
Direct E-Utilities Access
The search_pubmed_ncbi_eutils POST endpoint passes parameters directly to any NCBI E-utility — esearch, esummary, efetch, elink, einfo, egquery, espell, or ecitmatch. The utility parameter names the target, and params is a JSON string of query parameters. The response includes either a structured esearchresult object (for esearch) or a raw content string for non-JSON responses, giving full access to the E-utilities interface without building the request layer yourself.
The Nih API is a managed, monitored endpoint for pubmed.ncbi.nlm.nih.gov — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when pubmed.ncbi.nlm.nih.gov changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official pubmed.ncbi.nlm.nih.gov API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a literature review tool that fetches abstracts and MeSH keywords via
get_article_detailsfor a list of PMIDs. - Filter clinical trial publications by date range using
search_with_date_filterandsearch_by_article_typetogether. - Resolve a bibliography entry to a verified PMID using
single_citation_matcherwith journal, year, and first author. - Aggregate article counts across journals and topics using
get_search_results_countwithout pulling full records. - Surface related reading recommendations by querying
get_similar_articlesfor any article a user is viewing. - Scope a systematic review by journal using
search_by_journalwith keyword filters and pagination. - Execute raw E-utilities queries — including efetch for full-text XML — through
search_pubmed_ncbi_eutils.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does PubMed have an official developer API?+
What does `get_article_details` return beyond a basic summary?+
authors array with each author's name, forename, lastname, initials, and affiliations, the journal_name, doi, pmcid, keywords (MeSH terms), copyright, and a similar_pmids array of up to 10 related article IDs generated by PubMed's relatedness algorithm.Does the API return full-text article content?+
search_pubmed_ncbi_eutils endpoint can call efetch for PubMed Central records where open-access full text is available. You can fork this API on Parse and revise it to add a dedicated endpoint that parses efetch XML responses for PubMed Central articles.How does pagination work across the search endpoints?+
search_articles supports explicit page and limit parameters (up to 100 per page) and returns a total field for calculating page counts. advanced_search, search_by_journal, clinical_queries_search, and search_by_article_type return a single page of results controlled by a limit parameter but do not expose a page offset parameter. search_with_date_filter returns only PMIDs and a total count, not paginated article summaries.