# US Pharmacy Directory Scraper by State, City and ZIP (`talcoe/dea-pharmacies-npi`) Actor

Pull US pharmacies with address, phone, owner contact, license and type from the public NPI Registry, filtered by state, city, ZIP prefix, name or pharmacy type, priced per result.

- **URL**: https://apify.com/talcoe/dea-pharmacies-npi.md
- **Developed by:** [M Usama](https://apify.com/talcoe) (community)
- **Categories:** Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 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?

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

### Data source

The public NPI Registry API run by CMS (npiregistry.cms.hhs.gov), filtered to organizations with a pharmacy taxonomy (3336), updated by CMS from provider enrollments.

### What does Pharmacy Directory Scraper do?

It returns US pharmacies, independent and chain, with the fields lead lists need: name, doing business as name, practice address, phone, fax, authorized official and title, state license number, pharmacy type and NPI. Filter by state, city, ZIP prefix, name prefix or pharmacy type so each run stays small. Pricing is per result.

### Why use it?

- Build local lead lists of independent pharmacies by state, city or ZIP area for sales outreach.
- Pull every location of a chain by name prefix (for example CVS or Walgreens).
- Find specialty, compounding, long term care or mail order pharmacies for suppliers and service vendors.
- Replace manual searches on the registry website and stale purchased lists.

### How to use it

1. Open the Actor and set the filters.
2. Click Start. Download results as JSON, CSV or Excel, or read them through the API.
3. Add a Schedule and an Integration (Slack, Google Sheets, webhook) to get new records automatically.

### Input

| Field | Description |
|---|---|
| `states` | Two letter state or territory codes. One query set runs per state. Default `["RI"]`. |
| `city` | Optional exact city name. |
| `postalCodePrefix` | Optional ZIP prefix such as `029` or `02903`. Use it to cover a county, since the registry has no county field. |
| `organizationName` | Optional pharmacy name prefix. |
| `pharmacyTypes` | Optional list of pharmacy subtypes (community/retail, long term care, specialty, compounding, and more). Empty means all. |
| `maxResults` | Hard stop for the run. You are billed per result, so this caps the cost. |
| `proxyConfiguration` | Apify proxy is recommended for larger runs. |

Example input:

```json
{ "states": ["RI"], "city": "Providence", "pharmacyTypes": ["Community/Retail Pharmacy"], "maxResults": 100 }
```

### Output

Every record has the same shape:

```json
{
  "id": "1003561655",
  "npi": "1003561655",
  "name": "Aj Pharmacy Store 02",
  "doingBusinessAs": "Aj Pharmacy Store 02",
  "pharmacyType": "Pharmacy, Community/Retail Pharmacy",
  "phone": "401-366-2800",
  "address": "468 Smithfield Rd",
  "city": "North Providence",
  "state": "RI",
  "zip": "02904",
  "authorizedOfficial": "Charles Agwunobi",
  "authorizedOfficialTitle": "Owner",
  "authorizedOfficialPhone": "4014995427",
  "taxonomyCode": "3336C0003X",
  "status": "active",
  "enumerationDate": "2022-02-12",
  "lastUpdated": "2022-09-08",
  "npiRegistryUrl": "https://npiregistry.cms.hhs.gov/provider-view/1003561655"
}
```

| Field | Meaning |
|---|---|
| `id` | Stable key (the NPI), safe for deduplication between runs |
| `name`, `doingBusinessAs` | Legal name and trade name |
| `pharmacyType`, `taxonomyCode` | Pharmacy subtype and its taxonomy code |
| `phone`, `fax` | Practice location numbers |
| `address`, `city`, `state`, `zip`, `zip4` | Practice location |
| `authorizedOfficial`, `authorizedOfficialTitle`, `authorizedOfficialPhone` | Business contact listed on the NPI record |
| `licenseNumber`, `licenseState` | State license, when the pharmacy reported one |
| `status`, `enumerationDate`, `lastUpdated` | Registry record status and dates |
| `mailingAddress`, `npiRegistryUrl` | Mailing address and the source record |

### Pricing

Pay per event: a small fee when a run starts, then a fixed price per result returned. You only pay for records that pass your filters. Set `maxResults` to cap any run.

### Limitations

- The registry has no county field. Use ZIP prefixes to cover a county.
- The registry returns at most 1,200 results per query. For a large state, add a city, ZIP prefix or pharmacy type and run several queries.
- NCPDP numbers and store hours are not published by the registry, so they are not included.
- Data is only as current as pharmacy self reporting to CMS. Some records have no phone or license number.

### FAQ

**Is this legal?** The Actor reads listings the site publishes for any visitor without a login and stores only business information published for that purpose. You are responsible for how you use the data.

**Something is missing or broken?** Open an issue in the Issues tab; response time is usually under a day.

# Actor input Schema

## `states` (type: `array`):

Two letter US state or territory codes. One query set runs per state.

## `city` (type: `string`):

Optional exact city name, for example Providence.

## `postalCodePrefix` (type: `string`):

Optional ZIP prefix such as 029 or 02903. Use it to work county by county, since the registry has no county field.

## `organizationName` (type: `string`):

Optional pharmacy name prefix, for example CVS or Walgreens.

## `pharmacyTypes` (type: `array`):

Taxonomy 3336 subtypes to include. Leave empty to include every pharmacy type.

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

Hard stop for the run. You are billed per result, so this caps the cost.

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

Apify proxy is recommended for larger runs.

## Actor input object example

```json
{
  "states": [
    "RI"
  ],
  "maxResults": 100,
  "proxyConfiguration": {
    "useApifyProxy": 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 = {
    "states": [
        "RI"
    ],
    "maxResults": 100,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("talcoe/dea-pharmacies-npi").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 = {
    "states": ["RI"],
    "maxResults": 100,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("talcoe/dea-pharmacies-npi").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 '{
  "states": [
    "RI"
  ],
  "maxResults": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call talcoe/dea-pharmacies-npi --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,talcoe/dea-pharmacies-npi"
        }
    }
}
```

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/8dxfK1Fm0gfDF8gH8/builds/EkypEIFGzk1jqtdAX/openapi.json
