# ClinicalTrials.gov Scraper (Official API v2) (`accommodating_aptitude/clinicaltrials-gov`) Actor

Pulls clinical study records by condition, drug, sponsor, country, phase and status from the official open ClinicalTrials.gov API v2. Returns NCT ID, title, status, phase, sponsor, start/completion dates and a direct link.

- **URL**: https://apify.com/accommodating_aptitude/clinicaltrials-gov.md
- **Developed by:** [Korhan Coşan Ergün](https://apify.com/accommodating_aptitude) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.00 / 1,000 clinical trial founds

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

## ClinicalTrials.gov Scraper (Official API v2)

Search and export clinical trial records from **ClinicalTrials.gov**, the U.S.
National Library of Medicine's official registry of clinical studies — using the
**official, free, keyless [ClinicalTrials.gov API v2](https://clinicaltrials.gov/data-api/api)**.
No HTML scraping, no browser, no API key, no login.

### What you get

For every matching study:

| Field | Description |
|---|---|
| `nct_id` | NCT registry identifier (e.g. `NCT05762432`) |
| `title` | Brief study title |
| `official_title` | Full official title |
| `link` | Direct link to the study page |
| `status` | `RECRUITING`, `COMPLETED`, `TERMINATED`, … |
| `phases` / `phase` | `PHASE1` … `PHASE4`, `NA` |
| `study_type` | `INTERVENTIONAL`, `OBSERVATIONAL`, … |
| `sponsor` / `sponsor_class` | Lead sponsor and its class (`INDUSTRY`, `NIH`, `OTHER`) |
| `collaborators` | Collaborating organisations |
| `start_date`, `primary_completion_date`, `completion_date` | Study timeline |
| `last_update_date` | Last registry update |
| `enrollment` | Planned/actual participant count |
| `conditions` | Conditions / diseases studied |
| `interventions` | Drugs, devices, procedures |
| `countries` | Countries with study sites |
| `summary` | Brief summary text |
| `scraped_at`, `source_url` | Provenance |

### Filters

- **Condition** — `diabetes`, `breast cancer`, …
- **Free-text term** — `GLP-1`, `immunotherapy`, …
- **Intervention / drug** — `semaglutide`, `pembrolizumab`, …
- **Sponsor** — `Pfizer`, `National Cancer Institute`, …
- **Country / location** — `Turkey`, `Germany`, `Boston`, …
- **Status** — any combination of `RECRUITING`, `NOT_YET_RECRUITING`,
  `ACTIVE_NOT_RECRUITING`, `COMPLETED`, `TERMINATED`, `WITHDRAWN`,
  `SUSPENDED`, `ENROLLING_BY_INVITATION`, `UNKNOWN`
- **Phase** — `EARLY_PHASE1`, `PHASE1`, `PHASE2`, `PHASE3`, `PHASE4`
- **Study type** — interventional / observational / expanded access
- **Max items** — hard cap on result count

### Typical uses

- Competitive intelligence: which companies run trials in your therapeutic area
- Site feasibility: find recruiting trials in a given country
- Biotech/pharma lead lists: sponsors by indication and phase
- Patient-recruitment platforms: keep a live feed of recruiting studies
- Academic literature and landscape reviews

### Pricing

Pay per event: you are charged per trial record pushed to the dataset
(`trial-found`). A run that returns nothing costs nothing.

### Notes on data source and compliance

- All data comes from the official API endpoint
  `https://clinicaltrials.gov/api/v2/studies`. Nothing is scraped from HTML.
- ClinicalTrials.gov data is in the public domain (U.S. government work); the
  registry explicitly publishes this API for programmatic access.
- `clinicaltrials.gov/robots.txt` disallows `/api/` for *search-engine
  crawlers* (to stop API responses being indexed). This actor is not a crawler:
  it calls the documented public API directly, at a polite rate
  (≤ ~2 requests/second), with retry/backoff on `429`/`5xx`.

### Local development

```bash
cd clinicaltrials-gov
APIFY_LOCAL=1 python main.py        # writes to ./storage/datasets/default
```

# Actor input Schema

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

Condition or disease to search for, e.g. 'diabetes', 'breast cancer'. Can be left empty.

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

Additional keyword to search for in the study text, e.g. 'GLP-1', 'immunotherapy'. Can be left empty.

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

Intervention or drug name, e.g. 'semaglutide', 'pembrolizumab'. Can be left empty.

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

Sponsor / lead organization name, e.g. 'Pfizer', 'National Cancer Institute'. Can be left empty.

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

Country or city where the study site is located, e.g. 'Turkey', 'Germany', 'Boston'. Can be left empty.

## `statuses` (type: `array`):

Statuses to filter on: RECRUITING, NOT_YET_RECRUITING, ACTIVE_NOT_RECRUITING, COMPLETED, TERMINATED, WITHDRAWN, SUSPENDED, ENROLLING_BY_INVITATION, UNKNOWN. If left empty, all statuses are included.

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

Phases to filter on: EARLY_PHASE1, PHASE1, PHASE2, PHASE3, PHASE4. If left empty, all phases are included.

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

Study type filter.

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

Maximum number of clinical studies to pull.

## Actor input object example

```json
{
  "condition": "diabetes",
  "searchTerm": "",
  "intervention": "",
  "sponsor": "",
  "country": "",
  "statuses": [
    "RECRUITING"
  ],
  "phases": [],
  "studyType": "",
  "maxItems": 50
}
```

# Actor output Schema

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

Dataset containing all records found in this run.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("accommodating_aptitude/clinicaltrials-gov").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("accommodating_aptitude/clinicaltrials-gov").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 '{}' |
apify call accommodating_aptitude/clinicaltrials-gov --silent --output-dataset

```

## MCP server setup

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

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/7b95nIQ6sYBOhG1BB/builds/HSXd1fHGsLAVk3OPv/openapi.json
