# ClinicalTrials.gov Scraper — Trial Pipeline for Pharma (`azureblue/clinical-trials-scraper`) Actor

Scrape ClinicalTrials.gov for clinical studies by condition and status. Returns NCT ID, title, phase, sponsor, enrollment count, start date, and direct URL.

- **URL**: https://apify.com/azureblue/clinical-trials-scraper.md
- **Developed by:** [azureblue](https://apify.com/azureblue) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$8.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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## ClinicalTrials.gov Active Trials Scraper

**Search ClinicalTrials.gov by condition and status — returns structured JSON with NCT IDs, phases, sponsors, and enrollment numbers.**

Query the world's largest clinical trial registry with 500,000+ studies. Filter by disease, recruitment status, and result count. No API key required — uses the official ClinicalTrials.gov v2 REST API.

***

### What does this Actor do?

This Actor queries the ClinicalTrials.gov v2 API and returns structured records for each matching trial: NCT identifier, title, condition, trial phase, lead sponsor, enrollment count, start date, and a direct link to the trial page.

***

### Use Cases

#### 1. Drug Development Pipeline Intelligence

A biotech analyst tracks all recruiting Phase 3 trials for a specific indication: `condition: "non-small cell lung cancer"`, `status: "recruiting"`. The output feeds a competitive intelligence dashboard that alerts the team when new sponsored trials are announced.

#### 2. Patient Recruitment Research

A hospital research coordinator looks for all currently recruiting trials at their institution by searching `condition: "heart failure"`, `status: "recruiting"`, `maxResults: 200`. They cross-reference the NCT IDs with their patient database to identify eligible participants.

#### 3. Academic Systematic Review

A medical student writing a thesis on immunotherapy needs all completed Phase 2 and 3 trials: `condition: "checkpoint inhibitor melanoma"`, `status: "completed"`. The structured JSON output (NCT ID, sponsor, enrollment, dates) is imported directly into their reference manager.

***

### Input

| Field        | Type    | Required | Default | Description                                       |
|--------------|---------|----------|---------|---------------------------------------------------|
| `condition`  | String  | ✅ Yes   | —       | Disease or medical condition to search            |
| `status`     | Enum    | No       | `all`   | `all`, `recruiting`, `completed`, `not_yet`, `active` |
| `maxResults` | Integer | No       | `50`    | Maximum results to return (1–10,000)              |

#### Example Input

```json
{
  "condition": "type 2 diabetes insulin resistance",
  "status": "recruiting",
  "maxResults": 100
}
```

***

### Output

```json
{
  "nctId": "NCT05123456",
  "title": "Effect of Empagliflozin on Insulin Resistance in Type 2 Diabetes",
  "condition": "Type 2 Diabetes Mellitus; Insulin Resistance",
  "status": "RECRUITING",
  "phase": "PHASE3",
  "sponsor": "Boehringer Ingelheim",
  "startDate": "2023-06",
  "completionDate": "2026-12",
  "enrollmentCount": 450,
  "url": "https://clinicaltrials.gov/study/NCT05123456"
}
```

***

### Pricing

**$0.008 per trial record.**

| Volume       | Estimated Cost |
|--------------|----------------|
| 50 results   | ~$0.40         |
| 500 results  | ~$4.00         |
| 5,000 results | ~$40.00       |

***

### Technical Details

- **Data source**: ClinicalTrials.gov v2 REST API (official, public)
- **Rate limiting**: 1 request / 2 seconds
- **Retry logic**: 3 retries with exponential backoff
- **Pagination**: automatic via `nextPageToken`
- **Node.js**: v22 LTS

# Actor input Schema

## `condition` (type: `string`):

Disease, condition, or medical term to search for. Example: 'diabetes type 2' or 'lung cancer'.

## `status` (type: `string`):

Filter trials by recruitment status.

## `maxResults` (type: `integer`):

Maximum number of trials to return (1–10,000).

## Actor input object example

```json
{
  "condition": "diabetes type 2",
  "status": "all",
  "maxResults": 50
}
```

# Actor output Schema

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

Open the run's default dataset to view, filter and export the scraped items.

# 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 = {
    "condition": "diabetes type 2"
};

// Run the Actor and wait for it to finish
const run = await client.actor("azureblue/clinical-trials-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 = { "condition": "diabetes type 2" }

# Run the Actor and wait for it to finish
run = client.actor("azureblue/clinical-trials-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 '{
  "condition": "diabetes type 2"
}' |
apify call azureblue/clinical-trials-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,azureblue/clinical-trials-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/QlFG6rTKDi8igSwuz/builds/5q9qlyBLqCvoQXkL5/openapi.json
