{
  "openapi": "3.0.1",
  "info": {
    "title": "Drug Shortage API — Delta Monitor & FDA Shortage Tracker",
    "description": "Drug shortage API on the official openFDA feed: normalized shortage records, delta monitor mode that emits only NEW or status-CHANGED shortages (new/resolved/reappeared), and therapeutic-class + dosage-form rollups of current shortages. Keyless.",
    "version": "1.1",
    "x-build-id": "31HjHpkW1fgGLJCPx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/malonestar~drug-shortage-delta-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-malonestar-drug-shortage-delta-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/malonestar~drug-shortage-delta-monitor/runs": {
      "post": {
        "operationId": "runs-sync-malonestar-drug-shortage-delta-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/malonestar~drug-shortage-delta-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-malonestar-drug-shortage-delta-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": {
          "status": {
            "title": "Shortage status",
            "enum": [
              "all",
              "Current",
              "To Be Discontinued",
              "Resolved"
            ],
            "type": "string",
            "description": "Which FDA shortage status to return. LIVE 2026-08-01 the feed holds Current 1,180 | To Be Discontinued 432 | Resolved 24. 'To Be Discontinued' is a planned permanent product discontinuation, not a supply shortage - it lives in the same FDA feed and is selectable here from v1.1 onward. Applied server-side as an openFDA search filter.",
            "default": "Current"
          },
          "therapeuticCategory": {
            "title": "Therapeutic category",
            "type": "string",
            "description": "Optional therapeutic-class filter applied server-side (openFDA therapeutic_category), e.g. 'Oncology' (135 records live), 'Psychiatry' (281), 'Analgesia/Addiction' (185), 'Cardiovascular' (161). Leave empty for all categories."
          },
          "sinceDate": {
            "title": "Updated since (YYYY-MM-DD)",
            "type": "string",
            "description": "Only return shortages whose update date (or initial posting date when no update) is on or after this date. Accepted forms: 2025-01-15 (ISO, preferred), 2025-01, 2025, or 01/15/2025 (US month/day/year). Anything else FAILS the run rather than being guessed at — this value is compared against ISO dates, so an unusable format would silently return either the entire feed or nothing at all, with no error. Leave blank for no lower bound."
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of records to fetch and normalize. The whole feed is ~1,636 records and openFDA pages at 1,000 per request, so 3,000 covers everything with headroom. Setting this BELOW the number of matching records truncates the fetch - every row will then carry feed_complete=false, the rollup counts will be computed over the subset, and delta mode will refuse to run rather than invent events for records it never read.",
            "default": 3000
          },
          "monitor": {
            "title": "Delta mode (only new / changed since last run)",
            "type": "boolean",
            "description": "When scheduled, emit only records that are NEW or whose status CHANGED since the previous run, each tagged change_type (new, resolved, reappeared, discontinuing, discontinuation_cancelled, delisted, updated). Unchanged records are skipped. State lives in a NAMED key-value store, keyed to this query scope, so a scheduled run genuinely compares against the last run. Requires a complete fetch: if maxResults truncates the feed, the run fails rather than fabricating events.",
            "default": false
          },
          "includeRollup": {
            "title": "Include therapeutic-class / dosage-form rollup",
            "type": "boolean",
            "description": "Also emit summary rows (record_type='rollup') per therapeutic_category and per dosage_form, counting current shortages, planned discontinuations, resolved records and the total.",
            "default": false
          },
          "skipDriftAssertions": {
            "title": "Skip live source-integrity checks",
            "type": "boolean",
            "description": "Diagnostic escape hatch. By default the Actor runs 10 live checks against openFDA before emitting anything billable (feed size in band, the status and update_type vocabularies still closed, a known-populated therapeutic category returning rows, a known-nonexistent one returning none, required fields present, feed freshness, and that skip= genuinely advances the page) and fails the run rather than reporting drug-supply status from a drifted source. Turn this on only if you believe a check is a false positive.",
            "default": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}