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

Search ClinicalTrials.gov and export clinical studies: status, phase, conditions, interventions, sponsor, enrollment, dates, site locations and eligibility. One row per study, no API key.

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

## Pricing

from $1.49 / 1,000 studies

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 Scraper

Search ClinicalTrials.gov and export **one row per clinical study**: status, phase, conditions, interventions, sponsor, enrollment, dates, trial locations and eligibility.

No API key and no login. It reads the public ClinicalTrials.gov API v2, the endpoint the registry publishes for programmatic access.

### What can this clinical trials scraper do?

- Search by free text, condition, intervention, sponsor, or any combination.
- Filter by overall status on the server side.
- Filter by phase.
- Follow pagination until `maxItems` is reached.
- Flatten nested study data into columns you can sort and filter.
- Keep every site location with its city, country and coordinates.
- Export JSON, CSV or Excel, and schedule a repeat through Apify.

### What data can you extract?

| Field | Meaning |
| --- | --- |
| nctId | Registry identifier, for example NCT04829084 |
| briefTitle / officialTitle / acronym | Study titles |
| overallStatus | RECRUITING, COMPLETED, TERMINATED and so on |
| studyType | INTERVENTIONAL, OBSERVATIONAL, EXPANDED_ACCESS |
| phases | Phase list, for example PHASE2, or NA |
| conditions / keywords | Conditions studied |
| interventions | Intervention type and name pairs |
| leadSponsor / leadSponsorClass / collaborators | Who runs the study |
| enrollmentCount / enrollmentType | Target or actual enrollment |
| allocation / primaryPurpose | Design fields |
| startDate / primaryCompletionDate / completionDate | Study timeline |
| firstPostedDate / lastUpdatePostedDate | Registry dates |
| whyStopped | Reason given when a study stopped early |
| hasResults | Whether results are posted |
| primaryOutcome | First primary outcome measure |
| briefSummary | Short summary, trimmed to 1500 characters |
| eligibilitySex / minimumAge / maximumAge / healthyVolunteers | Eligibility basics |
| locations | Facility, city, state, country and coordinates per site |
| countries | Distinct countries, handy for filtering |
| studyUrl | Registry page for the study |
| scrapedAt | When this row was collected |

### How to use it

1. Put search terms in **Search terms**. The default is `diabetes`.
2. Optionally add **Condition**, **Intervention** or **Sponsor**, and pick **Overall status** or **Phase**.
3. Set **Maximum studies**. The default is 100, which keeps a first run small.
4. Run it and download the dataset. Totals by status, phase and country land in the key-value store record `SUMMARY`.

### Notes

- The phase filter is applied to each returned study, so a run may read more studies than it keeps.
- The registry keeps updating studies, so two runs on different days can return different values for `overallStatus` and enrollment.

# Actor input Schema

## `query` (type: `string`):

Free text, for example diabetes metformin or CAR-T lymphoma.

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

Optional condition filter, for example breast cancer.

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

Optional treatment or device filter, for example pembrolizumab.

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

Optional sponsor or collaborator filter, for example Karolinska.

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

Optional. Leave empty for every status.

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

Optional. Studies are kept when any of their phases matches. Early phase 1 is EARLY_PHASE1.

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

Stop after this many dataset rows.

## Actor input object example

```json
{
  "query": "diabetes",
  "maxItems": 100
}
```

# Actor output Schema

## `overview` (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 = {
    "query": "diabetes"
};

// Run the Actor and wait for it to finish
const run = await client.actor("rainminer/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 = { "query": "diabetes" }

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

```

## MCP server setup

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