# PubMed Scraper: Abstracts, MeSH Terms and Authors (`capable_coach/pubmed-search-scraper`) Actor

Search PubMed with the full query syntax and get PMID, DOI, title, structured abstract, authors, journal, MeSH terms and keywords as JSON, CSV or Excel. Official NCBI E-utilities, no key. Date filters, up to 1,000 papers per run, $1.50 per 1,000 papers.

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

## Pricing

from $1.50 / 1,000 pubmed papers

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

Search PubMed and download every matching paper as one clean JSON row: identifiers, abstract with its section labels, authors, journal and MeSH indexing terms.

### What you get

- PMID, DOI and PMC ID when PubMed has them.
- Title and abstract, with structured sections such as `BACKGROUND:` and `CONCLUSION:` kept, not flattened.
- Authors with count and first author; journal, abbreviation, ISSN, volume, issue and pages.
- Publication date, publication types, MeSH descriptors and author keywords.
- The canonical PubMed URL for each paper.

Real output shape (trimmed):

```json
{
  "recordType": "paper",
  "pmid": "30226337",
  "doi": null,
  "title": "A review of the non-equivalent control group post-test-only design.",
  "abstract": "BACKGROUND: Quantitative research designs are broadly classified as either experimental or quasi-experimental. … CONCLUSION: The non-equivalent control group post-test-only design can be used in natural settings…",
  "authors": ["Preetha Krishnan"],
  "journal": "Nurse researcher",
  "pubDate": "2019-09-21",
  "pubTypes": ["Journal Article", "Review"],
  "meshTerms": ["Control Groups", "Data Collection", "Nursing Research", "Research Design"],
  "url": "https://pubmed.ncbi.nlm.nih.gov/30226337/"
}
```

### Who it's for

- **Medical and life-science researchers** who need a literature corpus rather than a browser session.
- **Systematic-review teams** collecting titles, abstracts, MeSH terms and publication types for screening.
- **Medical writers** tracking a therapeutic area with a scheduled run sorted by date.
- **Data engineers** feeding a publications index or dashboard.

### How to use

1. Enter a `query` in the official PubMed syntax: `cancer immunotherapy`, `"CAR-T"[Title]`, `aspirin AND heart[MeSH Terms]`, `2025[dp]`.
2. Set `maxItems` (1 to 1,000), `sort` (`relevance` or `pub_date`, newest first) and optional `dateFrom` / `dateTo`.
3. Run it and export JSON, CSV or Excel. For a watch, schedule it with `sort: pub_date` and a rolling `dateFrom`.

Example input:

```json
{
  "query": "GLP-1 receptor agonist obesity",
  "maxItems": 20,
  "sort": "relevance",
  "includeAbstracts": true,
  "includeMesh": true
}
```

### Pricing

Pay per event, no subscription: **$0.0005 per run start** (one event per GB of memory, minimum one) plus **$0.0015 per paper** written to the dataset.

| Volume (Free plan) | Cost |
|---|---|
| 100 papers | $0.1505 |
| 1,000 papers | $1.5005 |

You pay for delivered rows only.

Set the run's *Maximum cost per run* in Apify to cap spending in advance.

### FAQ

**Do I need an API key?**
No. The actor uses the open NCBI E-utilities endpoints.

**Does it hit NCBI rate limits?**
Requests are serialised with a 400 ms pause, inside NCBI's 3 requests per second ceiling for anonymous traffic, so larger runs take proportionally longer.

**Can I use PubMed field tags and MeSH in the query?**
Yes. The query is sent in the official syntax: field tags, boolean operators, MeSH, author and date filters.

**What is `contactEmail` for?**
NCBI recommends identifying your traffic with a contact address. It is optional and only passed along with the requests.

**How is this different from calling the PubMed API myself?**
It runs the two-step search and fetch flow for you, parses the XML, normalises authors and dates, keeps abstract sections and handles throttling and export.

**Can I get the full text?**
No. Only what PubMed exposes: abstract, metadata and the PMC ID.

### Limits

- NCBI terms of use apply; the actor throttles but does not bypass quotas.
- Abstracts are null for a minority of records (editorials, errata).
- MeSH indexing arrives days after publication, so very recent papers may have no MeSH terms.
- At most 1,000 papers per run; use date windows for larger corpora.
- Not affiliated with NCBI or the U.S. National Library of Medicine.

# Changelog

This Actor's version history is a separate document: https://apify.com/capable_coach/pubmed-search-scraper/changelog.md

# Actor input Schema

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

Requete PubMed, syntaxe officielle acceptee (ex. cancer immunotherapy, "CAR-T"\[Title], aspirin AND heart\[MeSH Terms], 2025\[dp]).

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

Plafond d'articles recuperes pour cette requete.

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

Ordre des resultats renvoyes par PubMed.

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

Filtre optionnel sur la date de publication, format AAAA-MM-JJ.

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

Filtre optionnel sur la date de publication, format AAAA-MM-JJ.

## `includeAbstracts` (type: `boolean`):

Recupere le texte de l'abstract (peut etre vide pour certaines notices).

## `includeMesh` (type: `boolean`):

Ajoute les descripteurs MeSH indexes par la NLM.

## `contactEmail` (type: `string`):

Optionnel. NCBI recommande un email de contact pour identifier votre trafic E-utilities.

## Actor input object example

```json
{
  "query": "cancer immunotherapy",
  "maxItems": 100,
  "sort": "relevance",
  "includeAbstracts": true,
  "includeMesh": true
}
```

# Actor output Schema

## `papers` (type: `string`):

Une ligne par article PubMed : PMID, titre, abstract, auteurs, revue, DOI, MeSH.

## `overview` (type: `string`):

Tableau pret a lire dans la console Apify.

## `summary` (type: `string`):

Requete, nombre de resultats PubMed, articles ecrits, erreurs.

# 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": "cancer immunotherapy"
};

// Run the Actor and wait for it to finish
const run = await client.actor("capable_coach/pubmed-search-scraper").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": "cancer immunotherapy" }

# Run the Actor and wait for it to finish
run = client.actor("capable_coach/pubmed-search-scraper").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": "cancer immunotherapy"
}' |
apify call capable_coach/pubmed-search-scraper --silent --output-dataset

```

## MCP server setup

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

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/WwzcLgI3PXvjBWfxc/builds/3QgDrw2I3scdr9oVJ/openapi.json
