{
  "openapi": "3.0.1",
  "info": {
    "title": "Clinical Trials FDA Scraper",
    "description": "Extract clinical trials from ClinicalTrials.gov and FDA data from openFDA APIs. Search by condition, drug, sponsor, or NCT ID. Get adverse events, drug labels, recalls, and device data. For pharma research and regulatory monitoring.",
    "version": "1.0",
    "x-build-id": "7uTRB2AJPSVaVzXs7"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/constant_quadruped~clinical-trials-fda-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-constant_quadruped-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/constant_quadruped~clinical-trials-fda-scraper/runs": {
      "post": {
        "operationId": "runs-sync-constant_quadruped-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/constant_quadruped~clinical-trials-fda-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-constant_quadruped-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",
        "properties": {
          "dataSources": {
            "title": "Data Sources",
            "type": "array",
            "description": "Select which data sources to query: clinicaltrials = ClinicalTrials.gov, openfda = openFDA",
            "items": {
              "type": "string",
              "enum": [
                "clinicaltrials",
                "openfda"
              ]
            },
            "default": [
              "clinicaltrials",
              "openfda"
            ]
          },
          "condition": {
            "title": "Condition / Disease",
            "type": "string",
            "description": "Search clinical trials by condition or disease name (e.g., 'breast cancer', 'diabetes', 'alzheimer')"
          },
          "intervention": {
            "title": "Intervention / Treatment",
            "type": "string",
            "description": "Search by intervention or treatment name (e.g., 'pembrolizumab', 'immunotherapy')"
          },
          "searchTerm": {
            "title": "General Search Term",
            "type": "string",
            "description": "Free-text search across all trial fields"
          },
          "sponsor": {
            "title": "Sponsor Name",
            "type": "string",
            "description": "Filter by lead sponsor (e.g., 'Pfizer', 'Novartis', 'NIH')"
          },
          "location": {
            "title": "Location",
            "type": "string",
            "description": "Filter by trial location (city, state, or country)"
          },
          "status": {
            "title": "Trial Status",
            "type": "array",
            "description": "Filter by trial status",
            "items": {
              "type": "string",
              "enum": [
                "RECRUITING",
                "NOT_YET_RECRUITING",
                "ACTIVE_NOT_RECRUITING",
                "COMPLETED",
                "ENROLLING_BY_INVITATION",
                "SUSPENDED",
                "TERMINATED",
                "WITHDRAWN"
              ]
            }
          },
          "phase": {
            "title": "Trial Phase",
            "type": "array",
            "description": "Filter by trial phase (EARLY_PHASE1, PHASE1, PHASE2, PHASE3, PHASE4, NA)",
            "items": {
              "type": "string",
              "enum": [
                "EARLY_PHASE1",
                "PHASE1",
                "PHASE2",
                "PHASE3",
                "PHASE4",
                "NA"
              ]
            }
          },
          "studyType": {
            "title": "Study Type",
            "enum": [
              "INTERVENTIONAL",
              "OBSERVATIONAL",
              "EXPANDED_ACCESS"
            ],
            "type": "string",
            "description": "Filter by study type (INTERVENTIONAL, OBSERVATIONAL, EXPANDED_ACCESS)"
          },
          "nctIds": {
            "title": "NCT IDs",
            "type": "array",
            "description": "Specific NCT IDs to retrieve (e.g., NCT04368728)",
            "items": {
              "type": "string"
            }
          },
          "drugName": {
            "title": "Drug Brand Name",
            "type": "string",
            "description": "Search FDA data by drug brand name (e.g., 'Keytruda', 'Humira')"
          },
          "genericName": {
            "title": "Generic Drug Name",
            "type": "string",
            "description": "Search by generic drug name (e.g., 'pembrolizumab', 'adalimumab')"
          },
          "deviceName": {
            "title": "Device Name",
            "type": "string",
            "description": "Search FDA data by medical device name"
          },
          "manufacturerName": {
            "title": "Manufacturer Name",
            "type": "string",
            "description": "Filter by device or drug manufacturer"
          },
          "productDescription": {
            "title": "Product Description",
            "type": "string",
            "description": "Search recalls by product description keywords"
          },
          "recallClass": {
            "title": "Recall Class",
            "enum": [
              "I",
              "II",
              "III"
            ],
            "type": "string",
            "description": "Filter recalls by classification: I = most serious, II = moderate, III = least serious"
          },
          "dateFrom": {
            "title": "Date From",
            "type": "string",
            "description": "Start date for date range filter (YYYY-MM-DD)"
          },
          "dateTo": {
            "title": "Date To",
            "type": "string",
            "description": "End date for date range filter (YYYY-MM-DD)"
          },
          "maxResults": {
            "title": "Max Results",
            "minimum": 1,
            "maximum": 25000,
            "type": "integer",
            "description": "Maximum number of results to return per data type. Clinical trials: up to 10,000. Adverse events: up to 25,000 (openFDA limit). Other FDA data: up to 100 per type.",
            "default": 100
          },
          "includeAISummary": {
            "title": "Include AI Summary",
            "type": "boolean",
            "description": "Generate AI-powered summaries for trials and adverse event analysis (requires OpenAI API key)",
            "default": false
          },
          "includeAdverseEvents": {
            "title": "Include Adverse Events",
            "type": "boolean",
            "description": "Include FDA adverse event reports (FAERS for drugs, MAUDE for devices)",
            "default": true
          },
          "includeDrugLabels": {
            "title": "Include Drug Labels",
            "type": "boolean",
            "description": "Include FDA drug label/prescribing information (SPL)",
            "default": true
          },
          "includeRecalls": {
            "title": "Include Recalls",
            "type": "boolean",
            "description": "Include FDA drug and device recalls/enforcement actions",
            "default": true
          },
          "includeDrugApprovals": {
            "title": "Include Drug Approvals",
            "type": "boolean",
            "description": "Include Drugs@FDA approval history",
            "default": true
          },
          "includeDevice510k": {
            "title": "Include 510(k) Clearances",
            "type": "boolean",
            "description": "Include FDA 510(k) device clearance data",
            "default": true
          },
          "openfdaApiKey": {
            "title": "openFDA API Key",
            "type": "string",
            "description": "Optional: Free API key from open.fda.gov for higher rate limits (240 req/min vs 40 req/min)"
          },
          "openaiApiKey": {
            "title": "OpenAI API Key",
            "type": "string",
            "description": "Required for AI summaries. Get one at platform.openai.com"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}