# ClinicalTrials.gov Studies & Biotech Pipeline API (`regenerative_cornice/clinicaltrials-gov-extractor`) Actor

Extract structured clinical trials from the official U.S. NIH ClinicalTrials.gov REST API v2. Filter by condition, drug/intervention, sponsor, recruitment status, phase, and country for biotech VCs, pharma intelligence, n8n workflows, and AI agents (MCP).

- **URL**: https://apify.com/regenerative_cornice/clinicaltrials-gov-extractor.md
- **Developed by:** [John Erlbacher](https://apify.com/regenerative_cornice) (community)
- **Categories:** Business, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.50 / 1,000 clinical trial extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## ClinicalTrials.gov Studies & Biotech Pipeline API

Extract clean, normalized clinical trial records directly from the official **U.S. National Institutes of Health (NIH) ClinicalTrials.gov REST API v2** (`https://clinicaltrials.gov/api/v2/studies`).

Built for **biotech venture capital & life-sciences investors, pharmaceutical competitive intelligence teams, clinical research organizations (CROs), patient recruitment platforms, automated n8n monitoring pipelines, and AI agents (MCP)**.

Because this Actor queries the official NIH ClinicalTrials.gov JSON API v2 rather than scraping brittle web pages, runs complete in seconds with **zero API key required, zero proxy costs, zero CAPTCHAs, and deterministic structured output**.

***

### Key Capabilities

- **Official NIH ClinicalTrials.gov v2 Coverage:** Access over 500,000 global clinical studies updated daily directly from the National Library of Medicine (NLM).
- **Precision Multi-Facet Filtering:** Filter by medical `condition`, drug or treatment `intervention`, pharmaceutical/academic `sponsor`, recruitment `status` (`RECRUITING`, `ACTIVE_NOT_RECRUITING`, `COMPLETED`, `NOT_YET_RECRUITING`, and more), trial `phase` (`EARLY_PHASE1`, `PHASE1`, `PHASE2`, `PHASE3`, `PHASE4`, `NA`), and study site `country`.
- **Freshest Updates First:** Automatically sorts matching studies by `LastUpdatePostDate:desc` and paginates smoothly using official `nextPageToken` cursors up to 1,000 studies per run.
- **Biotech-Ready Normalized Schema:** Flattens deeply nested `protocolSection` modules (`identificationModule`, `statusModule`, `sponsorCollaboratorsModule`, `designModule`, `conditionsModule`, `armsInterventionsModule`, `contactsLocationsModule`) into 16 clean fields ready for SQL warehouses, Airtable, Google Sheets, n8n, or LLM reasoning.
- **Built-In Resilience:** Gracefully handles empty result sets, deduplicates studies by `nctId`, and automatically backs off and retries transient HTTP `429` or `5xx` responses.

***

### Input Configuration

#### Example Input JSON

```json
{
  "condition": "oncology",
  "intervention": "pembrolizumab",
  "sponsor": "Merck",
  "status": "RECRUITING",
  "phase": "PHASE3",
  "country": "United States",
  "maxItems": 25
}
```

#### Input Parameters

| Field | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `condition` | `string` | `"oncology"` | Medical condition, disease, or therapeutic area (`query.cond`). Examples: `"oncology"`, `"Alzheimer disease"`, `"non-small cell lung cancer"`. Pass `""` to query exclusively by drug, sponsor, or country. |
| `intervention` | `string` | `""` | Optional drug, biologic, medical device, or treatment name (`query.intr`). Examples: `"pembrolizumab"`, `"semaglutide"`, `"CAR-T"`, `"mRNA"`. |
| `sponsor` | `string` | `""` | Optional lead sponsor or collaborator organization (`query.spons`). Examples: `"Pfizer"`, `"Moderna"`, `"Eli Lilly"`, `"National Cancer Institute"`. |
| `status` | `string` | `"RECRUITING"` | Recruitment status filter (`filter.overallStatus`): `ALL`, `RECRUITING`, `NOT_YET_RECRUITING`, `ACTIVE_NOT_RECRUITING`, `COMPLETED`, `ENROLLING_BY_INVITATION`, `SUSPENDED`, `TERMINATED`, or `WITHDRAWN`. |
| `phase` | `string` | `"ALL"` | Clinical trial phase filter (`AREA[Phase]`): `ALL`, `EARLY_PHASE1`, `PHASE1`, `PHASE2`, `PHASE3`, `PHASE4`, or `NA`. |
| `country` | `string` | `""` | Optional clinical trial site country (`AREA[LocationCountry]`). Examples: `"United States"`, `"Germany"`, `"United Kingdom"`, `"Japan"`. |
| `maxItems` | `integer` | `15` | Maximum number of clinical trials to return (`1`–`1000`), paginated automatically in chunks of 100. |

Running with empty input `{}` automatically extracts the 15 most recently updated **Recruiting Oncology** studies so you can verify output structure immediately.

***

### Normalized Output Schema

Every dataset record contains the same 16 consistent fields:

#### Example Output JSON

```json
{
  "nctId": "NCT06953076",
  "briefTitle": "Phase 3 Study of EIK1001 and Pembrolizumab With Chemotherapy in Stage 4 NSCLC",
  "officialTitle": "A Phase 2/3 Randomized, Double-Blind, Placebo-Controlled Study of EIK1001 in Combination With Pembrolizumab and Standard of Care Chemotherapy in Patients With Stage 4 Non-Small Cell Lung Cancer",
  "overallStatus": "RECRUITING",
  "phases": ["PHASE2", "PHASE3"],
  "studyType": "INTERVENTIONAL",
  "leadSponsor": "Eikon Therapeutics",
  "sponsorClass": "INDUSTRY",
  "conditions": [
    "Non Small Cell Lung Cancer (Squamous or Non Squamous)",
    "Stage 4 NSCLC"
  ],
  "interventions": [
    "DRUG: EIK1001",
    "DRUG: Pembrolizumab (KEYTRUDA®)",
    "DRUG: Placebo",
    "DRUG: Paclitaxel + Carboplatin"
  ],
  "enrollmentCount": 750,
  "startDate": "2025-05-02",
  "primaryCompletionDate": "2026-11-30",
  "locationsCount": 64,
  "countries": ["Canada", "Germany", "United States"],
  "studyUrl": "https://clinicaltrials.gov/study/NCT06953076"
}
```

#### Field Reference

| Field | Type | Description |
| :--- | :--- | :--- |
| `nctId` | `string` | Canonical National Clinical Trial identifier (e.g., `NCT06953076`). |
| `briefTitle` | `string` | Public summary title of the study. |
| `officialTitle` | `string` | Full scientific protocol title. |
| `overallStatus` | `string` | Current recruitment status (`RECRUITING`, `ACTIVE_NOT_RECRUITING`, `COMPLETED`, etc.). |
| `phases` | `string[]` | Trial phase list (`["PHASE1"]`, `["PHASE2", "PHASE3"]`, `["NA"]`, or `[]`). |
| `studyType` | `string` | Study classification (`INTERVENTIONAL`, `OBSERVATIONAL`, `EXPANDED_ACCESS`). |
| `leadSponsor` | `string` | Primary sponsoring company, university, hospital, or government institute. |
| `sponsorClass` | `string` | Sponsor category (`INDUSTRY`, `NIH`, `OTHER`, `FED`, `NETWORK`, `OTHER_GOV`, `INDIV`). |
| `conditions` | `string[]` | Deduplicated list of targeted conditions and indications. |
| `interventions` | `string[]` | Deduplicated list of treatments formatted as `TYPE: Name` (e.g., `DRUG: Pembrolizumab`). |
| `enrollmentCount` | `integer \| null` | Actual or estimated participant enrollment count. |
| `startDate` | `string` | Study start date (`YYYY-MM-DD` or `YYYY-MM`). |
| `primaryCompletionDate` | `string` | Primary outcome completion date (`YYYY-MM-DD` or `YYYY-MM`) — key catalyst date for biotech investors. |
| `locationsCount` | `integer` | Total count of registered clinical trial sites. |
| `countries` | `string[]` | Sorted unique countries with active or registered sites. |
| `studyUrl` | `string` | Direct permalink to the official study page on `https://clinicaltrials.gov/study/<nctId>`. |

***

### Pay-Per-Event Pricing (`trial-extracted`)

This Actor uses transparent **Apify Pay-Per-Event (PPE)** billing so you only pay for delivered study records:

- **Event name:** `trial-extracted` — charged once per normalized study pushed to the dataset, protected by a deterministic idempotency key (`nct-<nctId>`).
- **Zero-match queries cost $0 in event fees** when no studies match your filters.
- **Automatic spend-cap enforcement:** Checks `event_charge_limit_reached` on every study and exits cleanly the moment your configured run budget is reached.

***

### Automate Biotech Pipeline Monitoring in n8n

Build an automated **Weekly Phase 3 Catalyst & Competitor Tracker** in n8n:

1. **Schedule Trigger** — Run every Monday at 07:00 AM.
2. **HTTP Request (Apify Run-Sync Dataset Items)** — `POST` to:
   ```text
   https://api.apify.com/v2/acts/<YOUR_USERNAME>~clinicaltrials-gov-extractor/run-sync-get-dataset-items?token={{$env.APIFY_TOKEN}}
   ```
   JSON Body:
   ```json
   {
     "condition": "obesity",
     "intervention": "GLP-1",
     "status": "RECRUITING",
     "phase": "PHASE3",
     "country": "United States",
     "maxItems": 30
   }
   ```
3. **Airtable / Slack / Webhook Node** — Upsert rows keyed on `{{ $json.nctId }}` or alert your investment team on upcoming `{{ $json.primaryCompletionDate }}` readouts, `{{ $json.enrollmentCount }}` targets, and `{{ $json.leadSponsor }}` activity.

***

### Use with AI Agents & Model Context Protocol (MCP)

Connect this Actor directly to **Claude Desktop, Cursor, Windsurf, or custom LangGraph / OpenAI agents** using the official Apify MCP Server so AI analysts can query live NIH clinical trial registries in real time:

```json
{
  "mcpServers": {
    "apify-clinicaltrials": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server",
        "--actors",
        "<YOUR_USERNAME>/clinicaltrials-gov-extractor"
      ],
      "env": {
        "APIFY_TOKEN": "<YOUR_APIFY_API_TOKEN>"
      }
    }
  }
}
```

**Example Agent Prompts:**

- *"Find 20 recruiting Phase 3 oncology clinical trials in the United States sponsored by industry and rank them by enrollment size and primary completion date."*
- *"Pull active and recruiting clinical trials testing semaglutide or tirzepatide and compare lead sponsors, trial phases, and global site counts."*
- *"Monitor completed Phase 2 Alzheimer's disease trials and summarize all interventions tested alongside their sponsor classes and direct ClinicalTrials.gov URLs."*

***

### Data Source & Compliance Notice

All study records are retrieved directly from the public **U.S. National Library of Medicine ClinicalTrials.gov REST API v2** (`https://clinicaltrials.gov/api/v2/studies`). ClinicalTrials.gov data is provided for informational, research, and competitive intelligence purposes only and does not constitute medical advice or clinical guidance.

# Actor input Schema

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

Medical condition, therapeutic area, or disease term to search (mapped to ClinicalTrials.gov query.cond). Examples: "oncology", "non-small cell lung cancer", "Alzheimer disease", "type 2 diabetes". Leave empty to search solely by drug, sponsor, or country.

## `intervention` (type: `string`):

Optional drug, biologic, medical device, or treatment intervention name (mapped to query.intr). Examples: "pembrolizumab", "GLP-1", "CAR-T", "semaglutide".

## `sponsor` (type: `string`):

Optional pharmaceutical company, biotech sponsor, or academic institution name (mapped to query.spons). Examples: "Pfizer", "Merck", "Moderna", "Eli Lilly", "National Cancer Institute".

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

Filter studies by ClinicalTrials.gov overall recruitment status (mapped to filter.overallStatus).

## `phase` (type: `string`):

Optional clinical trial phase filter (mapped to AREA\[Phase] in filter.advanced).

## `country` (type: `string`):

Optional country where at least one clinical study site is located (mapped to AREA\[LocationCountry] in filter.advanced). Examples: "United States", "Germany", "United Kingdom", "Japan".

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

Maximum number of clinical trial records to extract (1 to 1000), sorted by most recently updated first.

## Actor input object example

```json
{
  "condition": "oncology",
  "intervention": "",
  "sponsor": "",
  "status": "RECRUITING",
  "phase": "ALL",
  "country": "",
  "maxItems": 15
}
```

# Actor output Schema

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

Structured overview table of extracted clinical trials.

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

All extracted clinical trial records in the default dataset.

# 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": "oncology",
    "intervention": "",
    "sponsor": "",
    "status": "RECRUITING",
    "phase": "ALL",
    "country": "",
    "maxItems": 15
};

// Run the Actor and wait for it to finish
const run = await client.actor("regenerative_cornice/clinicaltrials-gov-extractor").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": "oncology",
    "intervention": "",
    "sponsor": "",
    "status": "RECRUITING",
    "phase": "ALL",
    "country": "",
    "maxItems": 15,
}

# Run the Actor and wait for it to finish
run = client.actor("regenerative_cornice/clinicaltrials-gov-extractor").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": "oncology",
  "intervention": "",
  "sponsor": "",
  "status": "RECRUITING",
  "phase": "ALL",
  "country": "",
  "maxItems": 15
}' |
apify call regenerative_cornice/clinicaltrials-gov-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,regenerative_cornice/clinicaltrials-gov-extractor"
        }
    }
}
```

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/xJdt0ZVxyHPgG01je/builds/2ZFw9erj68Z7b4PgL/openapi.json
