# RxNav Drug Normalization, Relations, NDC & Class Scraper (`ninhothedev/rxnav-drugs-scraper`) Actor

$0.5/1K 🔥 RxNav Drugs Scraper! Pull drug names, RxNorm IDs (RxCUIs), brand-to-generic relations, ingredients, NDC codes & ATC/MoA drug classes from the NLM RxNav database. No key. JSON, CSV, Excel or API in seconds. Build a medication lookup or autocomplete ⚡

- **URL**: https://apify.com/ninhothedev/rxnav-drugs-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

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?

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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## RxNav Drug Normalization, Relations, NDC & Class Scraper

Turn messy drug names into clean, connected drug data. This actor uses the free
[**RxNav REST API**](https://rxnav.nlm.nih.gov/) from the U.S. National Library
of Medicine to **normalize drug names to RxCUIs**, walk the **RxNorm
relationship graph** (brands ↔ generics ↔ ingredients ↔ dose forms), pull
**NDC product codes**, and attach **drug classes** (ATC, Mechanism of Action,
Established Pharmacologic Class, therapeutic and disease classes).

**No API key. No login. ~$0.5 per 1,000 records.**

***

### What this scrapes (4 modes)

| Mode | Input | Output |
|------|-------|--------|
| `drugs` | a drug **name** | every RxNorm concept, grouped by term type (TTY): ingredients, brand names, clinical & branded drugs, packs, dose forms |
| `related` | an **RxCUI** (or name) | related concepts by TTY — the brand ↔ generic ↔ ingredient graph |
| `ndcs` | an **RxCUI** (or name) | the National Drug Codes (NDC) for that product |
| `classes` | an **RxCUI** (or name) | drug classes: **ATC1‑4**, **MoA**, **EPC**, **PE**, **PK**, therapeutic (VA), and **disease** relations (may\_treat / may\_prevent / ci\_with) |

In `related`, `ndcs` and `classes` modes you can pass RxCUIs directly **or** pass
drug names — names are normalized to an RxCUI first.

***

### How this differs from `rxnorm-scraper` and `dailymed-scraper`

This actor is **complementary**, not a duplicate:

- **[`rxnorm-scraper`](https://apify.com/ninhothedev/rxnorm-scraper)** dumps the
  flat RxNorm concept/terminology data (names, codes, term types). It is a
  *dictionary*.
- **This RxNav actor** is about **navigation and relationships** that a flat
  RxNorm dump lacks: it resolves a name → RxCUI, walks the **related-concept
  graph** (brand↔generic↔ingredient), maps **NDC product codes**, and — most
  importantly — attaches **RxClass drug classifications** (ATC, MoA, EPC,
  therapeutic, disease). Those classes come from RxClass/MED‑RT/DailyMed, not
  from the core RxNorm terminology.
- **[`dailymed-scraper`](https://apify.com/ninhothedev/dailymed-scraper)** scrapes
  FDA **structured product labels** (indications, warnings, dosage text). This
  actor gives you the **coded relationships and classes** to link those labels
  together.

> **Note on interactions:** the RxNav drug‑drug **interaction API was retired by
> the NLM** and now returns HTTP 404. This actor therefore does **not** ship an
> interactions mode. For interaction data, use a maintained clinical source.

Related actors: [rxnorm-scraper](https://apify.com/ninhothedev/rxnorm-scraper) ·
[dailymed-scraper](https://apify.com/ninhothedev/dailymed-scraper) ·
[nlm-clinical-tables-scraper](https://apify.com/ninhothedev/nlm-clinical-tables-scraper) ·
[openfda-scraper](https://apify.com/ninhothedev/openfda-scraper)

***

### Example output

**`drugs` mode** (`aspirin`):

```json
{
  "type": "drug_concept",
  "query": "aspirin",
  "rxcui": "1191",
  "name": "aspirin",
  "tty": "IN",
  "tty_label": "Ingredient",
  "synonym": null,
  "umls_cui": "C0004057",
  "is_suppressed": false,
  "source": "rxnav",
  "scraped_at": "2026-08-11T00:00:00Z"
}
```

**`classes` mode** (RxCUI `1191`):

```json
{
  "type": "drug_class",
  "rxcui": "1191",
  "class_id": "N02BA",
  "class_name": "Salicylic acid and derivatives",
  "class_type": "ATC1-4",
  "relation": null,
  "relation_source": "ATC",
  "source": "rxnav",
  "scraped_at": "2026-08-11T00:00:00Z"
}
```

**`ndcs` mode** → `{ "type": "ndc", "rxcui": "198440", "ndc": "00031930101", ... }`
**`related` mode** → `{ "type": "related", "source_rxcui": "1191", "related_rxcui": "215568", "related_name": "Bayer", "related_tty": "BN", "related_tty_label": "Brand Name", ... }`

***

### Input

| Field | Type | Default | Notes |
|-------|------|---------|-------|
| `mode` | select | `drugs` | `drugs` / `related` / `ndcs` / `classes` |
| `drugNames` | array | `["aspirin","metformin","atorvastatin"]` | names; resolved to RxCUI in non‑drugs modes |
| `rxcuis` | array | `[]` | RxCUIs to process directly |
| `relatedTtys` | array | `["IN","BN","SCD","SBD"]` | `related` mode only |
| `maxItems` | integer | `300` | cap, max 5000 |

### Use cases

- **Medication apps** — autocomplete a typed drug name and resolve it to a stable RxCUI.
- **Formulary management** — group brands to their generic/ingredient and by ATC class.
- **Pharmacovigilance** — normalize free‑text drug mentions and roll them up by MoA/EPC.
- **EHR integration** — map internal drug records to RxCUIs and NDCs for interoperability.

### Term types (TTY) covered

`IN`, `PIN`, `MIN`, `BN`, `SCDC`, `SBDC`, `SCDF`, `SBDF`, `SCD`, `SBD`, `GPCK`,
`BPCK`, `DF`, `DFG` and more — each output row carries a human‑readable
`tty_label`.

### Data source & license

Data © U.S. National Library of Medicine, served by the public
[RxNav](https://rxnav.nlm.nih.gov/) API. Please review NLM terms for your use case.

# Actor input Schema

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

What to scrape. 'drugs' = resolve a drug name into every RxNorm concept grouped by term type (TTY). 'related' = for each RxCUI, list related brands/generics/ingredients/dose forms. 'ndcs' = list National Drug Codes (NDC) for each RxCUI. 'classes' = list drug classes (ATC, MoA, EPC, therapeutic, disease) for each RxCUI. In non-'drugs' modes, any supplied drug names are first normalized to an RxCUI.

## `drugNames` (type: `array`):

Drug names to look up (e.g. brand or generic names). In 'drugs' mode each name is expanded to all matching concepts. In other modes each name is first normalized to an RxCUI, then used.

## `rxcuis` (type: `array`):

RxNorm concept unique identifiers (RxCUIs) to process directly. Used by the 'related', 'ndcs' and 'classes' modes in addition to any resolved drug names. Ignored in 'drugs' mode.

## `relatedTtys` (type: `array`):

Only for 'related' mode: which related term types to fetch. Common values: IN (Ingredient), BN (Brand Name), SCD (Clinical Drug), SBD (Branded Drug), PIN, MIN, SCDF, SBDF, GPCK, BPCK.

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

Maximum number of output records to push to the dataset (safety cap).

## Actor input object example

```json
{
  "mode": "drugs",
  "drugNames": [
    "aspirin",
    "metformin",
    "atorvastatin"
  ],
  "rxcuis": [],
  "relatedTtys": [
    "IN",
    "BN",
    "SCD",
    "SBD"
  ],
  "maxItems": 300
}
```

# 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 = {
    "drugNames": [
        "aspirin",
        "metformin",
        "atorvastatin"
    ],
    "rxcuis": [],
    "relatedTtys": [
        "IN",
        "BN",
        "SCD",
        "SBD"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/rxnav-drugs-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 = {
    "drugNames": [
        "aspirin",
        "metformin",
        "atorvastatin",
    ],
    "rxcuis": [],
    "relatedTtys": [
        "IN",
        "BN",
        "SCD",
        "SBD",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/rxnav-drugs-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 '{
  "drugNames": [
    "aspirin",
    "metformin",
    "atorvastatin"
  ],
  "rxcuis": [],
  "relatedTtys": [
    "IN",
    "BN",
    "SCD",
    "SBD"
  ]
}' |
apify call ninhothedev/rxnav-drugs-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ninhothedev/rxnav-drugs-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/w7GaDJBNunlQDSkPS/builds/Ut6imUX3J4HY6fdqx/openapi.json
