# FDA Drugs@FDA, Generic ANDA & Orange Book Patent Cliff Scraper (`groundplanes/openfda-drugsfda-anda-approval-scraper`) Actor

Scrape FDA NDA new drug and ANDA generic approvals, patent expirations, exclusivity dates, and therapeutic equivalence (TE) codes from Drugs@FDA and official Orange Book archives.

- **URL**: https://apify.com/groundplanes/openfda-drugsfda-anda-approval-scraper.md
- **Developed by:** [Groundplane Labs](https://apify.com/groundplanes) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 1,000 applications

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## FDA Drugs@FDA, Generic ANDA & Orange Book Patent Cliff Scraper

Extract official FDA New Drug Applications (NDA), Abbreviated New Drug Applications (ANDA generics), Orange Book patent expiration cliffs, regulatory market exclusivities, and therapeutic equivalence (TE) ratings from openFDA Drugs@FDA and the official Electronic Orange Book monthly data archive.

> This actor is an independent product and is not affiliated with, endorsed by, or sponsored by the US Food and Drug Administration (FDA) or the US Department of Health and Human Services (HHS).

### What it does

- **Patent Expiration Cliffs:** Scan upcoming patent expirations across branded NDA drugs within a customizable forward-looking horizon (e.g. 12, 24, 36 months).
- **Recent Clearances:** Track recent FDA drug application approvals and supplemental submissions across NDAs, ANDAs, and BLAs.
- **First-Time Generics:** Identify pioneer generic market entrants where an approved ANDA has zero or minimal competing generic equivalents.
- **Therapeutic Equivalence (TE Codes):** Deliver official FDA Orange Book ratings (`AB`, `AP`, `AN`, etc.) indicating bioequivalence to reference listed drugs.
- **Generic Competition Counts:** Calculate exact counts of Orange Book listed ANDA applications sharing the active molecule and dosage form (`approvedGenericAndaCount`). The count covers Orange Book listed ANDAs only; Drugs@FDA counts additional approved ANDAs that are not Orange Book listed.
- **BLA Purple Book Separation:** Restricts biologics (BLAs) to general clearance monitoring mode with patent fields nulled, preventing misleading Orange Book data (biologics reside in FDA's Purple Book).
- **Freshness Sentinel:** Verifies monthly Orange Book publication release dates and alerts if the archive exceeds 45 days.

### Who it's for

- **Generic Pharmaceutical Manufacturers:** Identify patent expiration windows, exclusivity cliffs, and competitive generic filing counts.
- **Life Sciences & Biotech Equity Analysts:** Model revenue erosion timelines for branded blockbusters losing market exclusivity.
- **Pharmaceutical Licensing & BD Executives:** Evaluate therapeutic equivalence status and competitor ANDA market entries.
- **Healthcare IP & Patent Litigation Counsel:** Track Orange Book listed patent numbers, submission dates, and regulatory exclusivity codes (NCE, ODE, PED, etc.).

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `queryMode` | string (select) | `"ORANGE_BOOK_EXPIRING_PATENTS"` | `"ORANGE_BOOK_EXPIRING_PATENTS"`, `"RECENT_NDA_ANDA_APPROVALS"`, or `"FIRST_TIME_GENERICS"`. |
| `applicationTypes` | array | `["NDA", "ANDA", "BLA"]` | Application types (`NDA`, `ANDA`, `BLA`). Note: `BLA` is only supported in recent approvals mode; it is removed from the Orange Book modes because biologics are listed in the Purple Book, not the Orange Book. |
| `patentExpiringWithinMonths` | integer | `24` | Months into the future to scan for patent expirations. |
| `activeIngredientKeyword` | string | `""` | Molecule or active ingredient name filter (e.g. `apixaban`, `ibuprofen`). |
| `submissionStatusDateFrom` | string | `90 days before run date` | Earliest approval date (`YYYY-MM-DD` or `YYYYMMDD`). |
| `submissionStatusDateTo` | string | `Run date` | Latest approval date (`YYYY-MM-DD` or `YYYYMMDD`). |
| `openFdaApiKey` | string (secret) | `""` | Optional free openFDA API key for higher rate limits on Drugs@FDA queries. |
| `maxItems` | integer | `1000` | Maximum application records to deliver. |

#### Example input

```json
{
  "queryMode": "ORANGE_BOOK_EXPIRING_PATENTS",
  "applicationTypes": ["NDA", "ANDA"],
  "patentExpiringWithinMonths": 24,
  "activeIngredientKeyword": "apixaban",
  "maxItems": 1000
}
```

### Output

One row per drug application record.

| Field | Type | Description |
|---|---|---|
| `applicationNumber` | string | FDA application identifier (e.g. `NDA020610`, `ANDA076560`). |
| `applicationType` | string | Regulatory pathway (`NDA`, `ANDA`, `BLA`). |
| `sponsorName` | string or null | Applicant or pharmaceutical sponsor entity. |
| `brandName` | string or null | Proprietary trade or brand name. |
| `activeIngredients` | array of objects | Active chemical ingredients and strengths (`name`, `strength`). |
| `dosageForm` | string or null | Pharmaceutical form (e.g. `TABLET`, `CAPSULE`, `INJECTABLE`). |
| `route` | string or null | Administration route (e.g. `ORAL`, `INTRAVENOUS`). |
| `marketingStatus` | string or null | Regulatory status (`Prescription`, `Over-the-counter`, `Discontinued`). |
| `teCodeTherapeuticEquivalence` | string or null | Therapeutic equivalence rating (e.g. `AB`, `AP`). |
| `referenceListedDrugRld` | string or null | Reference Listed Drug flag (`Yes`, `No`). |
| `latestSubmissionType` | string or null | Most recent submission type (`ORIG`, `SUPPL`). |
| `latestSubmissionStatusDate` | string or null | Date of latest submission approval disposition (`YYYY-MM-DD`). |
| `patentNumbers` | array of strings | Listed Orange Book patent numbers. |
| `earliestPatentExpireDate` | string or null | Earliest patent expiration date (`YYYY-MM-DD`). |
| `latestPatentExpireDate` | string or null | Latest patent expiration date (`YYYY-MM-DD`). |
| `exclusivityCodes` | array of strings | Statutory market exclusivity codes (e.g. `NCE`, `RTO`). |
| `exclusivityExpireDate` | string or null | Expiration date of active market exclusivity (`YYYY-MM-DD`). |
| `approvedGenericAndaCount` | integer | Count of Orange Book listed ANDA applications sharing the same active ingredient and dosage form. Orange Book listed ANDAs only: Drugs@FDA counts additional approved ANDAs that are not Orange Book listed, so a Drugs@FDA count for the same ingredient and form can be higher. |

#### Sample row (real, live FDA data)

```json
{
  "applicationNumber": "NDA020610",
  "applicationType": "NDA",
  "sponsorName": "VALEANT PHARMACEUTICALS INTERNATIONAL",
  "brandName": "COLAZAL",
  "activeIngredients": [
    {
      "name": "BALSALAZIDE DISODIUM",
      "strength": "750MG"
    }
  ],
  "dosageForm": "CAPSULE",
  "route": "ORAL",
  "marketingStatus": "Prescription",
  "teCodeTherapeuticEquivalence": "AB",
  "referenceListedDrugRld": "Yes",
  "latestSubmissionType": null,
  "latestSubmissionStatusDate": null,
  "patentNumbers": [
    "7625884",
    "7452872",
    "7452872*PED",
    "7625884*PED"
  ],
  "earliestPatentExpireDate": "2026-08-24",
  "latestPatentExpireDate": "2027-02-24",
  "exclusivityCodes": [],
  "exclusivityExpireDate": null,
  "approvedGenericAndaCount": 5
}
```

### Source and cadence

- Drugs@FDA data comes from the openFDA Drugs@FDA API (`api.fda.gov/drug/drugsfda.json`), updated by FDA on its own schedule (the API reports its own `last_updated` date; it is not real-time).
- Orange Book data comes from the official FDA Electronic Orange Book zip archive, published monthly. The current zip is located from the FDA Orange Book download page at run time, and the run status records the archive release date. If the archive is more than about 45 days old, the run ends PARTIAL with a staleness note.
- In the two Orange Book modes (`ORANGE_BOOK_EXPIRING_PATENTS` and `FIRST_TIME_GENERICS`), rows are built from the Orange Book files, so `latestSubmissionType` and `latestSubmissionStatusDate` are null there; those fields are populated in `RECENT_NDA_ANDA_APPROVALS` mode from Drugs@FDA.
- `approvedGenericAndaCount` counts distinct ANDA applications in the Orange Book sharing the same active ingredient and dosage form. It covers Orange Book listed applications; Drugs@FDA also contains approved ANDAs that are not Orange Book listed, so a Drugs@FDA application count for the same ingredient and form can be higher.
- Representative product rule: each row is built from one representative product of its application, and the count key (active ingredient plus dosage form) always comes from that same product, so the shipped dosage form, strength, and TE code are consistent with the count. The representative is chosen deterministically: products tied to the run's filters are considered first (products with a patent expiring in the window, or matching the ingredient keyword); the representative dosage form is the form with the most products for the application (the principal form); within that form, a product with a TE code wins, then an RLD product, then the lowest product number. In `FIRST_TIME_GENERICS` mode, qualification is per dosage form: a row is built from the form for which the application is the sole Orange Book listed ANDA. In `RECENT_NDA_ANDA_APPROVALS` mode, the count is computed from the row's own Drugs@FDA ingredient and dosage form against the full Orange Book products data, even when the application itself is too new to appear in the monthly Orange Book file.
- Run status counts: `scanned` is the number of source records examined (Orange Book applications with patents, Orange Book applications, or records fetched from openFDA, depending on mode) and `matched` is the number of rows built for delivery; the two differ whenever a filter drops examined records before delivery.
- In Orange Book modes, `sponsorName` is the applicant full name from the Orange Book products file. In recent approvals mode it is the Drugs@FDA sponsor name.
- BLA (biologic) applications appear only in `RECENT_NDA_ANDA_APPROVALS` mode, with patent and exclusivity fields empty or null, because biologics are listed in the FDA Purple Book, not the Orange Book.

### Canary input

Labeled canary (small, stable): Orange Book patent mode for one well-known ingredient.

```json
{
  "queryMode": "ORANGE_BOOK_EXPIRING_PATENTS",
  "applicationTypes": ["NDA", "ANDA"],
  "patentExpiringWithinMonths": 24,
  "activeIngredientKeyword": "apixaban",
  "maxItems": 10
}
```

Expected: a Complete status with the Eliquis NDA application (NDA202155) among the rows, patent numbers populated, and the Orange Book release date named in the status counts.

### Troubleshooting

- Zero matches: a narrow filter with no matching applications is a successful run and ends with `Complete: 0 rows matched buyer criteria.` Widen the date window, the patent horizon, or clear the ingredient keyword.
- Stale Orange Book: if the monthly archive is more than about 45 days old, the run ends PARTIAL with a staleness note naming the release date. The data delivered is the newest archive FDA has published.
- Caps: `maxItems` and the run charge cap stop delivery early. A PARTIAL caused only by those user limits carries no Issues line; raise the limit and rerun to get more rows.
- openFDA paging ceiling: openFDA cannot page past 25,000 results for one query. A recent approvals window with more matches than that ends PARTIAL naming the window; split the window into smaller date ranges.
- If this keeps happening, please open an issue on this actor's Issues tab and we'll fix it fast.

### Changelog

- 0.1.2 (2026-11-01, Red Team fix round): `approvedGenericAndaCount` is now always computed from the shipped row's own active ingredient plus dosage form against the full Orange Book products data, in every mode and whether or not the application itself appears in the Orange Book; multi-form applications ship a representative product chosen by the stated deterministic rule (see Source and cadence), so dosage form, strength, and TE code match the count key; the Orange Book listed ANDAs qualifier for `approvedGenericAndaCount` now appears in the output table and the dataset schema (the count universe is Orange Book listed ANDAs; Drugs@FDA counts additional non-listed approvals); a rejected buyer `openFdaApiKey` (HTTP 401, or HTTP 403 API_KEY_INVALID from api.fda.gov) now fails as an invalid-input credential error with no Issues line and no retries; run status counts now label scanned (records examined) and matched (rows built) separately in every mode; the patent horizon now uses calendar months instead of months times 30.5 days; the sample row sponsor name was corrected to the live full applicant name.
- 0.1.1 (2026-11-01, review fixes): Orange Book zip URL is now discovered from the FDA download page instead of only hardcoded; Orange Book loading uses its own HTTP client so later Drugs@FDA calls cannot hang after the zip download; unparseable patent, exclusivity, and submission dates are counted and end the run PARTIAL instead of being silently dropped; a stale Orange Book PARTIAL now carries the Issues line; `approvedGenericAndaCount` now keys on active ingredient plus dosage form only (route no longer splits the count); default `applicationTypes` now matches the spec (NDA, ANDA, BLA); Orange Book `DISCN` rows report marketing status `Discontinued`; sponsor names in Orange Book modes use the applicant full name; recent approvals windows above the 25,000 result ceiling end PARTIAL naming the window; run status now records the Orange Book release date.
- 0.1 (2026-11-01): first build.

# Actor input Schema

## `activeIngredientKeyword` (type: `string`):

Filter by active ingredient or molecule name (e.g. ibuprofen, semaglutide, apixaban).

## `applicationTypes` (type: `array`):

Types of drug applications to include: NDA (New Drug), ANDA (Generic Drug), BLA (Biologic). Note: BLA biologics are only supported in RECENT_NDA_ANDA_APPROVALS mode.

## `maxItems` (type: `integer`):

Maximum number of drug application records to return.

## `openFdaApiKey` (type: `string`):

Optional openFDA API key for higher rate limits on Drugs@FDA queries. Keyless runs are supported.

## `patentExpiringWithinMonths` (type: `integer`):

For ORANGE_BOOK_EXPIRING_PATENTS mode, months from today into the future to look for expiring patents.

## `queryMode` (type: `string`):

Scraping mode: ORANGE_BOOK_EXPIRING_PATENTS (patent cliff analysis), RECENT_NDA_ANDA_APPROVALS (recent FDA clearances), or FIRST_TIME_GENERICS (first generic market entrants).

## `submissionStatusDateFrom` (type: `string`):

For RECENT_NDA_ANDA_APPROVALS mode, earliest approval date (YYYY-MM-DD or YYYYMMDD). Defaults to 90 days before run date.

## `submissionStatusDateTo` (type: `string`):

For RECENT_NDA_ANDA_APPROVALS mode, latest approval date (YYYY-MM-DD or YYYYMMDD). Defaults to run date.

## Actor input object example

```json
{
  "applicationTypes": [
    "NDA",
    "ANDA",
    "BLA"
  ],
  "maxItems": 1000,
  "patentExpiringWithinMonths": 24,
  "queryMode": "ORANGE_BOOK_EXPIRING_PATENTS"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("groundplanes/openfda-drugsfda-anda-approval-scraper").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("groundplanes/openfda-drugsfda-anda-approval-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call groundplanes/openfda-drugsfda-anda-approval-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,groundplanes/openfda-drugsfda-anda-approval-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ZrjXRyyrRdR6O1yYV/builds/ifVAcOu4rBpRgKNqx/openapi.json
