{
  "openapi": "3.0.1",
  "info": {
    "title": "openFDA Recall Monitor: Food, Drug & Device Enforcement Reports",
    "description": "Watch FDA food, drug and medical device recalls (openFDA enforcement reports) in one run. Filter by keyword, firm, Class I/II/III, firm state or distribution state. Monitor mode outputs only new recalls. ISO dates, UPC/NDC, FDA links. $0.50 per 1,000.",
    "version": "1.0",
    "x-build-id": "DsTi0jTgsml055XMu"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tali-works~openfda-recall-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tali-works-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/tali-works~openfda-recall-monitor/runs": {
      "post": {
        "operationId": "runs-sync-tali-works-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/tali-works~openfda-recall-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-tali-works-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",
        "properties": {
          "categories": {
            "title": "Product categories",
            "type": "array",
            "description": "Which openFDA enforcement report endpoints to search. All three are searched in one run by default.",
            "items": {
              "type": "string",
              "enum": [
                "food",
                "drug",
                "device"
              ],
              "enumTitles": [
                "Food (incl. dietary supplements)",
                "Drugs",
                "Medical devices"
              ]
            }
          },
          "keywords": {
            "title": "Keywords (any of)",
            "type": "array",
            "description": "Words or phrases, e.g. an ingredient (peanut, sesame), a pathogen (listeria, salmonella), a product type (eye drops) or a brand. A recall matches if ANY keyword appears in the fields chosen below. openFDA matches WHOLE WORDS, case-insensitive (not fragments: 'peanut' may not find 'peanuts', so add variants); phrases are matched as phrases. The output's matchedKeywords is a simple substring check and can be empty for stemmed matches.",
            "items": {
              "type": "string"
            }
          },
          "keywordFields": {
            "title": "Search keywords in",
            "type": "array",
            "description": "Default: product description and reason for recall.",
            "items": {
              "type": "string",
              "enum": [
                "product_description",
                "reason_for_recall",
                "code_info",
                "recalling_firm",
                "distribution_pattern"
              ],
              "enumTitles": [
                "Product description (brands, UPCs, sizes)",
                "Reason for recall",
                "Code info (lots, dates)",
                "Recalling firm",
                "Distribution pattern"
              ]
            }
          },
          "firms": {
            "title": "Recalling firms (any of)",
            "type": "array",
            "description": "Only recalls by these companies, e.g. your suppliers or competitors. Matched as a phrase in the recalling firm name (e.g. 'Medline' matches 'Medline Industries, LP'). Note the recalling firm can be a distributor or purchasing entity rather than the brand on the label; to catch a brand, add it to Keywords.",
            "items": {
              "type": "string"
            }
          },
          "reasonKeywords": {
            "title": "Reason for recall contains (any of)",
            "type": "array",
            "description": "Extra filter on the reason text, combined with AND with the keywords above, e.g. 'undeclared' or 'sterility'.",
            "items": {
              "type": "string"
            }
          },
          "classifications": {
            "title": "Classification",
            "type": "array",
            "description": "Class I = reasonable probability of serious health consequences or death; Class II = temporary or reversible health consequences; Class III = unlikely to cause adverse health consequences. Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "Class I",
                "Class II",
                "Class III",
                "Not Yet Classified"
              ]
            }
          },
          "firmStates": {
            "title": "Recalling firm state",
            "type": "array",
            "description": "US state of the recalling firm's address, as 2-letter code (TX) or name (Texas).",
            "items": {
              "type": "string"
            }
          },
          "distributedTo": {
            "title": "Distributed to state",
            "type": "array",
            "description": "Keep only recalls whose distribution pattern mentions one of these US states (code or name). FDA writes this as free text, so matching is best-effort.",
            "items": {
              "type": "string"
            }
          },
          "includeNationwide": {
            "title": "Distributed to: include nationwide recalls",
            "type": "boolean",
            "description": "With 'Distributed to state' set, also keep recalls whose distribution says nationwide.",
            "default": true
          },
          "statuses": {
            "title": "Recall status",
            "type": "array",
            "description": "Empty = all. This is the status AT PUBLICATION: openFDA does not update it later, so it is not the current status. Check current status on FDA's Enforcement Report (fda.gov).",
            "items": {
              "type": "string",
              "enum": [
                "Ongoing",
                "Completed",
                "Terminated"
              ]
            }
          },
          "excludeKeywords": {
            "title": "Exclude if text contains",
            "type": "array",
            "description": "Drop recalls whose product description, reason or firm contains any of these words (case-insensitive substring). Dropped rows are not charged.",
            "items": {
              "type": "string"
            }
          },
          "lookbackDays": {
            "title": "Look back (days)",
            "minimum": 0,
            "type": "integer",
            "description": "Date window, counted back from the day of the run (or from 'Date to'), not from openFDA's last update. openFDA is updated weekly and often lags FDA's website by one to two weeks, so keep at least 30 days for monitors.",
            "default": 30
          },
          "dateFrom": {
            "title": "Date from",
            "type": "string",
            "description": "Optional YYYY-MM-DD. Overrides 'Look back'. openFDA enforcement data starts in 2004."
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "Optional YYYY-MM-DD. Default today."
          },
          "dateField": {
            "title": "Date filter applies to",
            "enum": [
              "report_date",
              "recall_initiation_date",
              "center_classification_date"
            ],
            "type": "string",
            "description": "Which date the window filters on.",
            "default": "report_date"
          },
          "maxItems": {
            "title": "Max recalls per category per run (cost cap)",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many rows per category (newest report first). 0 = no cap. In monitor mode a capped first run gives an incomplete baseline: older rows that didn't fit are returned on later runs only while they're still inside the look-back window.",
            "default": 1000
          },
          "onlyNew": {
            "title": "Monitor mode: only new recalls",
            "type": "boolean",
            "description": "Remember what earlier runs returned (named key-value store 'fda-recall-monitor-state') and output only recall records not returned before. Already-seen records are free. It does NOT re-alert when a returned recall is later reclassified or changes status. Schedule the Actor (Schedules > Create), e.g. daily.",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Optional name for this monitor's memory, e.g. 'supplier-watch'. With a key, the memory is kept when you edit the filters (already-returned records stay suppressed; newly matching ones are output). Without a key, the memory is tied to your exact filters, so changing any filter starts a fresh baseline and re-returns (and charges for) the whole window."
          },
          "apiKey": {
            "title": "openFDA API key (optional)",
            "type": "string",
            "description": "Free key from open.fda.gov/apis/authentication. Without a key openFDA allows 1,000 requests per day per IP address, shared with other users of the same IP. A filtered run usually makes 1 request per category; large pulls page 1,000 rows per request and use more."
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}