{
  "openapi": "3.0.1",
  "info": {
    "title": "openFDA Approvals Monitor",
    "description": "Change-detection over the FDA approval and clearance stream: new drug approvals (Drugs@FDA), device 510(k) clearances and PMA approvals, unified into one normalized approval record (regulator, applicant, product, date, pathway). Filter by applicant, endpoint or date. Keyless, CC0.",
    "version": "0.1",
    "x-build-id": "uQ7T2iS2tRIqbpZKl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bytehavenstudios~openfda-approvals-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bytehavenstudios-openfda-approvals-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/bytehavenstudios~openfda-approvals-monitor/runs": {
      "post": {
        "operationId": "runs-sync-bytehavenstudios-openfda-approvals-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/bytehavenstudios~openfda-approvals-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-bytehavenstudios-openfda-approvals-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": {
          "endpoints": {
            "title": "Approval streams",
            "type": "array",
            "description": "Which openFDA approval endpoints to query. drug = /drug/drugsfda.json (new drug approvals — first `AP` submission), 510k = /device/510k.json (device 510(k) clearances), pma = /device/pma.json (device PMA approvals + supplements). Empty = all three (the cross-silo moat).",
            "items": {
              "type": "string",
              "enum": [
                "drug",
                "510k",
                "pma"
              ],
              "enumTitles": [
                "Drug approvals (Drugs@FDA)",
                "Device 510(k) clearances",
                "Device PMA approvals"
              ]
            }
          },
          "applicants": {
            "title": "Applicants / sponsors to watch",
            "type": "array",
            "description": "Optional. Restrict to approvals whose applicant/sponsor matches one of these names (case-insensitive substring, e.g. \"Pfizer\", \"Medtronic\"). Matched against the drug `sponsor_name` and the device `applicant`. Empty = all applicants (competitor-watch is opt-in).",
            "items": {
              "type": "string"
            }
          },
          "productCodes": {
            "title": "Device product codes to watch",
            "type": "array",
            "description": "Optional. Restrict device (510k / PMA) approvals to these FDA product codes (3-letter codes, e.g. \"DXN\", \"OZO\"). Ignored for the drug endpoint. Empty = all product codes.",
            "items": {
              "type": "string"
            }
          },
          "approvedSince": {
            "title": "Approved on/after (YYYY-MM-DD)",
            "type": "string",
            "description": "Only return approvals dated on/after this date. Maps to the openFDA date-range search per endpoint (drug: submissions.submission_status_date; device: decision_date). Leave empty to default to a recent trailing window. Ignored if 'Only new since last run' is on (the stored per-endpoint watermark drives the window instead)."
          },
          "approvedUntil": {
            "title": "Approved on/before (optional upper bound, YYYY-MM-DD)",
            "type": "string",
            "description": "Optional upper bound on the approval/decision date. Leave empty for no upper bound (up to today)."
          },
          "monitorNewOnly": {
            "title": "Only new since last run",
            "type": "boolean",
            "description": "Persist a per-endpoint high-water-mark (the max approval date seen, in the Actor's key-value store) and, on the next run, emit only approvals dated after it. Turns this Actor into a first-seen new-approval monitor across scheduled runs.",
            "default": false
          },
          "fields": {
            "title": "Fields to keep",
            "type": "array",
            "description": "Optional. Override the set of fields kept on each normalized approval record. Empty = a sensible default set (see README). Applied client-side (openFDA does not project the approval endpoints server-side).",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "Max approvals per run",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the total number of approvals returned (across all selected endpoints). 0 = no cap (paginate to openFDA's per-query ceiling, windowing dates as needed).",
            "default": 0
          },
          "apiKey": {
            "title": "openFDA API key (optional)",
            "type": "string",
            "description": "Optional free openFDA api_key. Keyless access allows 240 requests/min and 1000/day per IP; a key raises the daily limit to 120,000. Not required for typical scheduled runs. Get one at https://open.fda.gov/apis/authentication/."
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. The openFDA API is a clean, open, public endpoint and needs NO proxy. You may enable Apify Proxy only to distribute requests if you run very large historical pulls. Default: no 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}