Nih APIncbi.nlm.nih.gov ↗
Search PubMed, retrieve full PMC article text, and look up MeSH terms via 5 structured endpoints. Get metadata, abstracts, MeSH headings, and more.
What is the Nih API?
This API provides access to biomedical literature across three NCBI databases through 5 endpoints covering PubMed search, full article metadata, PMC full-text retrieval, and MeSH vocabulary lookup. The pubmed_search endpoint accepts free-text queries with filters for date range, article type (Clinical Trial, Meta-Analysis, Review), and text availability, returning paginated summaries with PMIDs, DOIs, and PMCIDs. The pmc_get_article endpoint extracts labeled sections including methods, results, and limitations.
curl -X GET 'https://api.parse.bot/scraper/d740e466-9fe1-49a2-94c8-9b7c1e0c30ea/pubmed_search?sort=Best+match&query=diabetes+insipidus&retmax=5&retstart=0&date_range=1+year&article_type=Review&text_availability=abstract' \ -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 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.
"""Walkthrough: NCBI PubMed & PMC SDK — search articles, fetch details, explore MeSH."""
from parse_apis.ncbi_pubmed_pmc_api import Pubmed, Sort, DateRange, TextAvailability, ResourceNotFound
client = Pubmed()
# Search PubMed for recent review articles on a topic, bounded.
for article in client.articlesummaries.search(
query="CRISPR gene therapy",
sort=Sort.MOST_RECENT,
date_range=DateRange.FIVE_YEARS,
text_availability=TextAvailability.FREE_FULL_TEXT,
retmax=5,
limit=5,
):
print(article.title, article.pmid, article.is_free)
# Drill into the first result for full metadata.
summary = client.articlesummaries.search(query="diabetes insipidus", limit=1).first()
if summary:
detail = summary.details()
print(detail.title, detail.abstract[:120])
for author in detail.authors[:3]:
print(author.name, author.affiliations)
# Fetch a PMC full-text article directly by PMCID.
pmc = client.pmcarticles.get(pmcid="PMC7096075")
print(pmc.title, pmc.study_type, pmc.published_date)
print(pmc.patient_friendly_summary[:200])
# Search MeSH terms and drill into tree classification.
mesh_hit = client.meshtermsummaries.search(query="diabetes", limit=1).first()
if mesh_hit:
full_term = mesh_hit.details()
print(full_term.term, full_term.mesh_ui, full_term.tree_numbers)
# Typed error handling for a bad PMID.
try:
client.articles.get(pmid="99999999999")
except ResourceNotFound as exc:
print(f"Not found: {exc}")
print("exercised: articlesummaries.search / details / articles.get / pmcarticles.get / meshtermsummaries.search / details")
Full-text search across all PubMed articles. Supports filters for date range, article type, and text availability. Returns paginated article summaries (title, authors, journal, identifiers). Pagination is offset-based via retstart/retmax. Each result carries a PMID usable with pubmed_get_article for full metadata.
| Param | Type | Description |
|---|---|---|
| sort | string | Sort order for results. |
| queryrequired | string | Search query string for PubMed. |
| retmax | integer | Maximum number of results to return per request. |
| retstart | integer | Result offset for pagination (0-based). |
| date_range | string | Filter by publication date range. |
| article_type | string | Article type filter (e.g. Review, Clinical Trial, Meta-Analysis, Randomized Controlled Trial). |
| text_availability | string | Filter by text availability. |
{
"type": "object",
"fields": {
"items": "array of article summary objects with pmid, title, authors, journal, pub_date, doi, pmcid, is_free",
"total": "integer total count of matching articles"
},
"sample": {
"data": {
"items": [
{
"doi": "10.1016/j.ecl.2020.05.012",
"pmid": "32741486",
"pmcid": "",
"title": "Diabetes Insipidus: An Update.",
"authors": [
"Refardt J",
"Winzeler B",
"Christ-Crain M"
],
"is_free": false,
"journal": "Endocrinol Metab Clin North Am",
"pub_date": "2020 Sep"
}
],
"total": 12840
},
"status": "success"
}
}About the Nih API
PubMed Search and Article Metadata
The pubmed_search endpoint accepts a query string and optional filters: date_range, article_type (e.g. Randomized Controlled Trial, Meta-Analysis), text_availability, and sort. Pagination is offset-based via retstart and retmax. Results are arrays of summary objects containing pmid, title, authors, journal, pub_date, doi, pmcid, and is_free. The total field gives the full result count for building pagination UIs.
To retrieve complete bibliographic data for a single article, use pubmed_get_article with a pmid. The response includes the full abstract, an authors array where each entry carries both name and affiliations, structured journal info (volume, issue, pub_date), mesh_terms, and keywords. This is the correct endpoint when you need MeSH headings or author institution data that the search summary does not include.
PMC Full-Text Retrieval
The pmc_get_article endpoint accepts a pmcid (with or without the PMC prefix) and returns structured section text: population, findings, outcomes, and limitations fields are extracted when present in the article. The full_text field contains the complete article text truncated at 20,000 characters. For publisher-restricted articles, full_text falls back to the abstract. A source_url and study_type field are also returned.
MeSH Vocabulary Lookup
The mesh_search endpoint queries the Medical Subject Headings vocabulary and returns matching descriptors with mesh_ui (D-number), term, definition, and synonyms. The numeric id from those results can be passed to mesh_get_term to retrieve tree_numbers — the hierarchical classification codes that indicate where a concept sits within the MeSH taxonomy — along with the full scope note and all entry terms.
The Nih API is a managed, monitored endpoint for ncbi.nlm.nih.gov — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when 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 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 systematic review tool that filters PubMed for Randomized Controlled Trials using article_type and extracts structured sections via pmc_get_article
- Map disease terminology hierarchies by resolving MeSH tree_numbers with mesh_get_term for a given condition
- Aggregate author affiliations across a research topic by fetching pmid lists from pubmed_search and resolving each with pubmed_get_article
- Identify free full-text articles on a topic using the is_free flag in pubmed_search results, then retrieve their full_text from pmc_get_article
- Extract limitations sections from clinical studies at scale using the limitations field returned by pmc_get_article
- Link publications to standardized vocabulary by cross-referencing mesh_terms in pubmed_get_article responses with MeSH definitions from mesh_get_term
- Track publication volume over time for a research area by querying pubmed_search with date_range and reading the total count
| 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.