# PubMed Search: Abstracts, MeSH Terms and DOIs (`plainpipe/pubmed-literature-search`) Actor

Search PubMed via official NCBI E-utilities: title, abstract, journal, date, authors, DOI, PMCID, MeSH. Use when you need biomedical literature as data.

- **URL**: https://apify.com/plainpipe/pubmed-literature-search.md
- **Developed by:** [Plain Pipe](https://apify.com/plainpipe) (community)
- **Categories:** Developer tools, Integrations
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 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 Search: Abstracts, MeSH Terms and DOIs

Search PubMed via the official NCBI E-utilities. One row per record: title, abstract, journal, date, authors, DOI, PMCID and MeSH terms. JSON, CSV or Excel.

**Use this when:** you need PubMed records for a search query as rows (abstract, DOI, PMCID, MeSH terms) for a review, dataset or monitoring job.

### Why this one

- $1.50 per 1,000 results, one result per PubMed record.
- Each row includes `meshTerms`, `publicationTypes`, `doi` and `pmcid` next to title, abstract, journal, date and authors.
- Uses only the official NCBI E-utilities API: no browser, no proxy, no HTML parsing. The prefilled example (10 records) finishes in under 3 seconds in our test runs.
- Full PubMed query syntax (field tags, Boolean operators) plus date range and sort; checked before each release against the prefilled input and 6 edge-case inputs.

### What it does

This Actor sends your query to PubMed through NCBI's official [E-utilities](https://www.ncbi.nlm.nih.gov/books/NBK25497/) (esearch with the history server, then efetch in XML) and returns the bibliographic metadata of each matching record as one dataset row. You get the same results as the PubMed site for the same query, as clean structured data, without writing an E-utilities client or XML parser.

It returns only the metadata and abstracts that PubMed publishes. It does not fetch the papers themselves; each row carries the DOI, the PMCID when the paper is in PubMed Central, and the PubMed link. Data source: PubMed, run by the US National Library of Medicine (NLM) at NCBI, used under the [NCBI policies](https://www.ncbi.nlm.nih.gov/home/about/policies/).

### Use cases

- Run a repeatable, documented literature search for a systematic review and keep the exact result list as CSV.
- Track new publications on a topic each week (sort by publication date, schedule the run).
- Load titles, abstracts and MeSH terms into a reference manager, a database or a retrieval (RAG) pipeline.
- Count publications per year or per journal for a bibliometric chart.
- Pull the DOI and PMCID list for a query to find which papers are open access in PubMed Central.

### How to use it

1. Type your **Search query** the way you would in the PubMed search box, for example `machine learning radiology`.
2. Optionally set a publication date range (**Published from** / **Published until**) and a **Sort by** order.
3. Set **Max results** (start with 10 to try it). Add an **NCBI API key** for faster large runs.
4. Click **Start**. Export the dataset as JSON, CSV or Excel, or read it through the Apify API.

### Input

| Field | What it is | Default | Example |
|---|---|---|---|
| `query` (required) | PubMed search syntax. Plain words are mapped to MeSH terms by PubMed; field tags and Boolean operators work as on the PubMed site. | none | `asthma[ti] AND children[mh]` |
| `dateFrom` | Publication date on or after, `YYYY-MM-DD` (sent as `mindate` with `datetype=pdat`). | empty | `2023-01-01` |
| `dateTo` | Publication date on or before, `YYYY-MM-DD`. One side alone is fine. | empty | `2023-12-31` |
| `sort` | `relevance` (PubMed best match) or `pub_date` (newest first). | `relevance` | `pub_date` |
| `maxItems` | Stop after this many records (at most 10,000). | `100` | `500` |
| `ncbiApiKey` | Optional NCBI API key, stored as a secret input. Raises the request rate from 2 to 8 per second. Free in your NCBI account settings. | empty | `0123abcd...` |

Example input:

```json
{ "query": "CRISPR[tiab] AND gene therapy", "dateFrom": "2023-01-01", "dateTo": "2023-06-30", "sort": "pub_date", "maxItems": 50 }
```

An empty query, an invalid date, a reversed date range or a malformed API key fails the run before any request is made, so nothing is charged. A query with no matches also fails with zero results. Every error message says which field to fix.

### Output

One row per record. Example from a real run:

```json
{
  "pmid": "39764535",
  "title": "Machine learning applications in healthcare clinical practice and research.",
  "abstract": "Machine learning (ML) is a type of artificial intelligence that assists computers in the acquisition of knowledge through data analysis ...",
  "journal": "World journal of clinical cases",
  "journalAbbreviation": "World J Clin Cases",
  "pubDate": "2025-01-06",
  "year": 2025,
  "epubDate": null,
  "authors": ["Nikolaos-Achilleas Arkoudis", "Stavros P Papadakos"],
  "doi": "10.12998/wjcc.v13.i1.99744",
  "pmcid": "PMC11577516",
  "publicationTypes": ["Editorial"],
  "meshTerms": [],
  "keywords": ["Artificial", "Clinical", "Glomerular filtration rate", "Intelligence", "Learning", "Machine", "Medicine"],
  "language": "eng",
  "pubmedUrl": "https://pubmed.ncbi.nlm.nih.gov/39764535/"
}
```

| Field | Meaning |
|---|---|
| `pmid`, `pubmedUrl` | PubMed ID and record link |
| `title`, `abstract` | Title and abstract; structured abstracts keep `LABEL: text`, one section per line; `null` when none |
| `journal`, `journalAbbreviation` | Journal name and ISO abbreviation |
| `pubDate`, `year`, `epubDate` | Issue date as precise as PubMed gives it (`YYYY`, `YYYY-MM`, `YYYY-MM-DD` or original text such as `2019 Nov-Dec`), the year as a number, and the electronic publication date or `null` |
| `authors` | Author names as listed in the record (given then family name, or a group name); no affiliations |
| `doi`, `pmcid` | DOI and PubMed Central ID, `null` when PubMed has none |
| `publicationTypes`, `meshTerms`, `keywords`, `language` | Indexing data; `meshTerms` can be empty for very recent records |

PubMed's date filter matches either the issue date or the electronic date, so a record can fall inside your range by its `epubDate` even when its issue date is later.

### Pricing

Pay per result: **$1.50 per 1,000 results** ($0.0015 per result). You only pay for results the Actor returns. Set a maximum total charge on the run to cap your spend.

### Limits

- Follows the NCBI E-utilities usage policy: at most 2 requests per second without an API key (the policy allows 3) and at most 8 per second with a key (the policy allows 10). Records are fetched 200 per request, so a 10,000-record run needs about 50 fetch requests and usually finishes in a few minutes.
- E-utilities serve at most the first 10,000 records of one search. Narrow the query or split it by date range to cover more.
- Ranking, MeSH mapping and date filtering are done by PubMed, not by this Actor.
- Rare book and chapter records in PubMed are skipped; only journal records are returned.
- If NCBI is down or keeps returning errors after retries, the run fails and you are not charged for rows that were never produced.

### FAQ

**How much does a run cost?** $0.0015 per record returned; 1,000 records cost $1.50. Failed runs and searches with no matches push no rows and cost nothing per result.

**Do I need an NCBI API key?** No. Without a key the Actor runs at 2 requests per second, which is enough for most searches. A free key makes runs of several thousand records faster.

**My query works on the PubMed site but fails here. Why?** Check the date filter (it narrows the site's results the same way) and the quoting: the query is sent to PubMed as typed. The error message repeats PubMed's own reason when it rejects a query.

**Which export formats are there?** JSON, CSV, Excel, XML and HTML table from the dataset tab, or any of them through the Apify API.

**Can I run it on a schedule or from my own code?** Yes. Create a schedule in Apify Console (for example weekly with `sort: pub_date`), or start runs and read results through the Apify API, webhooks or the Apify client libraries.

### Legal and data

This Actor processes only what you give it or public, non-personal technical data. It does not log in anywhere, does not collect personal data, and does not bypass paywalls, CAPTCHAs or access controls. You are responsible for having the right to process the inputs you provide.

It uses the official NCBI E-utilities (https://www.ncbi.nlm.nih.gov/books/NBK25497/) under the NCBI policies (https://www.ncbi.nlm.nih.gov/home/about/policies/), identifies itself with the `tool` parameter, and returns bibliographic metadata only. Author names are the published bylines of each paper. Some abstracts may be protected by the copyright of their publishers; check the publisher terms before republishing them. This Actor is not affiliated with or endorsed by NCBI, NLM or NIH.

### Support

Open an issue on the Issues tab. Issues are answered within 14 days.

Built and maintained by Plain Pipe.

# Actor input Schema

## `query` (type: `string`):

What to search for, written as in the PubMed search box. Plain words are mapped to MeSH terms by PubMed; field tags and Boolean operators work too. Examples: machine learning radiology, asthma\[ti] AND children\[mh], "deep learning"\[tiab] NOT review\[pt].

## `dateFrom` (type: `string`):

Optional. Only records with a publication date on or after this date, format YYYY-MM-DD. Example: 2023-01-01.

## `dateTo` (type: `string`):

Optional. Only records with a publication date on or before this date, format YYYY-MM-DD. Example: 2023-12-31.

## `sort` (type: `string`):

Order of results. Default: Best match (PubMed relevance). Use Publication date to get the newest records first.

## `maxItems` (type: `integer`):

Stop after this many records. Default 100, maximum 10,000 (the E-utilities limit per search). Example: 500. You are charged per result.

## `ncbiApiKey` (type: `string`):

Optional. A free NCBI API key (a 36-character letters-and-digits string from your NCBI account settings) raises the request rate from 2 to 8 per second, so large runs finish faster. Stored as a secret. Leave empty to run without one.

## Actor input object example

```json
{
  "query": "machine learning radiology",
  "sort": "relevance",
  "maxItems": 10
}
```

# Actor output Schema

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

No description

# 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 = {
    "query": "machine learning radiology",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("plainpipe/pubmed-literature-search").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 = {
    "query": "machine learning radiology",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("plainpipe/pubmed-literature-search").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 '{
  "query": "machine learning radiology",
  "maxItems": 10
}' |
apify call plainpipe/pubmed-literature-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plainpipe/pubmed-literature-search"
        }
    }
}
```

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/cJTlzrXiJId54zvfB/builds/nSjxSVHHEmXONubv3/openapi.json
