# Dailymed Drug Labels Scraper (`kawsar/dailymed-drug-labels-scraper`) Actor

Search DailyMed for drug labels and National Drug Codes (NDCs) by drug name. Retrieve structured label data, set IDs, and publication dates, and download your dataset as CSV, JSON, or Excel.

- **URL**: https://apify.com/kawsar/dailymed-drug-labels-scraper.md
- **Developed by:** [Kawsar](https://apify.com/kawsar) (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

## DailyMed Scraper: FDA Drug Labels (SPL)

<p align="center">
  <img src="https://imgur.com/UpZKdCw.png" alt="DailyMed Scrape" style="max-width:100%; border-radius:14px; width:680px;" />
</p>

Search and extract official FDA Structured Product Labeling (SPL) data and National Drug Code (NDC) details directly from DailyMed. Export structured datasets—including SPL set IDs, label titles, publication dates, versions, and NDC numbers—directly into JSON, CSV, or Excel format.

Instead of manually browsing through individual drug label pages, you can collect pharmaceutical data in clean, structured spreadsheets for research or inventory management.

### Use Cases

- **Drug label lookup:** Search by medication name (e.g., Aspirin) to extract set IDs and label versions without opening every web page.
- **NDC directory exports:** Switch modes to extract individual National Drug Codes linked to target drug labels.
- **Formulary & catalog updates:** Keep pharmaceutical lists and spreadsheets up-to-date with regular data extractions.
- **Quality assurance:** Identify invalid medication names or unresolvable entries cleanly without interrupting dataset processing.

### Extracted Data Points

Each record includes essential pharmaceutical label metadata:

- SPL Set ID and SPL version
- Publication date
- Official drug label title
- Associated National Drug Codes (NDCs) when enabled

### Input Parameters

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `mode` | String | `spls` | `spls` exports one row per label. `ndcs` exports one row per NDC code. |
| `drugNames` | Array | `["aspirin"]` | List of drug names to search (one per line). |
| `includeNdcs` | Boolean | `false` | When running in `spls` mode, set to `true` to include NDC codes on each label row. |
| `maxItems` | Integer | `100` | Maximum number of rows to retrieve (up to 1,000). |
| `timeoutSecs` | Integer | `300` | Overall execution limit in seconds. |

#### Example Input (`spls` Mode)

```json
{
  "mode": "spls",
  "drugNames": ["aspirin"],
  "includeNdcs": false,
  "maxItems": 100,
  "timeoutSecs": 300
}

```

#### Example Input (`ndcs` Mode)

```json
{
  "mode": "ndcs",
  "drugNames": ["aspirin"],
  "maxItems": 100,
  "timeoutSecs": 300
}

```

### Output Format

```json
{
  "spl_version": 8,
  "published_date": "Oct 09, 2026",
  "labelTitle": "ASPIRIN TABLET, CHEWABLE [CVS PHARMACY]",
  "setid": "bd11081f-c5d1-4c98-8f5a-4c45269df79b"
}

```

### How It Works

1. Processes target drug names and configures the extraction mode (`spls` or `ndcs`).
2. Retrieves search results in structured batches, skipping duplicate labels.
3. Automatically fetches associated NDC codes if configured in settings.
4. Manages connection disruptions using polite retry intervals.
5. Generates clean datasets ready for instant export to JSON, CSV, or Excel.

### Frequently Asked Questions

**How do I extract National Drug Codes (NDCs)?**

Set `mode` to `ndcs` to export one row per NDC code, or keep `mode` as `spls` and turn `includeNdcs` to `true` to attach codes directly to the label record.

**What happens if a drug name is not found?**

If an invalid medication name is supplied, an error entry explaining the issue is logged, while the process continues for the remaining valid drug names.

**Can I export datasets to CSV or Excel?**

Yes. Completed datasets can be downloaded instantly in JSON, CSV, or Excel formats from your run overview.

***

### Legal & Compliance

#### Trademark Notice

DailyMed Drug Labels and related names, logos, and trademarks belong to their respective owners. Their mention in this documentation is strictly to identify data utility and compatibility, and does not imply affiliation, sponsorship, or endorsement.

#### Disclaimer

This tool is an independent utility and is not affiliated with, endorsed by, or officially connected to third-party medical data providers. Users are responsible for ensuring their usage complies with relevant terms of service, rate limits, and guidelines.

#### Is web scraping legal?

This tool collects publicly available pharmaceutical label information without bypassing access controls. Collecting public data is standard practice, but proper compliance requires considering how the data is used:

- **Personal data:** Ensure dataset usage respects regional privacy regulations (such as GDPR or CCPA) when combining outputs with personal user records.
- **Copyright & Terms:** Respect the terms of use, usage limits, and licensing terms set by data sources.
- **Legal advice:** This summary is provided for general informational purposes and does not constitute formal legal counsel.

# Actor input Schema

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

spls returns one row per Structured Product Label. ndcs looks up those labels and returns one row per National Drug Code.

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

Drug names to search on DailyMed, one per line. The default search is aspirin.

## `includeNdcs` (type: `boolean`):

When mode is spls, also call the NDC endpoint for each label and store the codes on that row. Ignored when mode is ndcs, which already returns one row per code.

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

Maximum dataset rows for this run, including error rows. Values above 1000 are clamped to 1000.

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

Stop starting new DailyMed requests after this many seconds. This does not replace the Apify run timeout.

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

Seconds to wait for a single DailyMed HTTP response before retrying.

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

Optional proxy for DailyMed requests. The default sends traffic directly, with no Apify Proxy. Do not use proxies to get around source limits.

## Actor input object example

```json
{
  "mode": "spls",
  "drugNames": [
    "aspirin"
  ],
  "includeNdcs": false,
  "maxItems": 100,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

API URL for the default dataset of this run.

## `datasetItemsUrl` (type: `string`):

Item list for the default dataset.

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

Overview table of drug labels and NDC codes.

# 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 = {
    "mode": "spls",
    "drugNames": [
        "aspirin"
    ],
    "includeNdcs": false,
    "maxItems": 100,
    "timeoutSecs": 300,
    "requestTimeoutSecs": 30,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kawsar/dailymed-drug-labels-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 = {
    "mode": "spls",
    "drugNames": ["aspirin"],
    "includeNdcs": False,
    "maxItems": 100,
    "timeoutSecs": 300,
    "requestTimeoutSecs": 30,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("kawsar/dailymed-drug-labels-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 '{
  "mode": "spls",
  "drugNames": [
    "aspirin"
  ],
  "includeNdcs": false,
  "maxItems": 100,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call kawsar/dailymed-drug-labels-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kawsar/dailymed-drug-labels-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/UbhHCwgJjVPVTHudb/builds/xynyBde2QRaYdxdds/openapi.json
