# Clinical Trials from ClinicalTrials.gov: Search and Export (`forgeloop/clinical-trials`) Actor

Search and export clinical trials from the official ClinicalTrials.gov API by condition, drug, sponsor, location, status, phase, study type and start date, or by NCT ID. Status, phases, sponsors, dates, enrollment, sites and countries. Pay per trial.

- **URL**: https://apify.com/forgeloop/clinical-trials.md
- **Developed by:** [Markus Heiß](https://apify.com/forgeloop) (community)
- **Categories:** AI, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 trial exporteds

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

## Clinical Trials from ClinicalTrials.gov: Search and Export

Search and export clinical trials from ClinicalTrials.gov. Enter a condition, a drug or other intervention, a sponsor or a location, filter by recruitment status, phase, study type and start date, and get one row per trial with the status, phases, conditions, interventions, sponsor, collaborators, key dates, enrollment, a short summary, the trial sites and the countries. Or list NCT IDs and fetch these trials directly.

Built for pharma and biotech market research, competitive intelligence, site and country planning, AI agents and RAG pipelines. The Actor reads the official free ClinicalTrials.gov API v2. It does not export contact persons, investigators, emails or phone numbers.

Not affiliated with the U.S. National Library of Medicine or NIH. All trial data comes from [ClinicalTrials.gov](https://clinicaltrials.gov). The data is not medical advice.

### What it does

- **Searches ClinicalTrials.gov** by condition, intervention, other terms, sponsor or collaborator and location. The search fields accept the ClinicalTrials.gov search syntax, so `AND`, `OR`, `NOT`, quotes and brackets work.
- **Filters** by overall status (recruiting, completed, terminated and more), phase (early phase 1 to phase 4), study type (interventional, observational, expanded access) and start date range.
- **Fetches by NCT ID:** list up to 10,000 IDs like `NCT04086082`. Old IDs that were merged into another record are resolved to the current trial.
- **Sorts** by relevance, last update, start date or enrollment.
- **Exports the trial sites:** the number of sites, all countries and up to 50 sites with facility, city and country.
- **Summary** in the key-value store: total matching trials, trials per status and the top countries.
- **Polite with the API:** one request at a time, at most one request every 2 seconds, backoff on HTTP 429 and 5xx, and a clean stop when the service stays down.

### Use cases

- **Competitive intelligence:** list all recruiting phase 3 trials for a condition or a drug class and see who sponsors them.
- **Pipeline tracking:** schedule the Actor weekly with a sponsor and the sort "Last update" to catch new trials and status changes.
- **Site and country planning:** see in which countries and cities trials for an indication run, and how many sites they have.
- **AI agents and RAG pipelines:** give an agent structured trial records with stable NCT IDs and links to the official record.
- **Literature and evidence work:** export completed trials with results for a condition as a starting list.

### Input

| Field | Description | Default |
|---|---|---|
| Condition or disease | Like `lung cancer` or `(head OR neck) AND pain` | |
| Intervention or treatment | Drug, device or procedure, like `pembrolizumab` | |
| Other terms | Free text across the whole record | |
| Sponsor or collaborator | Like `Pfizer` or `National Cancer Institute` | |
| Location | City, state, country or facility, like `Germany` | |
| Overall status | Any of the ClinicalTrials.gov statuses, like Recruiting or Completed | all |
| Phase | Early phase 1, Phase 1 to 4, Not applicable | all |
| Study type | Interventional, Observational, Expanded access | all |
| Start date from, Start date to | Start date range of the trial | all |
| NCT IDs | Fetch these trials directly. The search fields are then ignored. | |
| Max trials | 1 to 10,000 | 50 |
| Sort by | Relevance, last update, start date (newest or oldest first), enrollment | relevance |

At least one search field, filter or NCT ID is needed.

Example, recruiting phase 2 and phase 3 trials for type 2 diabetes with sites in Germany that started since 2024:

```json
{
  "condition": "type 2 diabetes",
  "location": "Germany",
  "overallStatus": ["RECRUITING"],
  "phases": ["PHASE2", "PHASE3"],
  "startDateFrom": "2024-01-01",
  "maxTrials": 200
}
```

Example, three trials by NCT ID:

```json
{
  "nctIds": ["NCT04086082", "NCT06411210", "NCT00000102"]
}
```

### Output

One dataset item per trial:

```json
{
  "nctId": "NCT06411210",
  "title": "Obesity Complicating Type 1 Diabetes: GLP-1 Analogue Anti-obesity Treatment",
  "officialTitle": "Obesity Complicating Type 1 Diabetes in Young Adults: Physiology and Impact of GLP-1 Analogue Anti-obesity Treatment on Cardiometabolic Risk Factors",
  "acronym": null,
  "overallStatus": "RECRUITING",
  "phases": ["PHASE2"],
  "studyType": "INTERVENTIONAL",
  "conditions": ["Diabetes type1", "Obesity"],
  "interventions": [
    { "type": "DRUG", "name": "Semaglutide Pen Injector" },
    { "type": "DRUG", "name": "Placebo" }
  ],
  "leadSponsor": "Yale University",
  "leadSponsorClass": "OTHER",
  "collaborators": ["National Institute of Diabetes and Digestive and Kidney Diseases (NIDDK)", "Novo Nordisk A/S"],
  "startDate": "2024-07-16",
  "primaryCompletionDate": "2028-04-30",
  "completionDate": "2028-06-30",
  "enrollment": 54,
  "enrollmentType": "ESTIMATED",
  "hasResults": false,
  "briefSummary": "More than 40% of young adults with type 1 diabetes (T1D) also have overweight or obesity...",
  "locationCount": 1,
  "countries": ["United States"],
  "locations": [
    { "facility": "Yale Pediatric Diabetes Center", "city": "New Haven", "country": "United States" }
  ],
  "lastUpdate": "2026-08-04",
  "url": "https://clinicaltrials.gov/study/NCT06411210",
  "query": "condition \"diabetes\", status RECRUITING",
  "error": null
}
```

- `nctId` is the ClinicalTrials.gov identifier. `url` opens the official record.
- `overallStatus`, `phases`, `studyType` and the intervention `type` use the API values, like `ACTIVE_NOT_RECRUITING`, `PHASE2` or `DRUG`.
- Dates are as registered. Some are only a month, like `2028-12`. Future dates are estimates.
- `enrollment` is the planned (`ESTIMATED`) or final (`ACTUAL`) number of participants, see `enrollmentType`.
- `briefSummary` is trimmed to about 1,000 characters.
- `leadSponsorClass` is `INDUSTRY`, `NIH`, `FED`, `OTHER_GOV`, `NETWORK`, `OTHER`, `INDIV` or `UNKNOWN`. For individual sponsors (`INDIV`) the name is left out, because it is often a person. Collaborators of that class are left out too.
- `locationCount` and `countries` cover all sites. `locations` holds the first 50.
- `query` is the search as the Actor ran it, or the NCT ID you entered.
- A search without matches, an invalid or unknown NCT ID and errors return one free item with `error` set, for example `No study with this NCT ID on ClinicalTrials.gov.`

Export the dataset as JSON, CSV or Excel, or read it through the Apify API.

### Pricing

Pay per trial: 0.001 USD per exported trial, so 1 USD per 1,000 trials. Searches without matches, invalid IDs and errors are free. Set Max trials or the maximum charge in Apify to cap the cost of a run.

Each run also has a start fee of 0.00005 USD per GB of memory, which Apify shows as Actor Start.

### Limits

- The Actor sends at most one request every 2 seconds and reads up to 200 trials per request. 1,000 trials take about 15 seconds, 10,000 about 2 minutes.
- At most 10,000 trials and 10,000 NCT IDs per run. Split larger exports by date range or status.
- When NCT IDs are given, all search fields and filters are ignored. The same holds in the API when a search field holds only NCT IDs.
- A trial with several phases (phase 1/2) matches each of them.
- A search text with a syntax error, like an unbalanced bracket, returns a free error item with the message from ClinicalTrials.gov.
- No contact persons, investigators, officials, emails or phone numbers are exported. Site facility names are exported as registered.
- Not exported: eligibility criteria, outcome measures, arms and results data.

### Data source, permitted use and legal

- **Data source:** [ClinicalTrials.gov](https://clinicaltrials.gov), read through the public [ClinicalTrials.gov API v2](https://clinicaltrials.gov/data-api/api). ClinicalTrials.gov is run by the U.S. National Library of Medicine. This Actor is not affiliated with or endorsed by the National Library of Medicine, NIH or HHS.
- **No medical advice:** The data describes registered studies as reported by their sponsors. It is not medical advice and not a recommendation to join a trial. Talk to a doctor before any health decision.
- **Snapshot:** Results show ClinicalTrials.gov at the time of the run. We do not guarantee that they are complete, current or correct. Sponsors update their records, and NLM does not verify all of them.
- **For business use:** This Actor is offered to businesses only, not to consumers.
- **Permitted use:** Use the data in line with the [ClinicalTrials.gov terms and conditions](https://clinicaltrials.gov/about-site/terms-conditions) and the [disclaimer](https://clinicaltrials.gov/about-site/disclaimer). Name ClinicalTrials.gov as the source, and do not suggest that NLM endorses your product.
- **Your responsibility:** You choose the searches and decide what happens with the results. If your input or the results contain personal data, you are the controller and need your own legal basis.
- **No circumvention:** The Actor uses public, unauthenticated endpoints only. It does not bypass rate limits, blocks or access restrictions.
- **Request volume:** One request at a time, at most one request every 2 seconds for the whole run (ClinicalTrials.gov allows about 50 per minute per IP), exponential backoff on HTTP 429 and 5xx, and it stops when the service stays down. Do not use it to put excessive load on ClinicalTrials.gov.
- **Provider:** forgeloop, Markus Heiss, Austria. [Imprint](https://devhem.github.io/forgeloop-legal/imprint.html), [Privacy Notice](https://devhem.github.io/forgeloop-legal/privacy.html), [Terms of Use](https://devhem.github.io/forgeloop-legal/terms.html).

### Questions and issues

Open an issue on the Actor page.

# Actor input Schema

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

Condition or disease, like lung cancer, type 2 diabetes or (head OR neck) AND pain. Uses the ClinicalTrials.gov search syntax, so AND, OR, NOT and quotes work.

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

Drug, device, procedure or other intervention, like pembrolizumab, semaglutide or radiotherapy.

## `term` (type: `string`):

Free text searched across the whole record, like a keyword, an organization study ID or AREA\[LastUpdatePostDate]RANGE\[2026-01-01,MAX].

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

Lead sponsor or collaborator, like Pfizer, National Cancer Institute or Mayo Clinic.

## `location` (type: `string`):

City, state, country or facility of a trial site, like Germany, Boston or Charite.

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

Keep only trials with one of these recruitment statuses. Empty keeps all.

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

Keep only trials in one of these phases. A phase 1/2 trial matches both Phase 1 and Phase 2. Empty keeps all.

## `studyType` (type: `string`):

Keep only interventional trials, observational studies or expanded access records. Empty keeps all.

## `startDateFrom` (type: `string`):

Keep only trials that start (or started) on or after this date.

## `startDateTo` (type: `string`):

Keep only trials that start (or started) on or before this date.

## `nctIds` (type: `array`):

Fetch these trials directly, like NCT04086082. When set, the search fields above are ignored. Invalid or unknown IDs return a free error item.

## `maxTrials` (type: `integer`):

Stop after this many trials. Every trial is one charged result, so this also caps the cost.

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

Order of the exported trials.

## Actor input object example

```json
{
  "condition": "lung cancer",
  "overallStatus": [
    "RECRUITING"
  ],
  "phases": [
    "PHASE3"
  ],
  "maxTrials": 20,
  "sort": "relevance"
}
```

# Actor output Schema

## `results` (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 = {
    "condition": "lung cancer",
    "overallStatus": [
        "RECRUITING"
    ],
    "phases": [
        "PHASE3"
    ],
    "maxTrials": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("forgeloop/clinical-trials").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": "lung cancer",
    "overallStatus": ["RECRUITING"],
    "phases": ["PHASE3"],
    "maxTrials": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("forgeloop/clinical-trials").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": "lung cancer",
  "overallStatus": [
    "RECRUITING"
  ],
  "phases": [
    "PHASE3"
  ],
  "maxTrials": 20
}' |
apify call forgeloop/clinical-trials --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,forgeloop/clinical-trials"
        }
    }
}
```

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/2IztFXoKNqGNrZOvv/builds/L5rPxw5djQOyrkptI/openapi.json
