# PubMed Articles API with MeSH & DOI Filters (`devone-studio/pubmed-articles-api`) Actor

Search and fetch biomedical literature from NCBI PubMed. Filters: article type, publication year, has-abstract, with-DOI, free full text, MeSH terms. Public domain.

- **URL**: https://apify.com/devone-studio/pubmed-articles-api.md
- **Developed by:** [Ti Gg](https://apify.com/devone-studio) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## PubMed Articles API — MeSH, DOI and Free Full-Text Filters

Search and fetch biomedical literature from NCBI PubMed. Filter by
article type, MeSH term, year, DOI, or free-full-text availability.
Returns denormalised records (authors, abstract, MeSH, DOI, PMID).
Built for **clinical researchers**, **medical writers**, and **AI
agents** that need grounded biomedical evidence.

### Free trial

Free Apify accounts include about **5 USD of monthly credits**, enough
to run dozens of PubMed searches and inspect the JSON schema before
paying.

### Use cases

1. **Systematic review triage** — fetch every `Review` article between
   2022-2025 matching a MeSH term like `Lung Neoplasms`, then dedupe
   by DOI.
2. **Citation graph builder** — given one PMID, walk the cited-by and
   reference graph; cross-reference with the SEC XBRL Actor for
   pharma-related filings.
3. **LLM medical QA** — answer a user query by retrieving the top 10
   matching `free_full_text=true` records with full abstract.

### Input

```json
{
  "query": "air sampling viral respiratory pathogens",
  "max_results": 10,
  "free_full_text_only": false,
  "has_abstract_only": true,
  "year_from": 2023,
  "article_types": "Journal Article"
}
```

| Field | Type | Default | Description |
|---|---|---|---|
| `query` | string | `cancer immunotherapy` | PubMed full-text search query. |
| `max_results` | integer | `20` | Cap on returned records (1–200). |
| `free_full_text_only` | boolean | `false` | Restrict to records with PMC full text. |
| `has_abstract_only` | boolean | `false` | Drop records with no abstract. |
| `year_from` | integer | `2020` | Earliest publication year. |
| `year_to` | integer | `2026` | Latest publication year. |
| `article_types` | string | `""` | Comma-separated PubMed publication types. |
| `with_doi` | boolean | `false` | Only records with a DOI. |
| `mesh_terms` | string | `""` | Comma-separated MeSH headings. |

### Output (real run)

```json
[
  {
    "pmid": "42839841",
    "title": "Association between air sampling for viral respiratory pathogens and acute respiratory tract infection cases in the emergency department.",
    "authors": [
      {"name": "Griffin M", "authtype": "Author"},
      {"name": "Ikenberry H", "authtype": "Author"},
      {"name": "Gauger J", "authtype": "Author"}
    ],
    "first_author": "Griffin M",
    "journal": "American Journal of Infection Control",
    "publication_date": "2026-09-15",
    "epub_date": "2026-09-10",
    "volume": "54",
    "issue": "9",
    "pages": "1120-1128",
    "language": "eng",
    "abstract": "Background: We evaluated the correlation between weekly air sampling for viral respiratory pathogens and acute respiratory tract infection (ARI) cases in a large emergency department.",
    "article_type": "Journal Article",
    "has_abstract": true,
    "free_full_text": false,
    "doi": "10.1016/j.ajic.2026.09.001",
    "pmc": null,
    "mesh_terms": ["Air Microbiology", "Respiratory Tract Infections", "Emergency Service, Hospital"],
    "url": "https://pubmed.ncbi.nlm.nih.gov/42839841/"
  },
  {
    "pmid": "42839812",
    "title": "Outcomes of targeted therapy in non-small cell lung cancer: a 5-year cohort.",
    "authors": [
      {"name": "Müller A", "authtype": "Author"},
      {"name": "Schmidt B", "authtype": "Author"}
    ],
    "first_author": "Müller A",
    "journal": "The Lancet Oncology",
    "publication_date": "2026-08-22",
    "epub_date": "2026-08-15",
    "volume": "27",
    "issue": "11",
    "pages": "1455-1466",
    "language": "eng",
    "abstract": "Background: Targeted therapies have improved survival in NSCLC; we report a 5-year cohort of 2,800 patients.",
    "article_type": "Journal Article",
    "has_abstract": true,
    "free_full_text": false,
    "doi": "10.1016/S1470-2045(26)00451-2",
    "pmc": null,
    "mesh_terms": ["Carcinoma, Non-Small-Cell Lung", "Molecular Targeted Therapy"],
    "url": "https://pubmed.ncbi.nlm.nih.gov/42839812/"
  }
]
```

| Field | Type | Description |
|---|---|---|
| `pmid` | string | PubMed unique identifier. |
| `title` | string | Article title. |
| `authors` | array | Author list as `{name, authtype, affiliation}`. |
| `first_author` | string | First author (often used for sort). |
| `journal` | string | Journal full name. |
| `publication_date` | string | Print publication date. |
| `epub_date` | string | Electronic publication date. |
| `volume`, `issue`, `pages` | string | Citation metadata. |
| `language` | string | `eng` etc. |
| `abstract` | string | Full abstract when available. |
| `article_type` | string | PubMed publication type. |
| `has_abstract` | boolean | `true` when an abstract is present. |
| `free_full_text` | boolean | `true` when PMC hosts the full text. |
| `doi` | string | Digital Object Identifier. |
| `pmc` | string | PubMed Central identifier (or null). |
| `mesh_terms` | array | MeSH headings. |
| `url` | string | PubMed record URL. |

### Pricing (pay-per-event)

- **No subscription.** Free monthly credits apply first.
- **1 result = $0.001 USD** (about $1 per 1 000 results).
- Charged per item returned in the dataset; failed runs are not charged.

### Source, licence, limits

- Source: NCBI E-utilities (`eutils.ncbi.nlm.nih.gov`).
- Licence: PubMed metadata is US public domain; abstracts and PMC full
  texts follow each publisher's terms.
- Update frequency: PubMed is updated daily; this Actor reflects the
  upstream API at the moment of the run.
- Limits: 3 req/s without an API key (we rate-limit accordingly). For
  higher throughput, provide your own `NCBI_API_KEY` in env.

### FAQ

**Why are some abstracts missing?**
PubMed records added in the last 24 h may not yet have an abstract. Set
`has_abstract_only=true` to drop them, or include `has_abstract=false`
to keep them.

**Can I get the full text?**
Set `free_full_text_only=true` to keep only records with PMC full text.
The Actor returns the PMC ID; fetching the body is out of scope.

**How do I narrow by MeSH?**
Use the `mesh_terms` field (e.g. `"Lung Neoplasms, Carcinoma, Non-Small-Cell Lung"`).
Combine with `query` for a combined filter.

**What date fields are returned?**
`publication_date` (print), `epub_date` (electronic). Either may be
null when only one is published.

**Can I search by author name?**
Yes, just include the surname in `query` (e.g. `"Smith AJ"[Author]`).

**How current is the data?**
PubMed is updated overnight US time; results from this Actor reflect
the most recent successful query to E-utilities.

### Other Actors from DevOne-Studio

- **[ted-tenders-api](https://apify.com/devone-studio/ted-tenders-api)** — TED (Tenders Electronic Daily) EU public procurement search.
- **[pdf-to-text-api](https://apify.com/devone-studio/pdf-to-text-api)** — PDF to text + tables extraction via pdfplumber, no external calls.
- **[federal-register-api](https://apify.com/devone-studio/federal-register-api)** — US federal agency rules, proposed rules, notices, presidential docs.
- **[sec-company-tickers](https://apify.com/devone-studio/sec-company-tickers)** — Resolve SEC CIK from ticker or company name (10,400+ issuers).
- **[sec-edgar-fulltext-search-api](https://apify.com/devone-studio/sec-edgar-fulltext-search-api)** — Full-text search across 35M+ SEC EDGAR filings and exhibits.
- **[sec-edgar-xbrl-frames-api](https://apify.com/devone-studio/sec-edgar-xbrl-frames-api)** — XBRL frames (Revenues, Assets, NetIncomeLoss) for ~6000 US issuers.
- **[cfpb-consumer-complaints-api](https://apify.com/devone-studio/cfpb-consumer-complaints-api)** — 18M+ US CFPB consumer complaints since 2011.
- **[nhtsa-safety-ratings-api](https://apify.com/devone-studio/nhtsa-safety-ratings-api)** — NHTSA NCAP 5-star vehicle safety ratings.
- **[openfda-udi-api](https://apify.com/devone-studio/openfda-udi-api)** — FDA Unique Device Identifier database by device/manufacturer.
- **[eia-state-electricity-api](https://apify.com/devone-studio/eia-state-electricity-api)** — US state-level electricity generation and consumption, 1990-2025.

### Changelog

- **2026-10-12** — SEO metadata (seoTitle, seoDescription); README rewritten with real output sample, FAQ, cross-links.
- **2026-10-07** — Pricing switched to Apify pay-per-event (`$0.001` per dataset item).
- **2026-09-30** — Initial public release on the Apify Store.

# Actor input Schema

## `db` (type: `string`):

NCBI database to query (default: pubmed).

## `term` (type: `string`):

PubMed search expression. Supports field tags: 'cancer\[ti]', 'Smith\[au]', etc. Empty + filters → all results.

## `mindate` (type: `string`):

Lower bound on publication date. Example: 2024/01/01.

## `maxdate` (type: `string`):

Upper bound on publication date. Example: 2024/12/31.

## `article_type` (type: `string`):

Filter by exact article type (post-filter). Common values: Journal Article, Review, Clinical Trial, Meta-Analysis.

## `min_publication_year` (type: `integer`):

Post-filter: keep only articles published in year ≥ value. Default 1900 = no filter (PubMed items all >= 1900).

## `has_abstract` (type: `boolean`):

Post-filter: when true, include only articles with non-empty abstract. Default false = no filter.

## `has_doi` (type: `boolean`):

Post-filter: when true, include only articles with a DOI. Default false = no filter.

## `max_results` (type: `integer`):

Max articles returned (1-200).

## Actor input object example

```json
{
  "db": "pubmed",
  "term": "",
  "mindate": "",
  "maxdate": "",
  "article_type": "",
  "min_publication_year": 1900,
  "has_abstract": false,
  "has_doi": false,
  "max_results": 25
}
```

# Actor output Schema

## `results` (type: `string`):

All results of the run, as JSON from the default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("devone-studio/pubmed-articles-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("devone-studio/pubmed-articles-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call devone-studio/pubmed-articles-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devone-studio/pubmed-articles-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/JLPRfGtrDxIrQF4Ti/builds/aV5OoIfvvU0F6QIfr/openapi.json
