{
  "openapi": "3.0.1",
  "info": {
    "title": "FDA Recall Monitor API — Drug, Device & Food Recalls (JSON)",
    "description": "Monitor FDA drug, device & food recalls for internal QA/compliance workflows via the official openFDA API. Not for public recall alerts — see openFDA terms.",
    "version": "0.1",
    "x-build-id": "CAjjfD762QczZBk9F"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mooseandraven~openfda-recall-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mooseandraven-openfda-recall-monitor",
        "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/mooseandraven~openfda-recall-monitor/runs": {
      "post": {
        "operationId": "runs-sync-mooseandraven-openfda-recall-monitor",
        "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/mooseandraven~openfda-recall-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-mooseandraven-openfda-recall-monitor",
        "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": [
          "categories"
        ],
        "properties": {
          "categories": {
            "title": "Recall categories to check",
            "type": "array",
            "description": "Which openFDA recall categories to check. \"drug\" and \"food\" both carry an official Class I/II/III severity classification; \"device\" recalls do not (FDA doesn't publish a comparable classification field for devices — see README).",
            "items": {
              "type": "string",
              "enum": [
                "drug",
                "device",
                "food"
              ]
            },
            "default": [
              "drug",
              "device",
              "food"
            ]
          },
          "companies": {
            "title": "Company/firm names to watch (optional)",
            "type": "array",
            "description": "Recalling-firm names to filter by — a tokenized phrase match against the official recalling_firm field (e.g. \"Pfizer\" matches \"Pfizer Inc.\", \"Pfizer Laboratories\", etc.), not a literal exact-string match. Leave empty to fetch all recent recalls in each selected category instead (subject to maxRecordsPerCategory).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "classification": {
            "title": "Severity classification filter (drug/food only)",
            "type": "array",
            "description": "Optional filter to Class I / Class II / Class III recalls. Has no effect on the \"device\" category, which doesn't have this field.",
            "items": {
              "type": "string",
              "enum": [
                "Class I",
                "Class II",
                "Class III"
              ]
            },
            "default": []
          },
          "keywords": {
            "title": "Keyword filter (optional)",
            "type": "array",
            "description": "Filter to recalls whose product_description OR reason_for_recall contains any of these terms. Server-side text search against api.fda.gov (confirmed live) — not a fetch-everything-then-filter-locally approach, so it doesn't over-fetch. Multiple keywords are OR'd together (matches if ANY keyword appears in EITHER field, not \"must contain all\"). Example: [\"listeria\", \"undeclared allergen\"]. Leave empty for no keyword filtering.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "Recall initiated on/after (optional)",
            "type": "string",
            "description": "YYYYMMDD format (e.g. \"20240101\"). Filters by the recall's initiation date — drug/food use the recall_initiation_date field, device uses the differently-named event_date_initiated field (confirmed live real field names; this actor maps automatically per category). Validated client-side before any request is sent — a malformed date is rejected with a clear error rather than silently reaching the API."
          },
          "dateTo": {
            "title": "Recall initiated on/before (optional)",
            "type": "string",
            "description": "YYYYMMDD format (e.g. \"20241231\"). Same field mapping as dateFrom. If both are set, dateFrom must not be after dateTo."
          },
          "status": {
            "title": "Recall status filter (optional)",
            "type": "array",
            "description": "Filters by the recall's current status. drug/food use the \"status\" field (confirmed live real values: \"Ongoing\", \"Completed\", \"Terminated\"); device uses a differently-named \"recall_status\" field with a DIFFERENT confirmed value set (\"Open, Classified\" instead of \"Ongoing\", plus \"Completed\"/\"Terminated\") — this is a genuinely different vocabulary, not just a renamed field. This actor maps your value(s) to the category-correct field automatically, but does not translate values between categories — a value only valid for one category's vocabulary has no effect on another category's results. Leave empty for no status filtering.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "monitorMode": {
            "title": "Incremental monitor mode",
            "type": "boolean",
            "description": "When on, the actor remembers which recalls it has already delivered per category (Apify key-value store) and only reports genuinely NEW recalls on later runs. Charges one monitor-run PPE event in addition to per-recall events.",
            "default": false
          },
          "maxRecordsPerCategory": {
            "title": "Max recalls per category per run",
            "minimum": 1,
            "type": "integer",
            "description": "Applied INDEPENDENTLY to each category in `categories` (not shared across them). Default 500. If a category has more matching recalls than this, the actor emits a loud `category-truncated` record with the real total — it never reports a capped pull as a complete one.",
            "default": 500
          },
          "maxRecords": {
            "title": "Max total recalls across ALL categories combined (optional)",
            "minimum": 1,
            "type": "integer",
            "description": "An aggregate cap across every category in `categories` combined, in ADDITION to (not instead of) maxRecordsPerCategory's per-category cap — whichever limit is hit first applies. Categories are still fetched in the order given, but once this aggregate total is reached, any remaining categories are explicitly SKIPPED (a category-skipped record is emitted, never a silent empty result). Leave unset for the normal behavior where each category independently gets up to maxRecordsPerCategory."
          },
          "apiKey": {
            "title": "openFDA API key (optional)",
            "type": "string",
            "description": "Optional free openFDA API key (register at open.fda.gov/apis/authentication). Without a key: 240 requests/minute, 1,000/day, per IP address. With a free key: same 240/minute, but 120,000/day. Not required for normal use — only matters for high-volume scheduled monitoring."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}