# ClinicalTrials.gov API — Official Study Search, No Key (`attainable_turkey_bjg/clinicaltrials-gov-api`) Actor

Search ClinicalTrials.gov with the official v2 API and return clean study records: NCT ID, title, status, phase, conditions, sponsor, dates and summary. No API key and no login. Hosted wrapper of a public US government API, not an HTML scraper.

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

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 API — Official Study Search, No Key

Search [ClinicalTrials.gov](https://clinicaltrials.gov) and export flattened study records. This Actor calls the **official ClinicalTrials.gov v2 API** ([documentation](https://clinicaltrials.gov/data-api/api)). There is no API key, no login, and no HTML scraping. If you have been looking for a ClinicalTrials.gov scraper, start here: the official API is the supported way to get the same study fields.

Independent tool, not affiliated with the U.S. National Library of Medicine or NIH. Trial data is provided by ClinicalTrials.gov; do not treat this as medical advice.

### Use cases

- Pull a list of studies for a condition, drug, sponsor or NCT ID into a spreadsheet or pipeline.
- Filter to **recruiting** (or another official status) without writing pagination code.
- Move off the retired classic ClinicalTrials.gov API (`/api/query/...`) and the old `min_rnk` / `max_rnk` parameters. This Actor uses `query.term`, optional `filter.overallStatus`, and `pageToken`.

### What you get

| Field | Description |
| --- | --- |
| `nctId` | NCT identifier |
| `briefTitle` / `officialTitle` | Study titles |
| `overallStatus` | e.g. RECRUITING, COMPLETED |
| `studyType` | Interventional, observational, etc. |
| `phases` | Phase list when present |
| `conditions` | Condition names |
| `interventions` | Intervention names |
| `sponsor` | Lead sponsor |
| `startDate` / `completionDate` | Dates as returned by the API |
| `enrollmentCount` | Planned or actual enrollment |
| `briefSummary` | Short description |
| `url` | Canonical study page |

### Example input

```json
{
  "query": "type 2 diabetes",
  "status": "RECRUITING",
  "maxResults": 50
}
```

`status` is optional. Leave it empty for every status.

### Example output

```json
{
  "nctId": "NCT06694935",
  "briefTitle": "A Phase 1b Study of QX1206 in T2DM Patients With NAFLD",
  "overallStatus": "RECRUITING",
  "conditions": ["Type 2 Diabetes Mellitus (T2DM)", "Non-Alcoholic Fatty Liver Disease (NAFLD)"],
  "url": "https://clinicaltrials.gov/study/NCT06694935",
  "source": "https://clinicaltrials.gov"
}
```

### Pricing

The Actor itself is free to use for now. You only pay the usual Apify platform usage for the run (compute, storage, and other platform costs on your Apify account).

### FAQ

**Do I need an API key?**
No. The official v2 API does not require a key or a login.

**Is this an HTML scraper?**
No. It is a hosted convenience wrapper of the public US government API. Anyone can call that API directly for free. The value is a ready-made Apify input, flattened fields, and pagination with `nextPageToken`.

**The classic API or my old `expr` / `min_rnk` query returns 0 results.**
The v2 endpoint uses different parameter names (`query.term`, `pageSize`, `pageToken`, `filter.overallStatus`). This Actor already sends the v2 names.

**Can I page through all matching studies?**
The Actor follows official page tokens until it reaches your `maxResults` cap (up to 1,000 studies per run).

### Notes

- The Actor pages politely and stays under typical unauthenticated rate guidance.

### How to run locally

```bash
cd clinicaltrials-gov-api
npm install
mkdir -p storage/key_value_stores/default
echo '{"query":"type 2 diabetes","maxResults":30}' > storage/key_value_stores/default/INPUT.json
APIFY_LOCAL_STORAGE_DIR=./storage npm start
```

# Actor input Schema

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

Official API query.term, e.g. a condition, drug, sponsor or NCT ID.

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

Optional filter.overallStatus value from the official API.

## `maxResults` (type: `integer`):

Stop after this many studies. The official API pages results; this actor follows page tokens until the cap is reached.

## Actor input object example

```json
{
  "query": "type 2 diabetes",
  "status": "",
  "maxResults": 50
}
```

# Actor output Schema

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

Default dataset items, displayed with the Overview table view from the dataset schema.

# 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": "type 2 diabetes"
};

// Run the Actor and wait for it to finish
const run = await client.actor("attainable_turkey_bjg/clinicaltrials-gov-api").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": "type 2 diabetes" }

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

```

## MCP server setup

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

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/Tczf6fahlqG6Srgke/builds/XL1wN53hD4AwEt7Bi/openapi.json
