# FDA Drug Shortage Supply Change Report (`taroyamada/fda-drug-shortage-supply-change-report`) Actor

Track official openFDA drug shortage records by generic name, package NDC, manufacturer, status, availability, and update date. Receive source-linked public-record change alerts, supply reports, and exports. API key is optional; baseline and unchanged checks emit no rows and no charges.

- **URL**: https://apify.com/taroyamada/fda-drug-shortage-supply-change-report.md
- **Developed by:** [naoki anzai](https://apify.com/taroyamada) (community)
- **Categories:** Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 fda drug shortage rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## FDA Drug Shortage Supply Change Report

Pharma supply-chain, procurement, and regulatory-operations teams provide bounded drug shortage watches. The Actor reads official openFDA shortage records and returns source-linked change alerts, descriptive supply reports, and JSON exports.

It uses the official openFDA Drug Shortages API. No API key or login is required for normal use; an optional user-supplied openFDA key can be provided for regular high-volume use. The Actor never returns the source contact field and does not make medical, treatment, safety, causal, legal, or procurement recommendations.

### Store Quickstart

1. Start with `initialRunMode: "baseline_only"` to save the current public records without rows or charges.
2. Run the same `monitorKey` later with `generateReport: true` and `emitUnchanged: false` to receive only new or changed records.
3. Use `initialRunMode: "emit_backfill"` once when an explicit first report is wanted. Set `emitExport: true` for a compact source-linked export.

### Run the next report

- Review source-linked device clearance changes with [FDA 510(k) Device Clearance Landscape Report](https://apify.com/taroyamada/fda-510k-device-clearance-landscape-report).
- Compare public drug patent, exclusivity, and product-lifecycle changes with [FDA Orange Book Patent & Exclusivity Change Report](https://apify.com/taroyamada/fda-orange-book-patent-exclusivity-change-report).

#### Example 1: current injectable watch

```json
{
  "watches": [{
    "id": "current-injectables",
    "statuses": ["Current"],
    "dosageForms": ["Injection"],
    "updateDateFrom": "2026-01-01",
    "updateDateTo": "2026-12-31"
  }],
  "monitorKey": "hospital-injectables",
  "initialRunMode": "baseline_only",
  "generateReport": true,
  "emitUnchanged": false
}
````

#### Example 2: named product and manufacturer watch

```json
{
  "watches": [{
    "id": "hydromorphone-hospira",
    "genericNames": ["Hydromorphone Hydrochloride Injection"],
    "companyNames": ["Hospira"],
    "packageNdcs": ["0409-1805-01"]
  }],
  "monitorKey": "named-product-watch",
  "initialRunMode": "emit_backfill",
  "generateReport": true,
  "emitExport": true,
  "maxChargeUsd": 25
}
```

#### Example 3: availability and update watch

```json
{
  "watches": [{
    "id": "limited-or-unavailable",
    "availabilities": ["Limited Availability", "Unavailable"],
    "updateTypes": ["New", "Revised"],
    "therapeuticCategories": ["Cardiovascular"]
  }],
  "monitorKey": "availability-review",
  "initialRunMode": "baseline_only",
  "generateReport": true,
  "emitExport": true
}
```

### Outputs and pricing

The primary output is a descriptive change report. Raw records are optional and lower priced.

| Event | Price | What it contains |
| --- | ---: | --- |
| `fda-shortage-row` | `$0.005` | One normalized public shortage record |
| `fda-shortage-change-alert` | `$0.25` | One source-linked new or changed-record alert |
| `fda-shortage-supply-report` | `$10` | Aggregate report by status, availability, company, and generic name |
| `fda-shortage-export` | `$6` | Compact source-linked JSON export |

The first baseline run and a later unchanged run emit zero rows and zero charge. A run fails closed if planned charges exceed `maxChargeUsd`, a configured event is unknown, delivery does not return charge proof, or state cannot be saved.

### What the change types mean

- `shortage_record_added`: a matching public record was not in the previous snapshot.
- `availability_changed`: the public `availability` field changed.
- `status_changed`: the public `status` field changed.
- `supply_update_changed`: another tracked public update, date, presentation, or information field changed.

These are source changes, not conclusions about clinical care or future supply.

### Compliance guardrails

- Official `https://api.fda.gov/drug/shortages.json` only.
- No login, browser automation, private FDA system, or bypass behavior.
- The API key is optional and is never written to output, state, audit data, or source URLs.
- Source contact fields are excluded from normalized output.
- No replacement-drug suggestions, treatment directions, safety conclusions, causal conclusions, procurement recommendations, or patient-specific interpretations.
- Verify the linked FDA record and consult qualified professionals before acting.

### Integration

See [docs/integration-guide.md](docs/integration-guide.md) for recurring state-safe runs, and [docs/sample-output.json](docs/sample-output.json) for the report/alert/export contract.

### See also

- [FDA 510(k) Device Clearance Landscape Report](https://apify.com/taroyamada/fda-510k-device-clearance-landscape-report)
- [FDA Orange Book Patent & Exclusivity Change Report](https://apify.com/taroyamada/fda-orange-book-patent-exclusivity-change-report)

The neighboring actor covers public device-clearance records. This Actor is limited to openFDA drug-shortage record changes.

# Actor input Schema

## `watches` (type: `array`):

Bounded recurring searches. Use a stable id and at least one filter per watch.

## `monitorKey` (type: `string`):

Stable isolated state namespace for a recurring shortage watch.

## `initialRunMode` (type: `string`):

baseline\_only stores the first observation with zero rows; emit\_backfill emits current matches for an explicit first report.

## `generateReport` (type: `boolean`):

Generate one aggregate descriptive report when new or changed observations are emitted.

## `emitRawRows` (type: `boolean`):

Emit one normalized public shortage row for each new or changed record. This is the low-priced row event.

## `emitExport` (type: `boolean`):

Generate a compact JSON-ready export when new or changed observations are emitted.

## `emitUnchanged` (type: `boolean`):

Accepted for compatibility, but unchanged observations always remain zero rows and zero charge for billing safety.

## `maxRecordsPerWatch` (type: `integer`):

Maximum records requested from openFDA per watch. The official API maximum is 100.

## `maxChargeUsd` (type: `number`):

Fail closed before pushing any row if planned PPE charges exceed this cap.

## `openfdaApiKey` (type: `string`):

Optional user-supplied openFDA key. Leave blank: normal use does not require a key. The key is never written to output, source URLs, or state.

## `dryRun` (type: `boolean`):

Return representative event rows without calling openFDA, saving state, or charging PPE events.

## Actor input object example

```json
{
  "watches": [
    {
      "id": "current-injectable-shortages-2026",
      "statuses": [
        "Current"
      ],
      "dosageForms": [
        "Injection"
      ],
      "updateDateFrom": "2026-01-01",
      "updateDateTo": "2026-12-31"
    }
  ],
  "monitorKey": "fda-drug-shortage-watch",
  "initialRunMode": "baseline_only",
  "generateReport": true,
  "emitRawRows": false,
  "emitExport": false,
  "emitUnchanged": false,
  "maxRecordsPerWatch": 50,
  "maxChargeUsd": 25,
  "dryRun": false
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "watches": [
        {
            "id": "current-injectable-shortages-2026",
            "statuses": [
                "Current"
            ],
            "dosageForms": [
                "Injection"
            ],
            "updateDateFrom": "2026-01-01",
            "updateDateTo": "2026-12-31"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("taroyamada/fda-drug-shortage-supply-change-report").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "watches": [{
            "id": "current-injectable-shortages-2026",
            "statuses": ["Current"],
            "dosageForms": ["Injection"],
            "updateDateFrom": "2026-01-01",
            "updateDateTo": "2026-12-31",
        }] }

# Run the Actor and wait for it to finish
run = client.actor("taroyamada/fda-drug-shortage-supply-change-report").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "watches": [
    {
      "id": "current-injectable-shortages-2026",
      "statuses": [
        "Current"
      ],
      "dosageForms": [
        "Injection"
      ],
      "updateDateFrom": "2026-01-01",
      "updateDateTo": "2026-12-31"
    }
  ]
}' |
apify call taroyamada/fda-drug-shortage-supply-change-report --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=taroyamada/fda-drug-shortage-supply-change-report",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "FDA Drug Shortage Supply Change Report",
        "description": "Track official openFDA drug shortage records by generic name, package NDC, manufacturer, status, availability, and update date. Receive source-linked public-record change alerts, supply reports, and exports. API key is optional; baseline and unchanged checks emit no rows and no charges.",
        "version": "0.1",
        "x-build-id": "0Tn3kxmypws2C1HAC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/taroyamada~fda-drug-shortage-supply-change-report/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-taroyamada-fda-drug-shortage-supply-change-report",
                "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/taroyamada~fda-drug-shortage-supply-change-report/runs": {
            "post": {
                "operationId": "runs-sync-taroyamada-fda-drug-shortage-supply-change-report",
                "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/taroyamada~fda-drug-shortage-supply-change-report/run-sync": {
            "post": {
                "operationId": "run-sync-taroyamada-fda-drug-shortage-supply-change-report",
                "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": [
                    "watches"
                ],
                "properties": {
                    "watches": {
                        "title": "Shortage watches",
                        "type": "array",
                        "description": "Bounded recurring searches. Use a stable id and at least one filter per watch.",
                        "default": []
                    },
                    "monitorKey": {
                        "title": "Monitor key",
                        "type": "string",
                        "description": "Stable isolated state namespace for a recurring shortage watch.",
                        "default": "fda-drug-shortage-watch"
                    },
                    "initialRunMode": {
                        "title": "Initial run mode",
                        "enum": [
                            "baseline_only",
                            "emit_backfill"
                        ],
                        "type": "string",
                        "description": "baseline_only stores the first observation with zero rows; emit_backfill emits current matches for an explicit first report.",
                        "default": "baseline_only"
                    },
                    "generateReport": {
                        "title": "Generate supply report",
                        "type": "boolean",
                        "description": "Generate one aggregate descriptive report when new or changed observations are emitted.",
                        "default": true
                    },
                    "emitRawRows": {
                        "title": "Emit shortage rows",
                        "type": "boolean",
                        "description": "Emit one normalized public shortage row for each new or changed record. This is the low-priced row event.",
                        "default": false
                    },
                    "emitExport": {
                        "title": "Generate shortage export",
                        "type": "boolean",
                        "description": "Generate a compact JSON-ready export when new or changed observations are emitted.",
                        "default": false
                    },
                    "emitUnchanged": {
                        "title": "Emit unchanged observations",
                        "type": "boolean",
                        "description": "Accepted for compatibility, but unchanged observations always remain zero rows and zero charge for billing safety.",
                        "default": false
                    },
                    "maxRecordsPerWatch": {
                        "title": "Maximum records per watch",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum records requested from openFDA per watch. The official API maximum is 100.",
                        "default": 50
                    },
                    "maxChargeUsd": {
                        "title": "Maximum charge USD",
                        "minimum": 0.005,
                        "maximum": 250,
                        "type": "number",
                        "description": "Fail closed before pushing any row if planned PPE charges exceed this cap.",
                        "default": 25
                    },
                    "openfdaApiKey": {
                        "title": "Optional openFDA API key",
                        "type": "string",
                        "description": "Optional user-supplied openFDA key. Leave blank: normal use does not require a key. The key is never written to output, source URLs, or state."
                    },
                    "dryRun": {
                        "title": "Dry run",
                        "type": "boolean",
                        "description": "Return representative event rows without calling openFDA, saving state, or charging PPE events.",
                        "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
