# FDA Orange Book + Purple Book Lookup and Monthly Change Feed (`hopeful_crabgrass/fda-orange-purple-book`) Actor

Joins FDA's official Orange Book data files (products, patents, exclusivity) and the Purple Book monthly biologics file into one filtered row set, with a monthly change feed. Dates only, as listed by FDA. Not legal, patent, or regulatory advice.

- **URL**: https://apify.com/hopeful_crabgrass/fda-orange-purple-book.md
- **Developed by:** [Juan Marcos](https://apify.com/hopeful_crabgrass) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.00005 / actor start

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/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 Orange Book + Purple Book Lookup and Monthly Change Feed

Looks up FDA's official **Orange Book** (approved small-molecule drug products with their listed patents and exclusivity) and **Purple Book** (licensed biological products, biosimilar and interchangeable status, exclusivity dates) in one run, and returns flat rows. A `changes` mode returns rows that are new or updated in FDA's latest monthly release.

Dates only, as listed by FDA. This Actor does not compute "patent cliff", "generic entry", "freedom to operate", or any other legal conclusion.

### Value added over the free files

The data files are free from FDA. This Actor:

- **joins both books in one query**: an ingredient search returns Orange Book products (each with its patents and exclusivity codes attached) and Purple Book biologics whose proper name or reference-product proper name matches, in one row format;
- **monthly change feed** (`mode: changes`):
  - Purple Book rows come from FDA's own change section of the monthly report (codes N, R, U), labelled `changeBasis: official Purple Book change section`;
  - Orange Book rows are **computed by this Actor**: it stores row fingerprints (identifiers and hashes only) for the current and previous release in your key-value store and returns rows that are new or changed. FDA does not publish an Orange Book change list. On your first run there is no earlier release to compare, so Orange Book changes start after FDA's next monthly file;
- filters by ingredient, trade name, applicant, application number, or patent/exclusivity expiry date;
- caches the official files for 24 hours, so scheduled runs do not re-download them;
- optional `onlyNew` skips rows already returned (a row whose listed data changed counts as new).

### Source

- Orange Book data files zip: `https://www.fda.gov/media/76860/download` (products, patent, and exclusivity files, tilde-delimited, updated monthly), described at https://www.fda.gov/drugs/drug-approvals-and-databases/orange-book-data-files.
- Purple Book monthly CSV: the newest file listed on https://purplebooksearch.fda.gov/downloads, downloaded from `www.accessdata.fda.gov`. The CSV's title and change-report rows are skipped; the column header is on row 4.
- openFDA is **not** used. No search pages are scraped. At most one request per file per 24 hours; if FDA returns 403 or 429 the run stops (no proxies, no retries around a block).

### Output fields

`source, changeType, changeBasis, ingredient, proprietaryName, properName, applicant, applicationType, applicationNumber, productNumber, strength, dosageFormRoute, dosageForm, route, teCode, licenseType, approvalDate, rld, rs, marketingStatus, patents[{patentNumber, expireDate, drugSubstanceFlag, drugProductFlag, patentUseCode}], exclusivity[{code, expireDate}], refProductProperName, refProductProprietaryName, exclusivityExpirationDate, firstInterchangeableExclusivityExpDate, refProductExclusivityExpDate, orphanExclusivityExpDate, patentListProvided, attribution`

Fields that do not apply to a book are `null`. Dates are ISO when FDA gives a date; text such as "Approved Prior to Jan 1, 1982" is kept as written. Applicants are firms or institutions; a name is blanked if it looks like a personal name with no organisation word (a heuristic). No person names, emails, phones, or addresses are in the files used.

### FDA visiting hours

FDA's robots.txt for www.accessdata.fda.gov says `Visiting-hours: 23:00EDT-05:00EDT`. This Actor follows it for all three FDA hosts it uses. To stay inside that window whether FDA means EDT or US Eastern local time, it only contacts FDA during **04:00–09:00 UTC**. That is 00:00–05:00 EDT in summer and 23:00–04:00 EST in winter (8 PM–1 AM PST / 9 PM–2 AM PDT).

- Inside the window: normal behaviour. Files are downloaded if the 24-hour cache is empty or old.
- Outside the window: the Actor sends **no request to FDA**. If cached copies of the files you asked for exist, it uses them, whatever their age, and the run note says `cache-stale-outside-window`. If they do not, for example on your first run, the run **succeeds with 0 results and no charge**. Its status message gives the next window start in UTC.
- Tip: schedule runs between 04:00 and 09:00 UTC.

### Input

| Field | Default | Description |
| --- | --- | --- |
| `mode` | `lookup` | `lookup` (needs at least one filter) or `changes` |
| `source` | `both` | `orange`, `purple`, or `both` |
| `ingredient` | empty | Substring of ingredient / proper name / reference proper name |
| `proprietaryName` | empty | Substring of the trade name |
| `applicant` | empty | Substring of the applicant firm |
| `applicationNumber` | empty | Exact NDA/ANDA/BLA number |
| `patentExpiresBefore` | empty | Any listed patent expires on or before this date |
| `exclusivityExpiresBefore` | empty | Any listed exclusivity expires on or before this date |
| `maxResults` | `100` | Hard cap 1,000 |
| `onlyNew` | `false` | Skip rows already returned (named store `fda-ob-pb-seen`) |

### Pricing

Pay-per-event. The primary event is `ob-result` at **$0.008** per product row pushed (Orange Book or Purple Book). The platform also bills a synthetic `apify-actor-start` event automatically; this Actor does not call `Actor.charge()` for that event. If you set a maximum total charge, the Actor stops when a charge is refused or the remaining budget cannot cover another row.

### Licence and attribution

FDA's website policy says its content is "not copyrighted" and in the public domain; credit to FDA is appreciated. U.S. government work; not endorsed by FDA. No FDA logos are used. Every row carries:

`Source: U.S. Food and Drug Administration, Orange Book data files and Purple Book monthly data; not copyrighted / public domain; not endorsed by FDA. Files are updated monthly; this run used the files dated <Orange Book zip date> and <Purple Book month>. Not legal, patent, or regulatory advice. Only FDA's official Orange Book and Purple Book are authoritative.`

### Support

Contact via the Apify Store Issues tab.

# Actor input Schema

## `mode` (type: `string`):

lookup = filter the current files (needs at least one filter). changes = rows new or updated in the latest monthly release: Purple Book uses FDA's official change section; Orange Book is a diff computed by this Actor against the previous release it stored for you (none on your first run).

## `source` (type: `string`):

orange = Orange Book (small-molecule NDA/ANDA products), purple = Purple Book (licensed biologics), both.

## `ingredient` (type: `string`):

Case-insensitive substring of the Orange Book ingredient, or the Purple Book proper name or reference-product proper name.

## `proprietaryName` (type: `string`):

Case-insensitive substring.

## `applicant` (type: `string`):

Case-insensitive substring of the applicant firm name.

## `applicationNumber` (type: `string`):

Exact application number, leading zeros ignored.

## `patentExpiresBefore` (type: `string`):

Orange Book only. Dates as listed by FDA.

## `exclusivityExpiresBefore` (type: `string`):

Orange Book exclusivity codes or Purple Book exclusivity dates.

## `maxResults` (type: `integer`):

Hard cap 1,000.

## `onlyNew` (type: `boolean`):

Skip rows (identifier + content hash) already returned by an earlier run; a row whose listed data changed counts as new. Stored in a named key-value store.

## Actor input object example

```json
{
  "mode": "lookup",
  "source": "both",
  "ingredient": "semaglutide",
  "proprietaryName": "",
  "applicant": "",
  "applicationNumber": "",
  "patentExpiresBefore": "",
  "exclusivityExpiresBefore": "",
  "maxResults": 100,
  "onlyNew": false
}
```

# 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 = {
    "ingredient": "semaglutide"
};

// Run the Actor and wait for it to finish
const run = await client.actor("hopeful_crabgrass/fda-orange-purple-book").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 = { "ingredient": "semaglutide" }

# Run the Actor and wait for it to finish
run = client.actor("hopeful_crabgrass/fda-orange-purple-book").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 '{
  "ingredient": "semaglutide"
}' |
apify call hopeful_crabgrass/fda-orange-purple-book --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hopeful_crabgrass/fda-orange-purple-book"
        }
    }
}
```

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/YvnJPGmPat7zwcDbO/builds/uqJhnGfp7hqufnBmt/openapi.json
