# ClinicalTrials.gov Study Feed (`your_friendly_developer/clinicaltrials-study-feed`) Actor

Queries the public ClinicalTrials.gov studies API by condition, intervention, or sponsor and emits one normalized row per study, with status, phase, sponsor, enrollment, and update dates.

- **URL**: https://apify.com/your_friendly_developer/clinicaltrials-study-feed.md
- **Developed by:** [Jason Ramirez](https://apify.com/your_friendly_developer) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 study rows

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 Study Feed

Export ClinicalTrials.gov data as clean, normalized rows. Search by condition, intervention or sponsor, filter by status and update window, and get one row per study with NCT ID, status, phase, sponsor and conditions.

An Apify Actor that queries the public ClinicalTrials.gov v2 studies API and emits one normalized dataset item per study. Intended for biotech and pharma intelligence teams, CROs, academic researchers, and recruiters sourcing trial sites.

At least one nonblank condition, intervention, or sponsor is required. Status and update windows further narrow the query. The default limit is 200 and the maximum is 5000. Pages request up to 1000 records.

Example input:

```json
{
  "condition": "breast cancer",
  "intervention": "pembrolizumab",
  "statuses": ["RECRUITING", "NOT_YET_RECRUITING"],
  "updatedSinceDays": 30,
  "limit": 200
}
```

Sponsor-only example: `{"sponsor":"National Cancer Institute","limit":100}`.
Omit `updatedSinceDays` or set it to null for no update window. Zero means today in UTC.

| Output field | Meaning |
| --- | --- |
| nctId | Registry identifier or null |
| title, officialTitle | Registry brief and official titles or null |
| sponsor | Lead sponsor name or null |
| collaborators | Collaborator names, possibly empty |
| status | Overall registry status or null |
| phase | Phases joined with comma and space, or null |
| conditions | Condition strings, possibly empty |
| interventions | Objects with name and type, each nullable |
| enrollment | Registry count or null; zero is preserved |
| startDate, completionDate, lastUpdatePosted | Registry date strings or null; partial dates retained |
| locationsSummary | Location count and up to five distinct country names |
| url | Study page URL or null if identifier absent |
| retrievedAt | Run timestamp in UTC |
| source | ClinicalTrials.gov |

`LAST_RUN_SUMMARY` contains runAt, filtersUsed, totalReportedByApi (nullable), emitted, complete, and notes. Zero matches is a successful empty run with a note. A later page failure preserves collected rows with complete false. An initial failure stores the summary then fails the Actor. Reaching the limit completes the requested bounded run, not necessarily the registry's full matching set.

Data is the registry's own and updates on its schedule. No missing values are inferred, no clinical interpretation is provided, and no patient eligibility or site recruiting accuracy is guaranteed. Location summaries do not include contact details. Dates retain the precision supplied by the registry. No retries or cross-run deduplication are implemented. Rows are buffered up to the limit before writing to the dataset. Storage failures propagate from the SDK.

The update window uses `filter.advanced=AREA[LastUpdatePostDate]RANGE[YYYY-MM-DD,MAX]`. Its live acceptance has not been verified in this offline build. Other query fields are `query.cond`, `query.intr`, `query.spons`, and `filter.overallStatus`. Synthetic fixtures exercise the v2 protocolSection shape; they are not live registry records.

### Local run

Requires Node.js 20 or later. From this directory run `npm install`, put input JSON in `storage/key_value_stores/default/INPUT.json`, then run `npm start`. Installation and live runs need network access; the public API requires no key. Run `npm test` for offline tests, which inject fake fetch and require no installed SDK.

The Dockerfile installs the SDK and starts the Actor. Publication, live API verification, and pay-per-event per-row pricing configuration are owner steps. This build defines no prices and does not configure billing events. No publication or deployment is performed here.

# Actor input Schema

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

Disease or condition to search for, for example type 2 diabetes. At least one of condition, intervention, or sponsor is required.

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

Intervention or treatment name to search for, for example metformin.

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

Sponsor or collaborator organization name to search for.

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

Filter by recruitment and study status. Leave empty to include all statuses. Allowed values: RECRUITING, NOT_YET_RECRUITING, ACTIVE_NOT_RECRUITING, ENROLLING_BY_INVITATION, COMPLETED, TERMINATED, WITHDRAWN, SUSPENDED.

## `updatedSinceDays` (type: `integer`):

Only return studies updated within this many days. Leave empty for no date limit.

## `limit` (type: `integer`):

Maximum number of studies to return in one run.

## Actor input object example

```json
{
  "condition": "type 2 diabetes",
  "statuses": [
    "RECRUITING"
  ],
  "limit": 200
}
```

# Actor output Schema

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

Dataset containing one normalized row per study

## `keyValueStore` (type: `string`):

Default key-value store holding the LAST_RUN_SUMMARY record

# 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": "type 2 diabetes",
    "statuses": [
        "RECRUITING"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("your_friendly_developer/clinicaltrials-study-feed").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": "type 2 diabetes",
    "statuses": ["RECRUITING"],
}

# Run the Actor and wait for it to finish
run = client.actor("your_friendly_developer/clinicaltrials-study-feed").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": "type 2 diabetes",
  "statuses": [
    "RECRUITING"
  ]
}' |
apify call your_friendly_developer/clinicaltrials-study-feed --silent --output-dataset

```

## MCP server setup

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

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/EGK2RB4jIaZ2lrmTt/builds/woj3M9Rady5gcZHfw/openapi.json
