# Clinical Trials API - ClinicalTrials.gov Search & Data Export (`captainhandsome/clinical-trials-search`) Actor

Search ClinicalTrials.gov by condition, intervention, sponsor or status and pull clinical trial data into flat rows: NCT ID, status, phase, enrollment, sponsor, dates and locations. Ready for CSV, JSON or AI agent workflows, with no API key.

- **URL**: https://apify.com/captainhandsome/clinical-trials-search.md
- **Developed by:** [Joseph McRell](https://apify.com/captainhandsome) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 1,000 results

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?

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

## ClinicalTrials.gov Study Search

Search the official ClinicalTrials.gov API by condition, intervention, sponsor or keyword. Export NCT IDs, status, phase, enrollment, dates and study locations. This Actor turns the official ClinicalTrials.gov API v2 into bounded, structured datasets for analysis, enrichment, monitoring, and AI-agent workflows.

### What data can I extract?

87 flat columns per study, covering everything the registry publishes about a trial:

- **Identity** - NCT ID, brief and official titles, acronym, sponsor protocol number, secondary registry and grant IDs, registering organization, study URL
- **Status and dates** - overall status, last known status, reason stopped, start, primary completion, completion, first posted, results posted and last update dates, each with its ACTUAL vs ESTIMATED flag
- **Sponsorship** - lead sponsor and class, collaborators, responsible party and their title and affiliation, data monitoring committee, FDA-regulated drug and device flags
- **Subject matter** - conditions, sponsor keywords, interventions and their brand names and types, plus normalized MeSH condition and intervention terms for reliable grouping
- **Design** - phase, study type, enrollment with ACTUAL vs ESTIMATED flag, allocation, intervention model, primary purpose, masking and who is masked, observational model, time perspective, arm count and arm labels
- **Outcomes** - primary and secondary outcome measures and the primary outcome time frame
- **Eligibility** - minimum and maximum age, standard age brackets, sex, healthy volunteers, sampling method, study population and the full inclusion/exclusion criteria text
- **Sites and contacts** - site count, recruiting-site count, countries, states, cities, facility list, first-site coordinates, central contact name, email and phone, and the overall official with their role and affiliation
- **Evidence** - brief and detailed descriptions, linked PubMed IDs, IPD sharing policy, posted protocol/SAP/ICF document types, and adverse event term counts where results are posted

Every run writes flat records to the default dataset. Nested modules are flattened and lists are joined with commas, so a CSV or Excel export opens as one row per study with no post-processing. Download results as JSON, CSV, Excel, XML, or access them through the Apify API.

#### All 87 columns

**Identity** — `central_contact_name`, `intervention_other_names`, `nct_id`, `official_title`, `org_study_id`, `overall_official_name`, `pmids`, `responsible_party_title`, `secondary_ids`, `title`

**Status** — `completion_date_type`, `document_types`, `enrollment_type`, `has_expanded_access`, `has_results`, `intervention_types`, `is_fda_regulated_device`, `is_fda_regulated_drug`, `last_known_status`, `oversight_has_dmc`, `phase`, `primary_completion_date_type`, `responsible_party_type`, `start_date_type`, `status`, `status_verified_date`, `study_type`

**Dates** — `completion_date`, `last_update`, `primary_completion_date`, `results_first_post_date`, `start_date`, `study_first_post_date`, `version_date`

**Location** — `allocation`, `first_location_lat`, `first_location_lon`, `location_count`, `locations`, `recruiting_location_count`, `states`

**People** — `responsible_party_investigator`, `sponsor`, `sponsor_class`

**Contact** — `central_contact_email`, `central_contact_phone`, `url`

**Counts and measures** — `arm_count`, `countries`, `enrollment`, `other_adverse_event_count`, `serious_adverse_event_count`

**Other detail** — `acronym`, `arm_groups`, `brief_summary`, `cities`, `collaborators`, `conditions`, `detailed_description`, `eligibility_criteria`, `healthy_volunteers`, `intervention_model`, `interventions`, `ipd_sharing`, `keywords`, `masking`, `max_age`, `mesh_conditions`, `mesh_interventions`, `min_age`, `observational_model`, `organization`, `organization_class`, `overall_official_affiliation`, `overall_official_role`, `primary_outcome_timeframe`, `primary_outcomes`, `primary_purpose`, `responsible_party_affiliation`, `sampling_method`, `secondary_outcomes`, `sex`, `std_ages`, `study_population`, `time_perspective`, `who_masked`, `why_stopped`

### Input example

```json
{
  "query": "Alzheimer disease",
  "status": "RECRUITING",
  "max_items": 100
}
```

`max_items` is a hard output and billing ceiling. The default input is intentionally limited to 10 records so Store tests and first runs stay inexpensive.

### Output example

A real record from the input above, abridged to 30 of the 87 columns:

```json
{
  "nct_id": "NCT06582706",
  "title": "Nicotinic Acid for the Treatment of Alzheimer's Disease",
  "status": "RECRUITING",
  "phase": "PHASE1, PHASE2",
  "study_type": "INTERVENTIONAL",
  "conditions": "Alzheimer Disease",
  "mesh_conditions": "Alzheimer Disease",
  "interventions": "Placebo Comparator, Extended Release Niacin",
  "intervention_types": "DRUG",
  "sponsor": "Indiana University",
  "sponsor_class": "OTHER",
  "collaborators": "Alzheimer's Association",
  "enrollment": 30,
  "enrollment_type": "ESTIMATED",
  "allocation": "RANDOMIZED",
  "intervention_model": "PARALLEL",
  "primary_purpose": "TREATMENT",
  "masking": "TRIPLE",
  "primary_outcomes": "Change in nicotinic acid levels in blood and CSF",
  "min_age": "60 Years",
  "max_age": "85 Years",
  "start_date": "2024-12-19",
  "start_date_type": "ACTUAL",
  "primary_completion_date": "2026-12",
  "location_count": 1,
  "recruiting_location_count": 1,
  "countries": "United States",
  "central_contact_email": "jbrosch@iu.edu",
  "is_fda_regulated_drug": true,
  "url": "https://clinicaltrials.gov/study/NCT06582706"
}
```

The dataset schema documents every field with a title, type, description, and example so humans and AI tools can inspect the contract before running it. Every example in that schema is a value observed in a live API response.

### Use with AI agents and MCP

Apify's hosted MCP server can discover and call this Actor. A suitable agent request is:

> Find 100 recruiting Alzheimer disease studies with NCT IDs, sponsors, phases, enrollment and locations.

Use this exact Actor input:

```json
{
  "query": "Alzheimer disease",
  "status": "RECRUITING",
  "max_items": 100
}
```

The Actor succeeds with a nonempty default dataset and exposes its default dataset through the top-level Output schema.

### Pricing and cost control

Output is billed per result at **$0.003 per result** (about $3.00 per 1,000 results), plus a $0.0005 Actor-start charge billed once per gigabyte of memory at run start. Use `max_items` to cap both output volume and charges. The price shown on the Apify Store listing is authoritative.

Use `max_items` to cap returned and billable records. Invalid input is rejected before unnecessary work wherever possible.

### Common use cases

- Source-specific research and market intelligence
- Structured exports for spreadsheets, warehouses and BI systems
- Entity enrichment and monitoring pipelines
- Retrieval and data collection by AI agents

### Reliability

The Actor uses bounded pagination, retries transient upstream failures, deduplicates records where the source exposes stable identifiers, and fails explicitly when the source cannot provide usable output. Production default-input canaries verify a nonempty structured dataset in under five minutes.

### Limitations and responsible use

- Coverage, field availability and update timing are controlled by the upstream public source.
- Optional fields can be null or absent when the source does not publish them.
- This Actor does not bypass authentication, access controls, CAPTCHAs, or source rate limits.
- Customers remain responsible for lawful use, applicable source terms, and restrictions on downstream decisions.

### FAQ

#### What is the best way to run this ClinicalTrials.gov search Actor?

Start with the 10-record default, inspect the dataset, then increase `max_items` and narrow the available filters for your use case.

#### Do I need my own API key?

No external API key is required unless the Input tab explicitly says otherwise. Apify credentials are used normally when invoking the Actor through Apify APIs or MCP.

#### Can an AI agent call it?

Yes. The strict input schema acts as the tool signature, and the dataset plus Output schemas describe the returned records.

#### Can I export the results?

Yes. Apify datasets support JSON, CSV, Excel, XML and API retrieval.

### Support and changes

Open an issue on the Actor page with a redacted input and run ID. See [CHANGELOG.md](./CHANGELOG.md) for contract and maintenance updates.

# Actor input Schema

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

Keywords, organization name, topic, condition, intervention, sponsor or other source-supported search expression.

## `status` (type: `array`):

ClinicalTrials.gov overall status, for example RECRUITING or COMPLETED.

## `max_items` (type: `integer`):

Hard maximum number of dataset records returned and billed.

## Actor input object example

```json
{
  "query": "diabetes",
  "max_items": 10
}
```

# Actor output Schema

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

One flat record per study.

# 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("captainhandsome/clinical-trials-search").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("captainhandsome/clinical-trials-search").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 captainhandsome/clinical-trials-search --silent --output-dataset

```

## MCP server setup

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

```

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/iUpbkf07jjjLaDJX3/builds/U10rvljwgBxf2M9XY/openapi.json
