# Rxnorm Drug Lookup (`zerobreak/rxnorm-drug-lookup`) Actor

RxNorm Drug Lookup is a Python script designed to query the NIH RxNorm API to retrieve standardized drug information, unique concept identifiers (RxCUI), ingredients, brand names, and dosage forms for medical and healthcare applications.

- **URL**: https://apify.com/zerobreak/rxnorm-drug-lookup.md
- **Developed by:** [ZeroBreak](https://apify.com/zerobreak) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 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.
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

## RxNorm Drug Lookup: Drug Names and RxCUI via NLM RxNav

<p align="center">
  <img src="https://imgur.com/L5nHhgq.png" alt="RxNorm Drug Lookup" width="800" />
</p>

RxNorm Drug Lookup retrieves drug concepts from the public National Library of Medicine (NLM) RxNav service. It collects RxCUI identifiers, drug names, synonyms, term types (TTY), language codes, suppression flags, and UMLS Concept Unique Identifiers (CUIs).

Provide a list of drug names, configure fuzzy matching and record limits, and export the results as JSON, CSV, or Excel. The public service does not require an API key, and the actor is free to run.

### Use Cases

- **Formulary mapping:** Match brand-name or generic drugs to RxCUI identifiers for integration with other medication datasets.
- **Typo handling:** Use approximate matching to find candidate drug concepts when names contain spelling errors.
- **Concept review:** Collect ingredient, clinical drug, branded drug, and package-related term types for a given drug name.
- **Scheduled quality assurance:** Rerun a list of drug names periodically to refresh reference data and identify changes.
- **Research datasets:** Store drug names, synonyms, identifiers, and term types in a structured dataset without requiring a UTS login.

### Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `names` | array | `aspirin` | Drug names to look up, with one name per item. |
| `fuzzy` | boolean | `true` | Enables approximate matching to identify possible matches for misspelled or similar drug names. |
| `maxItems` | integer | `100` | Maximum number of drug records to save. Limited to 1,000. |
| `timeoutSecs` | integer | `300` | Maximum total runtime in seconds. |
| `requestTimeoutSecs` | integer | `30` | Maximum wait time for an individual RxNav response. |

### Example Input

```json
{
  "names": ["aspirin", "ibuprofen"],
  "fuzzy": true,
  "maxItems": 100,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30
}
```

### What Data Does This Actor Extract?

Each successful output row represents an RxNorm concept. RxNav returns matching concept groups in a response rather than using conventional page-based pagination. When multiple names are supplied, the actor processes them until the configured record limit or runtime limit is reached.

#### Example Output

```json
{
  "rxcui": "1191",
  "name": "aspirin",
  "synonym": "acetylsalicylic acid",
  "tty": "IN",
  "language": "ENG",
  "suppress": "N",
  "umlscui": "C0004057",
  "sourceUrl": "API_REQUEST_URL",
  "scrapedAt": "2026-10-12T00:00:00+00:00"
}
```

The example uses a placeholder for the request URL. Actual output depends on the concepts and information returned by RxNav.

### Output Fields

| Field | Type | Description |
|---|---|---|
| `rxcui` | string | Unique identifier for the RxNorm concept. |
| `name` | string | Drug name returned by RxNav. |
| `synonym` | string | Alternative name or synonym, when available. |
| `tty` | string | Term type, such as `IN`, `SBD`, `SCD`, `BPCK`, or `GPCK`. |
| `language` | string | Language code, usually `ENG` for English. |
| `suppress` | string | Suppression status. `N` indicates that the concept is not suppressed. |
| `umlscui` | string | UMLS Concept Unique Identifier, when available. |
| `sourceUrl` | string | Request URL associated with the returned record. |
| `scrapedAt` | string | UTC timestamp indicating when the record was saved. |
| `error` | string | Error description, when a lookup fails. |
| `input` | string | Original drug name associated with an error row. |

A failed lookup produces an error row containing the error description and original input. Previously collected records remain in the dataset, and the run continues processing other names where possible.

### How It Works

1. Read the input names and validate the configured limits.
2. Send requests to the public RxNav REST service.
3. Retrieve drug concepts and associated information from the available responses.
4. When fuzzy matching is enabled, perform an additional approximate-term lookup for each input name.
5. Remove duplicate records using the RxCUI identifier.
6. Retry HTTP 429 responses and HTTP 5xx errors using backoff.
7. Save successful records and error rows in the output dataset.

### Limits and Data Usage

- **Public API rate limit:** The public RxNav service documents a limit of 20 requests per second per IP address.
- **Authenticated rate limit:** A higher limit of 100 requests per second is documented for requests using a UTS key.
- **Request pacing:** This actor targets approximately 10 requests per second and retries rate-limit and server errors.
- **Duplicate handling:** Duplicate records are removed using RxCUI identifiers.
- **Maximum records:** Up to 1,000 output records per run.
- **Authentication:** No API key is required for the public endpoints used by this actor.
- **Licensing:** Most RxNorm content does not require a separate license. Certain components, including SNOMED CT content incorporated into RxNorm, have additional licensing requirements. Review the applicable NLM terms before redistributing affected data.

### Frequently Asked Questions

#### Does RxNorm Drug Lookup require an API key?

No. It uses public RxNav JSON endpoints and does not require an API key for the described lookups.

#### What does fuzzy matching do?

Fuzzy matching adds an approximate-term lookup for each drug name. Enable it when you want to identify possible matches for spelling errors or similar terms. Disable it when you only need standard drug-name and RxCUI lookups.

#### How many rows can one run save?

The default maximum is 100 records, and the configured limit cannot exceed 1,000.

#### Why is there no page cursor?

RxNav returns concept groups for an individual name in a response. The actor moves to the next input name instead of following a conventional pagination cursor.

#### What happens when a drug name is unknown?

The actor records an error row for the unrecognized name. The entire run does not need to stop because of one failed lookup.

#### Can the results be exported to CSV, JSON, and Excel?

Yes. The resulting dataset can be downloaded in JSON, CSV, or Excel format for research, reporting, and integration with other data-processing systems.

### Pricing

The actor is free to run. Apify platform usage is separate and depends on the applicable plan.

### Trademark Notice

RxNorm, RxNav, and related names, logos, and trademarks belong to their respective owners. Their use in this documentation is solely for identifying the data source and does not imply affiliation, sponsorship, endorsement, or partnership.

### Disclaimer

This actor is an independent tool and is not affiliated with, endorsed by, sponsored by, or officially associated with RxNorm, RxNav, or the National Library of Medicine.

Data is collected from publicly accessible sources. Users are responsible for complying with applicable source terms, request limits, licensing conditions, and attribution requirements.

### Is Web Scraping Legal?

Accessing publicly available information through a public API is generally permitted, but the legality and conditions of use depend on the data, applicable laws, licensing terms, and intended purpose.

- **Personal data:** If collected results contain personal information, applicable privacy laws may impose additional obligations. Collect and retain such information only when there is a legitimate and lawful basis.
- **Copyright and licensing:** Drug reference data and associated content may have specific licensing requirements. Follow applicable license terms and attribution obligations when redistributing data.
- **Terms of use:** Respect the source's usage policies, request limits, and applicable data-use requirements.
- **Legal advice:** This information is provided for general educational purposes and does not constitute legal advice. Consult a qualified professional if you need guidance on a specific use case.

# Actor input Schema

## `names` (type: `array`):

Drug names to look up on NLM RxNav, one name per line. Aspirin is the default so a first run returns real RxCUI concepts.

## `fuzzy` (type: `boolean`):

Also call approximateTerm for misspellings. On by default so a typo such as asprin can still return an RxCUI.

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

Maximum number of drug records to save. Free cap, hard max 1000.

## `timeoutSecs` (type: `integer`):

Maximum seconds the run may spend calling RxNav before it stops and saves what it has.

## `requestTimeoutSecs` (type: `integer`):

Seconds to wait for a single RxNav response before retrying that request.

## `proxyConfiguration` (type: `object`):

Optional proxy for RxNav requests. Default is no proxy, which matches the public RxNav service. Turn on Apify Proxy only if your network blocks NLM.

## Actor input object example

```json
{
  "names": [
    "aspirin",
    "ibuprofen"
  ],
  "fuzzy": true,
  "maxItems": 100,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `datasetUrl` (type: `string`):

Default dataset API URL for this run.

## `overviewUrl` (type: `string`):

Dataset items in the overview table view.

# 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 = {
    "names": [
        "aspirin"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("zerobreak/rxnorm-drug-lookup").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 = {
    "names": ["aspirin"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("zerobreak/rxnorm-drug-lookup").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 '{
  "names": [
    "aspirin"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call zerobreak/rxnorm-drug-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zerobreak/rxnorm-drug-lookup"
        }
    }
}
```

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/BUZ3Cqb3kx0pIsjyU/builds/epmnuMrWAi5IQHri3/openapi.json
