{
  "openapi": "3.0.1",
  "info": {
    "title": "FDA Recall Scraper",
    "description": "The FDA gives the recall reason only as free text, so nobody can query it. This classifies it into root causes — undeclared allergen, sterility failure, nitrosamine impurity, software defect, component recall — and scores firms that keep failing the same way. 89.4% classified over 900 live recalls.",
    "version": "0.1",
    "x-build-id": "Qy9qSU8y1K6Sievnh"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datalayer~fda-recall-enforcement/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datalayer-fda-recall-enforcement",
        "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/datalayer~fda-recall-enforcement/runs": {
      "post": {
        "operationId": "runs-sync-datalayer-fda-recall-enforcement",
        "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/datalayer~fda-recall-enforcement/run-sync": {
      "post": {
        "operationId": "run-sync-datalayer-fda-recall-enforcement",
        "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": {
          "productTypes": {
            "title": "Product types",
            "type": "array",
            "description": "Which FDA enforcement endpoints to read. Each is independent — a gap in one does not affect the others.",
            "items": {
              "type": "string",
              "enum": [
                "drug",
                "device",
                "food"
              ],
              "enumTitles": [
                "Drugs",
                "Medical devices",
                "Food"
              ]
            },
            "default": [
              "drug",
              "device",
              "food"
            ]
          },
          "searchTerm": {
            "title": "Search term",
            "type": "string",
            "description": "Matched against the recall reason and the product description, e.g. insulin, catheter, peanut.",
            "default": ""
          },
          "firm": {
            "title": "Recalling firm",
            "type": "string",
            "description": "Restrict to one company, e.g. Abbott. Matched against the recalling firm name.",
            "default": ""
          },
          "classifications": {
            "title": "Recall classification",
            "type": "array",
            "description": "Class I means a reasonable probability of serious injury or death. Leave empty for all three classes.",
            "items": {
              "type": "string",
              "enum": [
                "Class I",
                "Class II",
                "Class III"
              ],
              "enumTitles": [
                "Class I - serious injury or death",
                "Class II - temporary or reversible harm",
                "Class III - unlikely to cause harm"
              ]
            },
            "default": []
          },
          "rootCauses": {
            "title": "Root causes",
            "type": "array",
            "description": "Filter by the category this actor derives from the free-text recall reason. This field does not exist at the FDA. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "undeclared_allergen",
                "microbial_contamination",
                "sterility_failure",
                "foreign_material",
                "nitrosamine_impurity",
                "impurity_degradation",
                "potency_variance",
                "dissolution_stability",
                "cross_contamination",
                "mislabeling",
                "packaging_defect",
                "software_defect",
                "device_malfunction",
                "cgmp_deviation",
                "unapproved_product",
                "adulteration",
                "unclassified"
              ]
            },
            "default": []
          },
          "state": {
            "title": "Firm state",
            "type": "string",
            "description": "Two-letter US state of the recalling firm, e.g. CA. Leave empty for all.",
            "default": ""
          },
          "status": {
            "title": "Recall status",
            "enum": [
              "",
              "Ongoing",
              "Completed",
              "Terminated",
              "Pending"
            ],
            "type": "string",
            "description": "Ongoing recalls are the ones still in the field.",
            "default": ""
          },
          "fromDate": {
            "title": "Reported from",
            "type": "string",
            "description": "ISO date, e.g. 2025-01-01. Filters on the FDA report date. Leave empty for no lower bound.",
            "default": "2025-01-01"
          },
          "toDate": {
            "title": "Reported to",
            "type": "string",
            "description": "ISO date. Leave empty for no upper bound.",
            "default": ""
          },
          "includeRecalls": {
            "title": "Include recall rows",
            "type": "boolean",
            "description": "Return one row per recall. Turn off to get only the per-firm rollup.",
            "default": true
          },
          "includeFirmSummary": {
            "title": "Include firm summaries",
            "type": "boolean",
            "description": "Return one row per recalling firm: recall count, Class I share, dominant root cause, repeat-offender flag.",
            "default": true
          },
          "minRecallsForSummary": {
            "title": "Minimum recalls for a firm summary",
            "minimum": 1,
            "type": "integer",
            "description": "Set to 2 or more to see only firms with a pattern rather than a single incident.",
            "default": 1
          },
          "maxRecordsPerType": {
            "title": "Max recalls per product type",
            "minimum": 1,
            "maximum": 25000,
            "type": "integer",
            "description": "openFDA serves 1000 per page and allows paging to 25,000.",
            "default": 200
          },
          "apiKey": {
            "title": "openFDA API key (optional)",
            "type": "string",
            "description": "Not required. Anonymous callers share 1,000 requests per day per IP; a free key from open.fda.gov raises that to 120,000. Deliberately has no default: Apify rejects an input schema that gives a default to an isSecret field."
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. openFDA is a public API and does not require a proxy.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}