{
  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}