
PubMed Data API: Extract Structured JSON in 2026
Learn how to extract structured JSON from PubMed using AlterLab's data API — schema-driven, accurate, and ready for AI pipelines in 2026.
AlterLab handles this automatically — scrape any URL with one API call. No infrastructure required.
Try it freeTL;DR
Use AlterLab's Extract API to get structured JSON from PubMed pages by posting a URL and a JSON schema. The service handles anti‑bot measures, returns typed data matching your schema, and requires no HTML parsing. Ideal for building reliable data pipelines for AI training, analytics, or competitive intelligence.
This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.
Why use PubMed data?
PubMed is the largest free repository of biomedical literature, offering millions of records that power diverse workflows:
- AI training: Collect abstracts and titles to fine‑tune language models on domain‑specific text.
- Analytics: Track research trends over time by aggregating publication counts per journal or year.
- Competitive intelligence: Monitor competitors’ recent publications to identify emerging technologies or gaps.
What data can you extract?
From a typical PubMed article page you can pull the following publicly available fields:
- title: The article headline.
- authors: List of contributor names.
- abstract: The structured summary.
- journal: Publication venue name.
- year: Publication date (often extractable as a string).
- doi: Digital Object Identifier for cross‑referencing.
Because AlterLab returns data that conforms to a JSON schema you provide, you receive exactly the fields you asked for, with correct types, and no need for brittle regex or XPath logic.
The extraction approach
Attempting to scrape PubMed with raw HTTP requests and HTML parsing runs into several obstacles:
- Frequent UI changes break CSS selectors.
- JavaScript‑rendered content requires a headless browser.
- Anti‑bot mechanisms (rate limits, CAPTCHAs) demand rotating proxies and retry logic.
- Maintaining parsers at scale consumes engineering effort that could be spent on core product work.
A data API like AlterLab abstracts these concerns. You specify the desired output shape; the platform handles retrieval, rendering, anti‑bot bypass, and validation. The result is predictable, typed JSON that integrates directly into downstream systems.
Quick start with AlterLab Extract API
First, install the Python SDK (or use cURL directly). The quickstart guide explains installation and authentication.
import alterlab
client = alterlab.Client("YOUR_API_KEY")
schema = {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "The title field"
},
"authors": {
"type": "string",
"description": "The authors field"
},
"abstract": {
"type": "string",
"description": "The abstract field"
},
"journal": {
"type": "string",
"description": "The journal field"
},
"year": {
"type": "string",
"description": "The year field"
},
"doi": {
"type": "string",
"description": "The doi field"
}
}
}
result = client.extract(
url="https://pubmed.ncbi.nlm.nih.gov/34567890/",
schema=schema,
)
print(result.data)The highlighted lines (5‑12) show the schema definition and the extract call. The response result.data is a Python dict that matches the schema exactly.
Equivalent cURL request:
curl -X POST https://api.alterlab.io/v1/extract \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://pubmed.ncbi.nlm.nih.gov/34567890/",
"schema": {
"properties": {
"title": {"type": "string"},
"authors": {"type": "string"},
"abstract": {"type": "string"},
"journal": {"type": "string"},
"year": {"type": "string"},
"doi": {"type": "string"}
}
}
}'Both examples return JSON like:
{
"title": "Deep learning for protein structure prediction",
"authors": "Smith J; Lee A; Patel R",
"abstract": "We present a novel architecture...",
"journal": "Nature Methods",
"year": "2023",
"doi": "10.1038/s41592-023-01800-5"
}Define your schema
The Extract API expects a JSON Schema draft‑07 document under the schema key. You can describe nested objects, arrays, enums, or formats (e.g., "format": "date"). AlterLab validates the extracted content against this schema before returning it, guaranteeing that every field exists and is of the correct type. If a field cannot be found, its value will be null (unless you mark it "required"). This contract‑first approach eliminates guesswork and makes versioning your extraction pipeline straightforward.
Handle pagination and scale
For bulk extraction—say, all articles matching a query—you’ll need to iterate over result pages. PubMed’s search results page includes a “Next” link; you can fetch each page, extract the list of article URLs, then call the Extract API in parallel.
import asyncio
import alterlab
from typing import List
client = alterlab.Client("YOUR_API_KEY")
async def extract_one(url: str) -> dict:
schema = {"type": "object", "properties": {"title": {"type": "string"}}}
resp = await client.extract_async(url=url, schema=schema)
return resp.data
async def main(urls: List[str]) -> List[dict]:
tasks = [extract_one(u) for u in urls]
return await asyncio.gather(*tasks)
# Example: first 50 search result URLs
search_urls = [f"https://pubmed.ncbi.nlm.nih.gov/?term=cancer&page={i}" for i in range(1, 6)]
# In practice you would parse each search page to get article links, then call main()The SDK’s extract_async method enables non‑blocking I/O, letting you process hundreds of URLs with minimal latency. Adjust concurrency based on your plan; see the pricing page for rate‑limit details and cost estimates.
Key takeaways
- AlterLab’s Extract API turns any public PubMed page into typed JSON with a single POST.
- Define a JSON schema to get exactly the fields you need, validated and ready for consumption.
- The platform manages rendering, anti‑bot evasion, and scaling so you can focus on data‑driven product work.
- Always respect PubMed’s robots.txt and Terms of Service; this guide covers only publicly accessible data.
Extract structured academic data from PubMed
Was this article helpful?
Frequently Asked Questions
Related Articles
Build a Price Monitor with AlterLab + Supabase
A step-by-step guide to building a real-time price monitoring system using AlterLab web scraping and Supabase. Covers Edge Functions, pg_cron scheduling, structured extraction, and alert notifications, with full Python and TypeScript code.
Yash Dubey
How to Scrape Without Getting Blocked: The Complete Guide
Every web scraping project eventually hits blocks. This guide covers the complete compatibility stack: headers, proxies, browser environment management, rate limiting, and when to use a scraping API instead.
Yash Dubey

arXiv Data API: Extract Structured JSON in 2026
Learn how to build high-performance data pipelines using an arXiv data API to retrieve structured JSON metadata like titles, authors, and abstracts automatically.
Herald Blog Service
Popular Posts
Recommended

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

AlterLab vs Firecrawl: In-Depth Review with Benchmarks & Code Examples

How to Scrape Twitter/X Data: Complete Guide for 2026

How to Scrape Cloudflare-Protected Sites in 2026
Newsletter
Scraping insights and API tips. No spam.
Recommended Reading

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

AlterLab vs Firecrawl: In-Depth Review with Benchmarks & Code Examples

How to Scrape Twitter/X Data: Complete Guide for 2026

How to Scrape Cloudflare-Protected Sites in 2026
Stay in the Loop
Get scraping insights, API tips, and platform updates. No spam — we only send when we have something worth reading.
Explore AlterLab
Web Scraping API Resources
Part of the Web Scraping API Documentation cluster
Complete API reference with 5-tier auto-escalation — Curl to challenge resolution.
Pillar pageConfigure Tier 4 browser rendering for SPAs and dynamic content.
Scrape pages behind login using session management.
Real success rates and cost data across all 5 tiers.
MCP Server, Python SDK, and Firecrawl-compatible API for AI agent workflows.