# PubMed Search Scraper (`daftvader/pubmed-search-scraper`) Actor

Search PubMed and export structured article metadata.

- **URL**: https://apify.com/daftvader/pubmed-search-scraper.md
- **Developed by:** [Sam Towers](https://apify.com/daftvader) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 apify-default-dataset-items

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 Scraper

Turn a PubMed search into a clean, exportable dataset of article metadata. Enter a topic or a full PubMed search expression and receive one structured record for each unique usable article found.

### What you can use it for

- Build literature-review and research-monitoring datasets.
- Collect article titles, authors, journals, publication dates, DOIs, and PubMed links for analysis.
- Export PubMed search results to JSON, CSV, Excel, XML, or another Apify dataset format.
- Feed structured bibliographic records into data pipelines through the Apify API, schedules, or integrations.

### Input

The only required field is `query`. It accepts the same kind of search expression you would enter in PubMed.

```json
{"query":"CRISPR","max_results":100,"page_size":100,"batch_size":100}
```

| Field | Description | Default |
| --- | --- | ---: |
| `query` | PubMed keyword or search expression. | Required |
| `max_results` | Maximum number of search hits to inspect. | `100` |
| `page_size` | IDs requested from PubMed per search page. | `100` |
| `batch_size` | Summaries requested together; maximum 200. | `100` |
| `timeout_seconds` | Timeout for each NCBI request. | `20` |
| `retries` | Retries for transient request failures. | `3` |

### Output

Each unique usable article is written to the default dataset.

```json
{"pmid":"12345678","title":"Example article title","authors":["A. Researcher"],"journal":"Example Journal","publicationDate":"2026 Jan","doi":"10.1000/example","pubmedUrl":"https://pubmed.ncbi.nlm.nih.gov/12345678/"}
```

Records with an unavailable summary, mismatched PubMed identifier, or empty title are omitted. Duplicate PMIDs are emitted only once, including when PubMed pages overlap or a run is resurrected.

### Pricing

- **$0.0009 per PubMed article** written to the default dataset ($0.90 per 1,000 articles).
- **$0.00005 per Actor start.**

Search hits that do not produce a usable dataset record are not charged as article results. The run spending limit is respected; collection stops when no further article event fits within it.

### Limits and responsible use

The Actor reads NCBI's public E-utilities service. NCBI can throttle requests, so transient failures are retried with bounded backoff. Very broad searches may take longer, and results depend on the metadata currently returned by PubMed. Use the data in accordance with NCBI's policies and the terms that apply to your downstream use.

### Support

If a run fails unexpectedly, open an issue from the Actor's Apify page and include the run ID, input (with sensitive values removed), and the relevant log excerpt.

# Actor input Schema

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

A PubMed search expression, such as CRISPR or cancer AND immunotherapy.

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

Maximum number of PubMed search hits to inspect.

## `page_size` (type: `integer`):

PubMed IDs requested per search page.

## `batch_size` (type: `integer`):

Article summaries requested per API call.

## `timeout_seconds` (type: `number`):

Timeout for each NCBI request in seconds.

## `retries` (type: `integer`):

Retries for transient NCBI request failures.

## Actor input object example

```json
{
  "query": "CRISPR",
  "max_results": 3,
  "page_size": 3,
  "batch_size": 3,
  "timeout_seconds": 20,
  "retries": 3
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (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": "CRISPR",
    "max_results": 3,
    "page_size": 3,
    "batch_size": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("daftvader/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": "CRISPR",
    "max_results": 3,
    "page_size": 3,
    "batch_size": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("daftvader/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": "CRISPR",
  "max_results": 3,
  "page_size": 3,
  "batch_size": 3
}' |
apify call daftvader/pubmed-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,daftvader/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/KqD52wiVJlGEbqCzq/builds/2DlUX4XmbWHR9YORQ/openapi.json
