# ClinicalTrials.gov Scraper (`devilscrapes/clinicaltrials-gov-scraper`) Actor

Search ClinicalTrials.gov and export structured trial records — NCT ID, title, phase, status, sponsor, conditions, interventions, enrollment, locations, and start/completion dates — as clean JSON, CSV or Excel.

- **URL**: https://apify.com/devilscrapes/clinicaltrials-gov-scraper.md
- **Developed by:** [DevilScrapes](https://apify.com/devilscrapes) (community)
- **Categories:** Other, Developer tools
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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/platform/actors/running/actors-in-store#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

<div align="center">
  <img src=".actor/icon.svg" width="160" alt="Devil Scrapes mark" />

## ClinicalTrials.gov Scraper

**💰 $2.05 / 1 000 results**  ·  pay only for results  ·  no credit card to try

*We do the dirty work so your dataset stays clean.* 😈

Search ClinicalTrials.gov and export structured trial records — NCT ID, title, phase, status, sponsor, conditions, interventions, enrollment, locations, and start/completion dates — as clean JSON, CSV or Excel.

</div>

***

### 🎯 What this scrapes

ClinicalTrials.gov holds the registry every pharma, CRO and biotech competitive-intel team works from, and its API v2 returns deeply nested JSON that is painful to flatten by hand. This Actor wraps it with a plain input form and hands back one flat row per trial, so you can pull a therapeutic-area landscape into a spreadsheet without writing a parser.

### 🔥 What we handle for you

pages the registry's cursor-based API and stops exactly on your result cap
flattens deeply nested protocol sections into one predictable row per trial
retries transient registry 5xx responses instead of failing the whole run

### 💡 Use cases

- Map the competitive landscape for a therapeutic area before a portfolio review.
- Track which sponsors are recruiting for a condition, and where.
- Build a site-selection shortlist from countries already running comparable trials.
- Monitor status changes on a watchlist of trials without checking the registry by hand.

### ⚙️ How to use it

1. Click **Try for free** at the top of the page.
2. Fill in the input form — most fields have sensible defaults.
3. Click **Start**. Output streams into the run's dataset.
4. Export from **Storage → Dataset** as JSON, CSV, or Excel — or fetch via the API.

### 📥 Input

| Field | Type | Required | Default | Notes |
|---|---|:--:|---|---|
| `condition` | `string` | no | 'type 2 diabetes' | Condition, disease or therapeutic area to search for. Maps to the registry's <code>query.cond</code> field. Example:… |
| `searchTerm` | `string` | no | '—' | Free-text terms matched across the whole record (<code>query.term</code>) — sponsor names, drug names, keywords. Leave… |
| `phases` | `array` | no | \[] | Restrict to these phases. Valid values: <code>EARLY\_PHASE1</code>, <code>PHASE1</code>, <code>PHASE2</code>,… |
| `overallStatus` | `array` | no | \[] | Restrict to these statuses, e.g. <code>RECRUITING</code>, <code>COMPLETED</code>, <code>TERMINATED</code>. Leave empty… |
| `maxResults` | `integer` | no | 100 | Stop after this many trials. Each trial is one billed result row. |
| `proxyConfiguration` | `object` | no | {'useApifyProxy': False} | ClinicalTrials.gov is a public government API and does not need a proxy. Leave this off unless your account requires… |

#### Example input

```json
{
  "condition": "type 2 diabetes",
  "maxResults": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

### 📤 Output

Every row is one dataset item.

| Field | Type | Notes |
|---|---|---|
| `nct_id` | `string` | Registry identifier, e.g. `NCT01234567`. |
| `url` | `string` | Public study page URL. |
| `brief_title` | `string` | Short study title. |
| `official_title` | `string` | Full official title, when present. |
| `overall_status` | `string` | Recruitment status, e.g. `RECRUITING`. |
| `phases` | `array` | Trial phases as reported by the registry. |
| `study_type` | `string` | `INTERVENTIONAL`, `OBSERVATIONAL`, or `EXPANDED_ACCESS`. |
| `lead_sponsor` | `string` | Lead sponsor organisation name. |
| `conditions` | `array` | Conditions studied. |
| `interventions` | `array` | Intervention names. |
| `enrollment_count` | `integer` | Enrollment, actual or estimated. |
| `start_date` | `string` | Study start date as published (`YYYY-MM` or `YYYY-MM-DD`). |
| `primary_completion_date` | `string` | Primary completion date as published. |
| `location_countries` | `array` | Distinct countries with a listed site. |
| `brief_summary` | `string` | Plain-language study summary. |

#### Example output

```json
{}
```

### 💰 Pricing

Pay-Per-Event — you pay only when these events fire:

| Event | USD | What it is |
|---|---:|---|
| `actor-start` | $0.05 | One-off warm-up charge per run |
| `result` | $0.002 | Per dataset item |

Example: 1 000 results at the rates above ≈ **$2.05**. No subscription, no minimum, no card to start — Apify gives every new account $5 of free credit.

### 🚧 Limitations

- Returns registry data only — it does not scrape linked publications or results tables.
- Date fields are passed through exactly as the registry publishes them, which may be a month (`2026-03`) rather than a full date.

### ❓ FAQ

**Do I need an API key?**

No. ClinicalTrials.gov API v2 is public and keyless, so a run needs no credentials from you.

**How fresh is the data?**

It comes straight from the live registry at run time — whatever the registry shows, the run returns.

**Can I get every trial for a condition?**

Yes. Raise <b>Maximum trials</b>; the Actor pages through results until the registry runs out or your limit is reached.

### 💬 Your feedback

Spotted a bug, hit a weird edge case, or need a new field? Open an
issue on the Actor's **Issues** tab on Apify Console — we ship
fixes weekly and we read every report.

***

<div align="center">

Built by **[Devil Scrapes](https://apify.com/DevilScrapes)** 😈 — a small fleet of
opinionated public-data Actors. Honest pricing, real engineering, zero fine print.

</div>

# Actor input Schema

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

Condition, disease or therapeutic area to search for. Maps to the registry's <code>query.cond</code> field. Example: <code>type 2 diabetes</code>.

## `searchTerm` (type: `string`):

Free-text terms matched across the whole record (<code>query.term</code>) — sponsor names, drug names, keywords. Leave empty to search by condition only.

## `phases` (type: `array`):

Restrict to these phases. Valid values: <code>EARLY\_PHASE1</code>, <code>PHASE1</code>, <code>PHASE2</code>, <code>PHASE3</code>, <code>PHASE4</code>, <code>NA</code>. Leave empty for every phase.

## `overallStatus` (type: `array`):

Restrict to these statuses, e.g. <code>RECRUITING</code>, <code>COMPLETED</code>, <code>TERMINATED</code>. Leave empty for every status.

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

Stop after this many trials. Each trial is one billed result row.

## `proxyConfiguration` (type: `object`):

ClinicalTrials.gov is a public government API and does not need a proxy. Leave this off unless your account requires egress through Apify Proxy.

## Actor input object example

```json
{
  "condition": "non-small cell lung cancer",
  "phases": [],
  "overallStatus": [],
  "maxResults": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `datasetItems` (type: `string`):

All dataset items as JSON.

## `datasetItemsCsv` (type: `string`):

Same data exported to CSV.

## `datasetView` (type: `string`):

Open the run dataset in the Console.

# 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": "type 2 diabetes",
    "phases": [],
    "overallStatus": [],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("devilscrapes/clinicaltrials-gov-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": "type 2 diabetes",
    "phases": [],
    "overallStatus": [],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("devilscrapes/clinicaltrials-gov-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": "type 2 diabetes",
  "phases": [],
  "overallStatus": [],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call devilscrapes/clinicaltrials-gov-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devilscrapes/clinicaltrials-gov-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/QrU8HfeOXlrdDVDHG/builds/FHydINmObpi7phiFw/openapi.json
