# Clinical Trials & FDA Pipeline Intelligence Scraper (`constructive_calm/clinical-trials-fda-scraper`) Actor

Unified clinical-trial + FDA intelligence: trial search, drug approvals, 510(k) and PMA device clearances, adverse events, recalls, drug shortages, and a sponsor-pipeline rollup. Built on official ClinicalTrials.gov v2 + OpenFDA APIs. Zero anti-bot. Optional Gemini AI summaries.

- **URL**: https://apify.com/constructive\_calm/clinical-trials-fda-scraper.md
- **Developed by:** [Omar Eldeeb](https://apify.com/constructive_calm) (community)
- **Categories:** Agents, Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $20.00 / 1,000 sponsor pipeline aggregateds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Clinical Trials & FDA Pipeline Intelligence Scraper

Unified clinical-trial + FDA intelligence in one actor. Search ClinicalTrials.gov, fetch FDA drug approvals, 510(k) and PMA device clearances, adverse events, recalls, and active drug shortages — and roll them all up into a single sponsor-pipeline view that no incumbent ships.

Built on **two official, public, no-auth APIs**: ClinicalTrials.gov v2 and OpenFDA. Every output row carries a `verifyUrl` that links to the canonical public page so you can audit the data with one click.

### What does this actor do?

It pulls structured biomedical regulatory data and unifies it into one normalized output shape. Ten modes cover the full surface:

| Mode | Records returned | Buyer use case |
|---|---|---|
| `trials` | NCT records with phase, status, conditions, comparators, locations, primary endpoints | Search trials by indication / sponsor / phase / status |
| `trial_details` | Full study record incl. eligibility criteria, secondary endpoints, sponsors/collaborators | Deep dives on specific NCTs |
| `drug_approvals` | NDA / ANDA / BLA submissions with all status changes, products, NDCs | Approval timeline + commercial reality |
| `device_clearances` | 510(k) + PMA records with decision date, decision, product code | Med-device pipeline tracking |
| `adverse_events` | PII-stripped FAERS reports — reactions, seriousness, demographics | Pharmacovigilance signals |
| `recalls` | FDA enforcement (Class I / II / III) — reason, distribution, status | Compliance & QA monitoring |
| `shortages` | Active or resolved drug shortages with availability + reason | Hospital / pharmacy planning |
| `pipeline` | **One row per sponsor** merging trials + approvals + clearances + recalls + shortages + next catalyst | Alt-data hedge fund, biotech VC, pharma BD |
| `monitor` | Incremental change events vs. prior runs — new trials, status changes, new approvals, recalls | Scheduled daily / weekly diffs |
| `ai_summary` | Gemini 2.5 Flash structured summary — TL;DR, risk flags, milestone class, outcome prior | Premium analyst layer |

**Free trial:** the first 10 chargeable events of every run are free. Pay only on the 11th event onward.

### Why use this actor?

- **Biotech VCs / hedge funds** — build a catalyst calendar from `pipeline.nextCatalystDate` and `upcomingMilestones[]`. Every trial readout, PDUFA-class submission, and 510(k) decision is normalized and ticker-tagged when the sponsor maps to an SEC filer.
- **Pharma BD / corp dev** — find Phase 2 oncology assets at small biotechs, see their FDA submission history, then pivot to drug labels for MOA inference. Sponsor resolver bridges to SEC tickers when public.
- **CROs / clinical operations** — query for `RECRUITING` Phase 3 trials in a target country, get full `locations[]` with city + facility + status.
- **Insurance underwriters / pharmacovigilance teams** — pull adverse-event trends per drug with `serious=true` breakdowns. PII is stripped (no names, no contact info, no narrative free text) before the row is written.
- **Hospital pharmacy / supply chain** — `shortages` mode lists every currently-active FDA drug shortage with availability, generic name, and affected NDCs. Schedule daily and pipe alerts.
- **Compliance / QA** — `recalls` mode returns Class I / II / III enforcement actions with classification, recall reason, and distribution pattern. Combine with `monitor` for new-recall alerts.
- **AI / LLM training** — every record has a stable PK (NCT, ANDA, k_number, recall_number) and a public `verifyUrl`. Perfect for grounded biomedical knowledge graphs.
- **Public-health researchers** — trial geography by condition, sponsor class breakdowns, no API key required.

### How to use this actor

1. **Pick a mode** — see the table above. The most common starting points are `trials` (search) and `pipeline` (sponsor rollup).
2. **Set your filters** — conditions, phases, sponsor identifiers (ticker / name / domain / CIK), date range, etc.
3. **Run it** — first 10 chargeable events per run are free; you only pay on the 11th and beyond. Set `maxItems: -1` for unlimited bulk extraction (the actor uses `nextPageToken` and `search_after` pagination automatically).
4. **Verify any record** — click the `verifyUrl` field on any output row to land on the source's canonical page (clinicaltrials.gov, accessdata.fda.gov, etc.).
5. **Export** as JSON / CSV / Excel from the dataset, or hit the dataset API directly to chain into a downstream workflow.

### Input

#### Search Phase 3 lung-cancer trials currently recruiting

```json
{
    "mode": "trials",
    "conditions": ["non-small cell lung cancer"],
    "phases": ["PHASE3"],
    "statuses": ["RECRUITING"],
    "maxItems": 100
}
````

#### Full trial details by NCT ID

```json
{
    "mode": "trial_details",
    "nctIds": ["NCT04368728", "NCT05636956"],
    "maxItems": 10
}
```

#### Pfizer's recent FDA drug approvals

```json
{
    "mode": "drug_approvals",
    "sponsorIdentifiers": ["PFE"],
    "dateFrom": "2024-01-01",
    "maxItems": 50
}
```

#### Medtronic's 510(k) cardiac-monitor clearances

```json
{
    "mode": "device_clearances",
    "applicantName": "Medtronic",
    "productCode": "DXN",
    "devicePathways": ["510k"],
    "maxItems": 25
}
```

#### Serious Ozempic adverse events

```json
{
    "mode": "adverse_events",
    "drugName": "Ozempic",
    "seriousOnly": true,
    "maxItems": 200
}
```

#### Class I drug recalls in last 90 days

```json
{
    "mode": "recalls",
    "recallClassifications": ["Class I"],
    "recallDomains": ["drug"],
    "dateFrom": "2026-02-01",
    "maxItems": 50
}
```

#### Active drug shortages

```json
{
    "mode": "shortages",
    "shortageStatus": "currently_in_shortage",
    "maxItems": 100
}
```

#### Sponsor pipeline rollup (the killer mode)

```json
{
    "mode": "pipeline",
    "sponsorIdentifiers": ["MRNA", "PFE", "LLY"],
    "maxItemsPerSource": 1000
}
```

#### Monitor for changes (run on a schedule)

```json
{
    "mode": "monitor",
    "monitorTargets": ["NCT04368728", "MRNA", "PFE"],
    "maxItems": 100
}
```

#### AI-powered structured summary

```json
{
    "mode": "ai_summary",
    "nctIds": ["NCT04368728"],
    "enableAiSummary": true
}
```

### Output

#### Trial record (sample)

```json
{
    "type": "trial",
    "id": "NCT06840782",
    "nctId": "NCT06840782",
    "briefTitle": "First-line Immunotherapy-based Standard of Care and Local Ablative Treatments for Oligometastatic NSCLC",
    "conditions": ["Oligometastatic Non-small Cell Lung Cancer (NSCLC)"],
    "interventions": [
        { "type": "EXPERIMENTAL", "name": "Radiation: Radical local treatment", "description": "..." }
    ],
    "comparators": [
        { "type": "ACTIVE_COMPARATOR", "name": "Drug: SoC-based immunotherapy", "description": "..." }
    ],
    "phase": "PHASE3",
    "status": "RECRUITING",
    "enrollmentTarget": 124,
    "actualEnrollment": 124,
    "studyDesign": {
        "allocation": "RANDOMIZED",
        "interventionModel": "PARALLEL",
        "masking": "NONE",
        "primaryPurpose": "TREATMENT"
    },
    "primaryEndpoints": [
        {
            "measure": "Overall Survival (OS)",
            "timeFrame": "From randomization up to two years",
            "description": "Time from randomization to documented death from any cause"
        }
    ],
    "sponsorClass": "OTHER",
    "locations": [
        { "facility": "Gustave Roussy", "city": "Villejuif", "country": "France", "status": "RECRUITING" }
    ],
    "countries": ["France"],
    "primaryCompletionDate": "2030-02",
    "hasResults": false,
    "lastUpdateSubmitDate": "2025-09-12",
    "verifyUrl": "https://clinicaltrials.gov/study/NCT06840782",
    "scrapedAt": "2026-05-04T11:34:45.860Z"
}
```

#### Pipeline record (sample, Moderna abridged)

```json
{
    "type": "pipeline",
    "id": "0001682852",
    "ticker": "MRNA",
    "cik": "0001682852",
    "trialCountTotal": 111,
    "trialCountByPhase": { "PHASE1": 48, "PHASE2": 22, "PHASE3": 18, "PHASE4": 4 },
    "trialCountByStatus": { "COMPLETED": 71, "RECRUITING": 12, "ACTIVE_NOT_RECRUITING": 19 },
    "trialCountActiveRecruiting": 31,
    "drugApprovalCount": 1,
    "topConditions": [
        { "condition": "SARS-CoV-2", "trialCount": 31 },
        { "condition": "Influenza", "trialCount": 13 },
        { "condition": "Respiratory Syncytial Virus", "trialCount": 11 }
    ],
    "upcomingMilestones": [
        { "nctId": "NCT07089706", "milestone": "primary_completion", "date": "2026-08", "daysUntil": 92 }
    ],
    "nextCatalystDate": "2026-08",
    "nextCatalystType": "primary_completion",
    "nextCatalystId": "NCT07089706",
    "regulatorySignal": 0,
    "verifyUrl": "https://clinicaltrials.gov/search?spons=Moderna%20Inc"
}
```

#### Verify any record

| Record type | URL pattern |
|---|---|
| Trial | `https://clinicaltrials.gov/study/<NCT_ID>` |
| Drug approval | `https://www.accessdata.fda.gov/scripts/cder/daf/index.cfm?event=overview.process&ApplNo=<#>` |
| 510(k) clearance | `https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=<K_NUMBER>` |
| PMA approval | `https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpma/pma.cfm?id=<P_NUMBER>` |
| Recall | `https://www.accessdata.fda.gov/scripts/ires/index.cfm?Recall_Number=<#>` |

### How much does it cost?

Pay-per-event pricing (the first 10 events of any run are free):

| Event | Price | What you get |
|---|---|---|
| `trial-fetched` | $0.0003 | One CT.gov trial record |
| `trial-details-fetched` | $0.0006 | Full trial detail (eligibility + endpoints + results) |
| `drug-approval-fetched` | $0.0004 | One FDA drug application with all submissions |
| `device-clearance-fetched` | $0.0004 | One 510(k) or PMA clearance |
| `adverse-event-fetched` | $0.00015 | One PII-stripped FAERS report |
| `recall-fetched` | $0.0004 | One FDA enforcement action |
| `shortage-fetched` | $0.0004 | One drug-shortage record |
| `pipeline-aggregated` | **$0.02** | One sponsor pipeline rollup (synthesizes 5+ source queries) |
| `change-detected` | $0.0003 | One change event in monitor mode |
| `ai-summary-generated` | $0.05 | One Gemini 2.5 Flash structured summary |

#### Typical run costs

- **100-trial NSCLC search:** ~$0.027
- **Pfizer drug approval scan (250 records):** ~$0.10
- **Daily class-I-recall watch (5 records / day):** ~$0.002 / day
- **Weekly pipeline scan, top 10 biotech sponsors:** ~$0.20 / week
- **Sponsor pipeline + AI summary (1 sponsor):** ~$0.07

Compare to enterprise alternatives:

- Citeline / Datamonitor: $10K+/yr/seat
- Phesi: $5K+/yr/seat
- BioPharmaCatalyst: $99/mo
- GlobalData Pharma: enterprise pricing

### Tips & advanced options

- **Bulk extraction** — set `maxItems: -1` and the actor will use `search_after` (Link header `rel="next"`) on OpenFDA and `nextPageToken` on CT.gov to scroll through the entire dataset. There is no built-in cap.
- **OpenFDA API key** — anonymous tier is 1,000 req/day per IP. For bulk users, set the optional `openFdaApiKey` input (free at https://open.fda.gov/apis/authentication, 120K req/day).
- **Sponsor resolution** — every output row has `sponsor.matchConfidence` ∈ `{exact, alias, fuzzy, raw}`. `exact` = SEC ticker bridge, `alias` = hand-curated biopharma index (Wyeth → Pfizer, Genentech → Roche, etc.), `fuzzy` = token-set match, `raw` = passthrough. Audit ambiguous matches by checking the field.
- **Monitor mode** — run on a schedule (Apify integrations → Schedule daily). The first run seeds fingerprints and emits 0 changes; subsequent runs emit only new or changed rows.
- **Pipeline mode runtime** — for busy sponsors (Pfizer ≈ 600+ trials, ≈ 200 approvals), the parallel fan-out takes 30–60 seconds. Tighten with `maxItemsPerSource: 500` to reduce wall time.
- **Combining mode + AI** — set `enableAiSummary: true` in `pipeline` mode to attach a Gemini structured summary to every sponsor row. Adds $0.05 per sponsor.
- **Out of scope (v1)** — EU CTIS, WHO ICTRP, Health Canada, FDA orphan / breakthrough / fast-track designations. These are scoped for a future v2.

### Legal disclaimer

This actor consumes only **public data from official US-government APIs** (ClinicalTrials.gov v2, OpenFDA). Both APIs are open, free, and explicitly distributed for re-use under federal open-data policy. The actor does not bypass authentication, does not scrape content from third-party sites, and does not violate the terms of service of either source.

Adverse-event records are PII-stripped at emit time (`utils/piiStrip.ts`): emails, phone numbers, and SSN-shaped values are redacted. Patient identifiers are not present in the source data.

This data is provided for research, analytical, and informational purposes only. **Do not use for medical decisions.** OpenFDA's own disclaimer states: "Do not rely on openFDA to make decisions regarding medical care."

### FAQ

**Q: My sponsor returned `matchConfidence: "raw"`. Why?**
A: Raw passthrough means the sponsor name didn't match an SEC ticker, didn't match a hand-curated biopharma alias, and didn't fuzzy-match within threshold. The actor still ran the query as-is. Either submit an SEC ticker / canonical name, or add the sponsor to your custom alias list (open a feature request).

**Q: My pipeline mode showed `drugApprovalCount: 0` for a company that obviously has approvals.**
A: OpenFDA tracks legal entities by sponsor\_name. Subsidiaries (e.g. ModernaTX, Inc.) may file under names that don't match the parent (Moderna Inc). Try passing the subsidiary string directly: `sponsorIdentifiers: ["ModernaTX, Inc."]`. Future v2 will widen the alias index.

**Q: How fresh is the data?**
A: ClinicalTrials.gov v2 reflects the current live database. OpenFDA datasets update on different cadences — drug approvals weekly, adverse events quarterly, recalls daily, shortages weekly. Each row's `scrapedAt` reflects when this actor fetched it; OpenFDA's last-update date is in `meta.last_updated` of the underlying API.

**Q: Can I get EU trials?**
A: Not in v1. EU CTIS uses an undocumented POST search endpoint and EUDRA-CT requires HTML scraping. Add as a feature request.

**Q: Does the AI summary hallucinate?**
A: Gemini 2.5 Flash with `thinkingBudget: 0` and `temperature: 0.2` is constrained to JSON output and only sees the structured record (no external context). It does not invent NCT IDs or sponsor names. Outcome priors are calibrated to BIO/Biomedtracker industry base rates (Phase 1→2 ~63%, Phase 2→3 ~31%, Phase 3→NDA ~58%, NDA→approval ~85%).

**Q: How do I report a bug?**
A: Open an issue on the Apify actor page or reach out via the developer's email (omar.eldeeb@remotegrowthpartners.com).

# Actor input Schema

## `mode` (type: `string`):

What to fetch. 'trials' searches ClinicalTrials.gov. 'trial\_details' fetches full records by NCT ID list. 'drug\_approvals' fetches FDA NDA/ANDA/BLA records. 'device\_clearances' fetches FDA 510(k) and PMA clearances. 'adverse\_events' fetches PII-stripped drug or device adverse-event reports. 'recalls' fetches FDA enforcement (Class I/II/III recalls). 'shortages' fetches FDA drug shortages. 'pipeline' merges trials + approvals + clearances + recalls + shortages into one row per sponsor. 'monitor' emits only changes since the last run. 'ai\_summary' generates Gemini 2.5 Flash structured summaries.

## `sponsorIdentifiers` (type: `array`):

One or more sponsor identifiers. Accepts SEC tickers (PFE, MRNA, LLY), company names (Pfizer Inc, Moderna), domains (pfizer.com), or SEC CIK numbers. The actor auto-resolves via SEC company\_tickers + a hand-curated biopharma alias index, with fuzzy fallback. Every output row carries a sponsor.matchConfidence field so you can audit ambiguous matches.

## `nctIds` (type: `array`):

Specific ClinicalTrials.gov NCT IDs to fetch in 'trial\_details' or 'ai\_summary' mode. Format: NCT followed by 8 digits, e.g. NCT04368728.

## `conditions` (type: `array`):

Filter trials by condition / disease / indication. Examples: 'non-small cell lung cancer', 'type 2 diabetes', 'major depressive disorder'. Multi-word phrases are matched as a single term.

## `interventions` (type: `array`):

Filter trials by intervention name. Can be a generic drug name (semaglutide), brand name (Ozempic), or device class (continuous glucose monitor).

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

Filter clinical trials by phase. Empty = all phases.

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

Filter clinical trials by overall status. Empty = all statuses.

## `countries` (type: `array`):

Filter trials by location country. ISO English country names (United States, United Kingdom, Germany).

## `applicantName` (type: `string`):

Free-text applicant name for FDA device clearance search. The actor matches against OpenFDA's applicant field.

## `productCode` (type: `string`):

FDA classification product code, e.g. DXN for cardiac monitor, OCM for blood-pressure monitor. See FDA Product Classification Database for the full list.

## `devicePathways` (type: `array`):

Which FDA device clearance pathways to query. 510(k) = substantial-equivalence clearance, PMA = premarket approval (higher-risk).

## `drugName` (type: `string`):

Brand or generic drug name to search adverse events for. The actor matches both patient.drug.openfda.brand\_name and generic\_name.

## `seriousOnly` (type: `boolean`):

If enabled, only return serious adverse events (death, life-threatening, hospitalization, disability, congenital anomaly).

## `recallClassifications` (type: `array`):

Filter recalls by classification. Class I = serious health risk, Class II = temporary or reversible health consequence, Class III = unlikely to cause harm. Empty = all.

## `recallDomains` (type: `array`):

Which OpenFDA enforcement endpoints to query for recalls.

## `shortageStatus` (type: `string`):

Filter drug shortages by status. 'Currently in Shortage' = active, 'Resolved' = closed.

## `dateFrom` (type: `string`):

Lower bound for the mode's primary date field (YYYY-MM-DD). For trials = lastUpdateSubmitDate. For drug\_approvals = submission\_status\_date. For device\_clearances = decision\_date. For recalls = recall\_initiation\_date. Leave empty for no lower bound.

## `dateTo` (type: `string`):

Upper bound for the mode's primary date field (YYYY-MM-DD). Leave empty for no upper bound.

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

Maximum records to return. Set to -1 for unlimited (the actor uses search\_after / nextPageToken pagination automatically). Trial-mode free events are still capped — you only pay once you exceed the trial.

## `maxItemsPerSource` (type: `integer`):

In pipeline mode, cap each source (CT.gov, OpenFDA drug, OpenFDA device, recalls, shortages) at this many rows when computing aggregates. Counts remain accurate via the API's totalCount; topN lists are sampled. Lower = faster.

## `incrementalMode` (type: `boolean`):

If enabled, the actor saves a fingerprint of every emitted record. On the next run with the same input, only new or changed records are emitted. Pairs well with 'monitor' mode and Apify scheduled runs.

## `monitorTargets` (type: `array`):

NCT IDs, sponsor identifiers, application numbers, or k\_numbers to watch in 'monitor' mode. The actor diffs against the prior fingerprints and emits only changes.

## `enableAiSummary` (type: `boolean`):

If enabled in trial-related modes, an AI-powered structured summary (TL;DR + risk flags + milestone classification + outcome prior) is generated for each record via Gemini 2.5 Flash. Adds $0.05 per summary.

## `openFdaApiKey` (type: `string`):

Optional OpenFDA API key for higher rate limits. Anonymous = 240 req/min and 1,000 req/day per IP. With a key = 240 req/min and 120,000 req/day. Get one free at https://open.fda.gov/apis/authentication. Leave empty to use anonymous tier.

## `proxyConfiguration` (type: `object`):

ClinicalTrials.gov v2 and OpenFDA do not require proxies (no anti-bot, only fair-use rate limits). Leave empty in most cases.

## Actor input object example

```json
{
  "mode": "trials",
  "sponsorIdentifiers": [
    "PFE"
  ],
  "nctIds": [
    "NCT04368728"
  ],
  "conditions": [
    "non-small cell lung cancer"
  ],
  "interventions": [],
  "phases": [],
  "statuses": [],
  "countries": [],
  "applicantName": "Medtronic",
  "productCode": "",
  "devicePathways": [
    "510k",
    "pma"
  ],
  "drugName": "Ozempic",
  "seriousOnly": false,
  "recallClassifications": [],
  "recallDomains": [
    "drug",
    "device"
  ],
  "shortageStatus": "any",
  "dateFrom": "",
  "dateTo": "",
  "maxItems": 25,
  "maxItemsPerSource": 1000,
  "incrementalMode": false,
  "monitorTargets": [],
  "enableAiSummary": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Dataset of trials, FDA approvals, clearances, adverse events, recalls, shortages, pipelines, and AI summaries.

# 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 = {
    "sponsorIdentifiers": [
        "PFE"
    ],
    "nctIds": [
        "NCT04368728"
    ],
    "conditions": [
        "non-small cell lung cancer"
    ],
    "applicantName": "Medtronic",
    "drugName": "Ozempic",
    "maxItems": 25,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("constructive_calm/clinical-trials-fda-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 = {
    "sponsorIdentifiers": ["PFE"],
    "nctIds": ["NCT04368728"],
    "conditions": ["non-small cell lung cancer"],
    "applicantName": "Medtronic",
    "drugName": "Ozempic",
    "maxItems": 25,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("constructive_calm/clinical-trials-fda-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 '{
  "sponsorIdentifiers": [
    "PFE"
  ],
  "nctIds": [
    "NCT04368728"
  ],
  "conditions": [
    "non-small cell lung cancer"
  ],
  "applicantName": "Medtronic",
  "drugName": "Ozempic",
  "maxItems": 25,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call constructive_calm/clinical-trials-fda-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Clinical Trials & FDA Pipeline Intelligence Scraper",
        "description": "Unified clinical-trial + FDA intelligence: trial search, drug approvals, 510(k) and PMA device clearances, adverse events, recalls, drug shortages, and a sponsor-pipeline rollup. Built on official ClinicalTrials.gov v2 + OpenFDA APIs. Zero anti-bot. Optional Gemini AI summaries.",
        "version": "1.0",
        "x-build-id": "DFasTcGIveDGY79Nk"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/constructive_calm~clinical-trials-fda-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-constructive_calm-clinical-trials-fda-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/constructive_calm~clinical-trials-fda-scraper/runs": {
            "post": {
                "operationId": "runs-sync-constructive_calm-clinical-trials-fda-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/constructive_calm~clinical-trials-fda-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-constructive_calm-clinical-trials-fda-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Scraping mode",
                        "enum": [
                            "trials",
                            "trial_details",
                            "drug_approvals",
                            "device_clearances",
                            "adverse_events",
                            "recalls",
                            "shortages",
                            "pipeline",
                            "monitor",
                            "ai_summary"
                        ],
                        "type": "string",
                        "description": "What to fetch. 'trials' searches ClinicalTrials.gov. 'trial_details' fetches full records by NCT ID list. 'drug_approvals' fetches FDA NDA/ANDA/BLA records. 'device_clearances' fetches FDA 510(k) and PMA clearances. 'adverse_events' fetches PII-stripped drug or device adverse-event reports. 'recalls' fetches FDA enforcement (Class I/II/III recalls). 'shortages' fetches FDA drug shortages. 'pipeline' merges trials + approvals + clearances + recalls + shortages into one row per sponsor. 'monitor' emits only changes since the last run. 'ai_summary' generates Gemini 2.5 Flash structured summaries.",
                        "default": "trials"
                    },
                    "sponsorIdentifiers": {
                        "title": "Sponsors / companies (ticker, name, domain, or CIK)",
                        "type": "array",
                        "description": "One or more sponsor identifiers. Accepts SEC tickers (PFE, MRNA, LLY), company names (Pfizer Inc, Moderna), domains (pfizer.com), or SEC CIK numbers. The actor auto-resolves via SEC company_tickers + a hand-curated biopharma alias index, with fuzzy fallback. Every output row carries a sponsor.matchConfidence field so you can audit ambiguous matches.",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "nctIds": {
                        "title": "NCT IDs (trial_details mode)",
                        "type": "array",
                        "description": "Specific ClinicalTrials.gov NCT IDs to fetch in 'trial_details' or 'ai_summary' mode. Format: NCT followed by 8 digits, e.g. NCT04368728.",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "conditions": {
                        "title": "Medical conditions",
                        "type": "array",
                        "description": "Filter trials by condition / disease / indication. Examples: 'non-small cell lung cancer', 'type 2 diabetes', 'major depressive disorder'. Multi-word phrases are matched as a single term.",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "interventions": {
                        "title": "Interventions / drugs / devices",
                        "type": "array",
                        "description": "Filter trials by intervention name. Can be a generic drug name (semaglutide), brand name (Ozempic), or device class (continuous glucose monitor).",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "phases": {
                        "title": "Trial phases",
                        "type": "array",
                        "description": "Filter clinical trials by phase. Empty = all phases.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "EARLY_PHASE1",
                                "PHASE1",
                                "PHASE2",
                                "PHASE3",
                                "PHASE4",
                                "NA"
                            ],
                            "enumTitles": [
                                "Early Phase 1",
                                "Phase 1",
                                "Phase 2",
                                "Phase 3",
                                "Phase 4",
                                "Not applicable"
                            ]
                        },
                        "default": []
                    },
                    "statuses": {
                        "title": "Trial statuses",
                        "type": "array",
                        "description": "Filter clinical trials by overall status. Empty = all statuses.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "NOT_YET_RECRUITING",
                                "RECRUITING",
                                "ENROLLING_BY_INVITATION",
                                "ACTIVE_NOT_RECRUITING",
                                "COMPLETED",
                                "TERMINATED",
                                "WITHDRAWN",
                                "SUSPENDED",
                                "UNKNOWN"
                            ],
                            "enumTitles": [
                                "Not yet recruiting",
                                "Recruiting",
                                "Enrolling by invitation",
                                "Active, not recruiting",
                                "Completed",
                                "Terminated",
                                "Withdrawn",
                                "Suspended",
                                "Unknown"
                            ]
                        },
                        "default": []
                    },
                    "countries": {
                        "title": "Countries (trial locations)",
                        "type": "array",
                        "description": "Filter trials by location country. ISO English country names (United States, United Kingdom, Germany).",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "applicantName": {
                        "title": "Applicant name (device_clearances mode)",
                        "type": "string",
                        "description": "Free-text applicant name for FDA device clearance search. The actor matches against OpenFDA's applicant field.",
                        "default": ""
                    },
                    "productCode": {
                        "title": "FDA product code (3-letter code)",
                        "type": "string",
                        "description": "FDA classification product code, e.g. DXN for cardiac monitor, OCM for blood-pressure monitor. See FDA Product Classification Database for the full list.",
                        "default": ""
                    },
                    "devicePathways": {
                        "title": "Device pathways",
                        "type": "array",
                        "description": "Which FDA device clearance pathways to query. 510(k) = substantial-equivalence clearance, PMA = premarket approval (higher-risk).",
                        "items": {
                            "type": "string",
                            "enum": [
                                "510k",
                                "pma"
                            ],
                            "enumTitles": [
                                "510(k)",
                                "PMA"
                            ]
                        },
                        "default": [
                            "510k",
                            "pma"
                        ]
                    },
                    "drugName": {
                        "title": "Drug name (adverse_events mode)",
                        "type": "string",
                        "description": "Brand or generic drug name to search adverse events for. The actor matches both patient.drug.openfda.brand_name and generic_name.",
                        "default": ""
                    },
                    "seriousOnly": {
                        "title": "Serious adverse events only",
                        "type": "boolean",
                        "description": "If enabled, only return serious adverse events (death, life-threatening, hospitalization, disability, congenital anomaly).",
                        "default": false
                    },
                    "recallClassifications": {
                        "title": "Recall classifications",
                        "type": "array",
                        "description": "Filter recalls by classification. Class I = serious health risk, Class II = temporary or reversible health consequence, Class III = unlikely to cause harm. Empty = all.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "Class I",
                                "Class II",
                                "Class III"
                            ],
                            "enumTitles": [
                                "Class I (serious)",
                                "Class II (reversible)",
                                "Class III (unlikely harm)"
                            ]
                        },
                        "default": []
                    },
                    "recallDomains": {
                        "title": "Recall domains",
                        "type": "array",
                        "description": "Which OpenFDA enforcement endpoints to query for recalls.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "drug",
                                "device"
                            ],
                            "enumTitles": [
                                "Drug recalls",
                                "Device recalls"
                            ]
                        },
                        "default": [
                            "drug",
                            "device"
                        ]
                    },
                    "shortageStatus": {
                        "title": "Shortage status",
                        "enum": [
                            "any",
                            "currently_in_shortage",
                            "resolved"
                        ],
                        "type": "string",
                        "description": "Filter drug shortages by status. 'Currently in Shortage' = active, 'Resolved' = closed.",
                        "default": "any"
                    },
                    "dateFrom": {
                        "title": "Date from",
                        "type": "string",
                        "description": "Lower bound for the mode's primary date field (YYYY-MM-DD). For trials = lastUpdateSubmitDate. For drug_approvals = submission_status_date. For device_clearances = decision_date. For recalls = recall_initiation_date. Leave empty for no lower bound.",
                        "default": ""
                    },
                    "dateTo": {
                        "title": "Date to",
                        "type": "string",
                        "description": "Upper bound for the mode's primary date field (YYYY-MM-DD). Leave empty for no upper bound.",
                        "default": ""
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": -1,
                        "maximum": 100000,
                        "type": "integer",
                        "description": "Maximum records to return. Set to -1 for unlimited (the actor uses search_after / nextPageToken pagination automatically). Trial-mode free events are still capped — you only pay once you exceed the trial.",
                        "default": 100
                    },
                    "maxItemsPerSource": {
                        "title": "Max items per source (pipeline mode)",
                        "minimum": 100,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "In pipeline mode, cap each source (CT.gov, OpenFDA drug, OpenFDA device, recalls, shortages) at this many rows when computing aggregates. Counts remain accurate via the API's totalCount; topN lists are sampled. Lower = faster.",
                        "default": 1000
                    },
                    "incrementalMode": {
                        "title": "Incremental mode (change detection)",
                        "type": "boolean",
                        "description": "If enabled, the actor saves a fingerprint of every emitted record. On the next run with the same input, only new or changed records are emitted. Pairs well with 'monitor' mode and Apify scheduled runs.",
                        "default": false
                    },
                    "monitorTargets": {
                        "title": "Monitor targets (monitor mode)",
                        "type": "array",
                        "description": "NCT IDs, sponsor identifiers, application numbers, or k_numbers to watch in 'monitor' mode. The actor diffs against the prior fingerprints and emits only changes.",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "enableAiSummary": {
                        "title": "Enable AI summary (premium event)",
                        "type": "boolean",
                        "description": "If enabled in trial-related modes, an AI-powered structured summary (TL;DR + risk flags + milestone classification + outcome prior) is generated for each record via Gemini 2.5 Flash. Adds $0.05 per summary.",
                        "default": false
                    },
                    "openFdaApiKey": {
                        "title": "OpenFDA API key (optional)",
                        "type": "string",
                        "description": "Optional OpenFDA API key for higher rate limits. Anonymous = 240 req/min and 1,000 req/day per IP. With a key = 240 req/min and 120,000 req/day. Get one free at https://open.fda.gov/apis/authentication. Leave empty to use anonymous tier."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "ClinicalTrials.gov v2 and OpenFDA do not require proxies (no anti-bot, only fair-use rate limits). Leave empty in most cases.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
