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

Search and extract clinical trial data from ClinicalTrials.gov - conditions, interventions, phases, enrollment, sponsors, locations and status. Free, no authentication required.

- **URL**: https://apify.com/crawlergang/clinicaltrials-scraper.md
- **Developed by:** [Crawler Gang](https://apify.com/crawlergang) (community)
- **Categories:** Automation, Developer tools, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 11 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## Medicaid Drug Spending & NADAC Scraper

Retrieve official drug pricing and prescription spending data from the US Medicaid program. Look up the **National Average Drug Acquisition Cost (NADAC)** — what pharmacies actually pay per pill or unit — or browse **State Drug Utilization** data showing Medicaid prescription counts and reimbursement by state, drug, and quarter. No login or API key required.

### What data you get

#### NADAC Mode (drug acquisition costs)

| Field | Description |
|---|---|
| `drugName` | Drug description including strength and form |
| `ndc` | National Drug Code (11-digit) |
| `nadacPerUnit` | Average acquisition cost per unit in USD (per pill, mL, etc.) |
| `pricingUnit` | Unit type (EA=each, ML=milliliter, GM=gram) |
| `effectiveDate` | Date the NADAC rate became effective |
| `asOfDate` | Date the data was published |
| `pharmacyType` | C/I (Community/Independent), C, I, or M (Mail-order) |
| `isOtc` | Whether the drug is available over-the-counter |
| `drugClassification` | Brand or Generic |
| `explanationCode` | Code describing how the NADAC was calculated |
| `explanationDescription` | Human-readable explanation of pricing method |
| `correspondingGenericCostPerUnit` | Generic equivalent cost (for brand drugs) |
| `scrapedAt` | ISO-8601 scrape timestamp |

#### State Drug Utilization Mode (Medicaid spending)

| Field | Description |
|---|---|
| `state` | 2-letter US state/territory code |
| `drugName` | Product name |
| `ndc` | National Drug Code |
| `year` | Program year |
| `quarter` | Quarter (1–4) |
| `utilizationType` | FFSU (Fee-for-Service Utilization) or MCU (Managed Care Utilization) |
| `numberOfPrescriptions` | Number of prescriptions reimbursed |
| `unitsReimbursed` | Units dispensed |
| `totalAmountReimbursedUsd` | Total Medicaid + non-Medicaid reimbursement in USD |
| `medicaidAmountReimbursedUsd` | Federal/state Medicaid share |
| `nonMedicaidAmountReimbursedUsd` | Non-Medicaid (e.g. MCO) share |
| `suppressionUsed` | Whether data was suppressed for privacy |
| `scrapedAt` | ISO-8601 scrape timestamp |

### Use cases

- **Healthcare cost research** — compare what pharmacies pay for generic vs brand-name drugs
- **PBM transparency analysis** — assess spread pricing between NADAC and reimbursement rates
- **Policy analysis** — track Medicaid drug spending trends by state, drug, and quarter
- **Drug pricing journalism** — identify the most expensive drugs by acquisition cost
- **Healthcare economics** — analyse brand-to-generic cost differentials
- **Compliance research** — review Medicaid utilization patterns for specific therapeutic areas

### Input parameters

| Parameter | Required | Default | Description |
|---|---|---|---|
| `mode` | Yes | `nadac` | `nadac` for acquisition costs, `stateUtilization` for spending data |
| `dataYear` | Yes | `2024` | Year of data: `2023` or `2024` |
| `drugNameQuery` | No | — | Filter by keyword in drug name (case-insensitive, e.g., `metformin`) |
| `pharmacyType` | No | all | NADAC mode: `C/I`, `C`, `I`, `M` |
| `otcOnly` | No | `false` | NADAC mode: return only OTC drugs |
| `state` | No | all | State Utilization mode: 2-letter state code (e.g., `TX`) |
| `quarter` | No | all | State Utilization mode: `1`–`4` |
| `maxItems` | No | `100` | Maximum records to return (up to 10,000) |

### Example input — NADAC drug pricing

```json
{
  "mode": "nadac",
  "dataYear": "2024",
  "drugNameQuery": "metformin",
  "pharmacyType": "C/I",
  "maxItems": 50
}
```

### Example input — State Drug Utilization

```json
{
  "mode": "stateUtilization",
  "dataYear": "2024",
  "state": "TX",
  "quarter": "4",
  "maxItems": 200
}
```

### Example output records

**NADAC record:**

```json
{
  "dataType": "nadac",
  "drugName": "METFORMIN HCL 500 MG TABLET",
  "ndc": "00093108601",
  "nadacPerUnit": 0.02838,
  "pricingUnit": "EA",
  "effectiveDate": "2024-01-10",
  "asOfDate": "2024-01-17",
  "pharmacyType": "C/I",
  "isOtc": false,
  "drugClassification": "Generic",
  "explanationCode": "1",
  "explanationDescription": "National Average Drug Acquisition Cost",
  "scrapedAt": "2026-06-04T00:00:00+00:00"
}
```

**State Utilization record:**

```json
{
  "dataType": "stateUtilization",
  "state": "TX",
  "drugName": "TRULICITY",
  "ndc": "00002143380",
  "year": "2024",
  "quarter": "4",
  "utilizationType": "FFSU",
  "numberOfPrescriptions": 108,
  "unitsReimbursed": 226.0,
  "totalAmountReimbursedUsd": 106607.76,
  "medicaidAmountReimbursedUsd": 103963.72,
  "nonMedicaidAmountReimbursedUsd": 2644.04,
  "suppressionUsed": false,
  "scrapedAt": "2026-06-04T00:00:00+00:00"
}
```

### Data source

Data is sourced from **data.medicaid.gov**, the official open data portal of the Centers for Medicare & Medicaid Services (CMS). Both datasets are public domain, freely accessible, and require no API key.

- **NADAC** is updated weekly by CMS and reflects actual pharmacy invoice costs surveyed from US pharmacies.
- **State Drug Utilization** is updated quarterly and covers all 50 states plus DC, Puerto Rico, and US territories.

### FAQ

**What is NADAC?**
NADAC (National Average Drug Acquisition Cost) is a weekly survey of what community pharmacies pay wholesalers and manufacturers for drugs. It is used as a reimbursement benchmark by many state Medicaid programs.

**Does this require login or an API key?**
No. All data is publicly available on data.medicaid.gov with no authentication required.

**How current is the NADAC data?**
The 2024 dataset contains weekly updates through the end of 2024. The most recent `asOfDate` in the data reflects the latest weekly survey.

**What is State Drug Utilization data?**
It tracks the volume and cost of drugs reimbursed by each state's Medicaid program, broken down by drug NDC, state, year, and quarter. Both fee-for-service (FFSU) and managed care utilization (MCU) types are included.

**What does "suppression" mean?**
When fewer than 11 beneficiaries used a drug in a state/quarter, the data is suppressed to protect patient privacy. These records still appear but with suppression flagged.

**Can I search by NDC code?**
Use `drugNameQuery` with the drug name — NDC-level filtering can be applied after download. The NADAC dataset uses 11-digit NDC codes as primary identifiers.

# Actor input Schema

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

Disease or condition to search for. Example: diabetes, cancer, asthma, COVID-19.

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

Drug, treatment or intervention name to filter results. Example: metformin, aspirin, chemotherapy.

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

Filter trials by their current recruitment or study status.

## `phase` (type: `string`):

Filter by clinical trial phase.

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

Maximum number of clinical trial records to return.

## Actor input object example

```json
{
  "condition": "diabetes",
  "intervention": "metformin",
  "status": "RECRUITING",
  "phase": "all",
  "maxItems": 50
}
```

# Actor output Schema

## `drugRecords` (type: `string`):

Dataset containing all scraped drug pricing or utilization records.

# 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": "diabetes",
    "intervention": "metformin",
    "status": "RECRUITING",
    "phase": "all",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlergang/clinicaltrials-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 = {
    "condition": "diabetes",
    "intervention": "metformin",
    "status": "RECRUITING",
    "phase": "all",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlergang/clinicaltrials-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": "diabetes",
  "intervention": "metformin",
  "status": "RECRUITING",
  "phase": "all",
  "maxItems": 50
}' |
apify call crawlergang/clinicaltrials-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlergang/clinicaltrials-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/te0ndTSrTNUWOGXAo/builds/ynZQhf0pGPWb7hBjf/openapi.json
