{
  "openapi": "3.0.1",
  "info": {
    "title": "FDA Scraper - Recalls, Adverse Events & Device Data",
    "description": "Scrape the U.S. FDA (openFDA): drug, device & food recalls, adverse events (FAERS/MAUDE/CAERS), 510(k) & PMA device clearances, drug labels/approvals/NDC, and medical-device manufacturer leads. Keyless, no browser, monitor mode + analytics.",
    "version": "0.1",
    "x-build-id": "oBcp8xDDaGOeHhKnc"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~fda-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-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/scrapesage~fda-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-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/scrapesage~fda-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-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": {
          "searchType": {
            "title": "What to scrape",
            "enum": [
              "drugRecalls",
              "deviceRecalls",
              "foodRecalls",
              "drugAdverseEvents",
              "deviceAdverseEvents",
              "foodAdverseEvents",
              "device510k",
              "devicePMA",
              "deviceClassification",
              "deviceEstablishments",
              "deviceUDI",
              "drugLabels",
              "drugApprovals",
              "drugNDC",
              "custom"
            ],
            "type": "string",
            "description": "Which openFDA dataset to query. Recalls and adverse events power monitoring & safety use cases; clearances/approvals/labels/NDC power regulatory & competitive intelligence; device establishments are ready-to-contact manufacturer leads.",
            "default": "drugRecalls"
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "records",
              "analytics"
            ],
            "type": "string",
            "description": "`Records` returns one rich row per FDA record. `Analytics` returns aggregated counts (top recalling firms, recalls by state, most-reported adverse reactions, etc.) — set the Count field below.",
            "default": "records"
          },
          "countField": {
            "title": "Count field (analytics only)",
            "type": "string",
            "description": "Field to aggregate on when Output mode = Analytics, e.g. `classification`, `state`, `reason_for_recall`, `recalling_firm`, `patient.reaction.reactionmeddrapt` (FAERS), `product_code` (devices). `.exact` is added automatically for text fields; use a date field (e.g. `report_date`) for a time-series histogram."
          },
          "dataset": {
            "title": "Dataset (custom mode)",
            "enum": [
              "drug",
              "device",
              "food",
              "animalandveterinary",
              "tobacco",
              "other"
            ],
            "type": "string",
            "description": "Only for searchType = custom. One of: `drug`, `device`, `food`, `animalandveterinary`, `tobacco`, `other`."
          },
          "endpoint": {
            "title": "Endpoint (custom mode)",
            "type": "string",
            "description": "Only for searchType = custom. E.g. `enforcement`, `event`, `label`, `ndc`, `drugsfda`, `510k`, `pma`, `classification`, `recall`, `registrationlisting`, `udi`, `problem`."
          },
          "keyword": {
            "title": "Keyword",
            "type": "string",
            "description": "Free-text search across the most relevant fields for the chosen dataset (product / brand / generic / device name, recall reason, reaction…). Example: `insulin`, `infusion pump`, `peanut`, `ozempic`."
          },
          "brandName": {
            "title": "Brand name",
            "type": "string",
            "description": "Match a specific brand/trade name (drug or device)."
          },
          "genericName": {
            "title": "Generic / substance name",
            "type": "string",
            "description": "Match a specific generic or active-substance name."
          },
          "firmName": {
            "title": "Firm / manufacturer / sponsor",
            "type": "string",
            "description": "Recalling firm (recalls), applicant/sponsor (clearances/approvals), labeler (NDC) or establishment name (manufacturer leads)."
          },
          "classification": {
            "title": "Recall classification",
            "enum": [
              "",
              "Class I",
              "Class II",
              "Class III"
            ],
            "type": "string",
            "description": "Recalls only. Class I = most serious (probable serious harm/death), Class II = temporary/reversible harm, Class III = unlikely to cause harm.",
            "default": ""
          },
          "recallStatus": {
            "title": "Recall status",
            "enum": [
              "",
              "Ongoing",
              "Completed",
              "Terminated",
              "Pending"
            ],
            "type": "string",
            "description": "Recalls only.",
            "default": ""
          },
          "seriousOnly": {
            "title": "Serious adverse events only",
            "type": "boolean",
            "description": "Adverse-event datasets only — limit to reports flagged serious (death, life-threatening, hospitalization, disability) for drugs; death/injury for devices.",
            "default": false
          },
          "state": {
            "title": "State / region",
            "type": "string",
            "description": "Two-letter state code for recalls (`CA`, `NY`) or device establishments. Filters by the firm/establishment location."
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Country filter. Recalls use the full name (`United States`); device establishments use the ISO code (`US`, `DE`, `CN`)."
          },
          "productCode": {
            "title": "Device product code",
            "type": "string",
            "description": "Three-letter FDA device product code (e.g. `LZG`, `DXT`). Applies to device clearances, PMA, classification, establishments, UDI and MAUDE."
          },
          "dateFrom": {
            "title": "Date from",
            "type": "string",
            "description": "Earliest date (`YYYY-MM-DD`). Mapped to the right date field per dataset — recall report date, adverse-event receive date, clearance/approval decision date, etc. Great for incremental monitoring."
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "Latest date (`YYYY-MM-DD`)."
          },
          "searchQuery": {
            "title": "Advanced openFDA query",
            "type": "string",
            "description": "Optional raw openFDA query, AND-ed with the filters above. Uses openFDA syntax, e.g. `openfda.pharm_class_epc:\"nonsteroidal anti-inflammatory drug\"` or `event_type:Death`. See the openFDA query docs."
          },
          "searchUrls": {
            "title": "openFDA URLs",
            "type": "array",
            "description": "Paste full openFDA API URLs (e.g. `https://api.fda.gov/drug/enforcement.json?search=classification:\"Class I\"`). Each is run as-is — overrides the dataset/filters above. Handy for reproducing a query you built in the openFDA explorer.",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum records (or analytics buckets) to output."
          },
          "deduplicateResults": {
            "title": "Deduplicate results",
            "type": "boolean",
            "description": "Skip duplicate records within a run.",
            "default": true
          },
          "apiKey": {
            "title": "openFDA API key (optional)",
            "type": "string",
            "description": "Optional free openFDA API key for higher rate limits (240→240k requests/day). Leave blank — the actor works keyless via rotating proxy sessions. Get one at open.fda.gov/apis/authentication."
          },
          "monitorMode": {
            "title": "Monitor mode (only new/changed)",
            "type": "boolean",
            "description": "Remember records across runs and output only new or changed ones each time (a recall re-appears when its status changes). Pairs perfectly with Apify Schedules for recall & safety alerts. Uses its own named store — does not interfere with scheduling.",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Name this monitor watchlist. Use different keys for different saved searches so their histories stay separate.",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Apify Proxy settings. Datacenter proxy is plenty — the openFDA API is clean and keyless; the actor rotates sessions to spread the per-IP rate limit.",
            "default": {
              "useApifyProxy": true
            }
          },
          "urlsFromFile": {
            "title": "Import URLs from a file",
            "type": "string",
            "description": "Paste a list of URLs (one per line), OR one link to a .txt/.csv file, Google Sheet or Google Drive file containing them. Lets you import many Start URLs at once instead of typing each. Google Sheet/Drive share links are handled automatically."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}