# CMS Medicare Part D Prescriber & Drug Data Scraper (`logiover/cms-medicare-part-d-prescriber-drug-scraper`) Actor

Export millions of official CMS Medicare Part D provider-drug records by NPI, specialty, state, brand, generic drug, claims, beneficiaries and cost. Built for pharma, healthcare sales, market access, research and compliance.

- **URL**: https://apify.com/logiover/cms-medicare-part-d-prescriber-drug-scraper.md
- **Developed by:** [Logiover](https://apify.com/logiover) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## CMS Medicare Part D Prescriber & Drug Data Scraper

Export official CMS Medicare Part D prescribing records at provider-and-drug grain. Every item links an NPI and specialty to a brand/generic drug with claims, standardized fills, days supplied, aggregate drug cost and beneficiary measures.

The current official CSV is over 4 GB. This Actor uses CMS's public, keyless data API with 5,000-row pagination, source-native exact filters and automatic release-year discovery, so users can collect small targeted segments or hundreds of thousands of rows without downloading the full source file.

### Buyers and use cases

- Pharma and medical-device commercial intelligence.
- Territory design and provider segmentation.
- Brand/generic adoption and utilization research.
- Market-access, HEOR and health-policy analysis.
- Compliance, audit and provider-drug trend monitoring.

### Input

| Field | Description |
| --- | --- |
| `states` | Exact two-letter provider state abbreviations. |
| `specialties` | Exact CMS provider specialty labels. |
| `brandNames`, `genericNames` | Exact drug labels processed server-side by CMS. |
| `providerKeyword` | CMS keyword search. |
| `minClaims` | Minimum claims for a provider-drug pair. |
| `minDrugCost` | Minimum aggregate drug cost. |
| `minBeneficiaries` | Minimum published beneficiary count. |
| `maxResults` | Up to 500,000 records per run. |

```json
{
  "states": ["CA", "TX"],
  "specialties": ["Cardiology"],
  "brandNames": ["Eliquis"],
  "minClaims": 50,
  "minDrugCost": 10000,
  "maxResults": 25000
}
```

Multiple exact filters create query segments, allowing users to export several states, specialties or drugs in one run while preserving source-side filtering.

### Output

```json
{
  "dataYear": 2024,
  "npi": "1003000126",
  "providerName": "Ardalan Enkeshafi",
  "specialty": "Internal Medicine",
  "city": "Bethesda",
  "state": "MD",
  "brandName": "Abrysvo",
  "genericName": "Rsv Vacc, Pref A And Pref B/Pf",
  "totalClaims": 20,
  "totalDrugCost": 5994.01,
  "totalBeneficiaries": 20,
  "averageCostPerClaim": 299.7
}
```

Age-65-plus fields and CMS suppression flags are preserved. A null value often means CMS suppressed a small beneficiary cell rather than that the measure is zero.

### Data meaning

The total drug cost combines amounts paid by Medicare, beneficiaries and third-party payers. It is not the amount Medicare alone paid. Results are aggregated administrative claims statistics, not patient-level data and not evidence of inappropriate prescribing.

### Scale and API

The official source contains millions of provider-drug pairs. One run supports 500,000 output items; segment larger warehouses by state, specialty or drug. Use Apify Console, REST API, JavaScript, Python or MCP, then export JSON, JSONL, CSV, Excel, XML or RSS.

```bash
curl -X POST "https://api.apify.com/v2/acts/logiover~cms-medicare-part-d-prescriber-drug-scraper/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"states":["NY"],"genericNames":["Apixaban"],"maxResults":10000}'
```

### FAQ

**Does it require a CMS key?** No.

**What does empty input do?** It exports the newest provider-drug release nationwide up to the default limit.

**How fresh is it?** CMS updates this dataset annually. The Actor resolves release metadata at run time.

**Can I identify individual patients?** No. This is provider-level aggregate public-use data with suppression rules.

**Why is the provider address not included?** This provider-drug dataset publishes city/state and prescribing measures. Join the NPI to an NPPES provider dataset when full practice addresses are needed.

### Responsible use

This Actor is not affiliated with or endorsed by CMS or HHS. Do not use aggregate prescribing data alone for clinical, disciplinary, fraud, credentialing or patient-care decisions. Verify consequential conclusions with appropriate authoritative sources and context.

### Changelog

#### 2026-08-05

- Initial CMS Medicare Part D provider-and-drug exporter.
- Added dynamic release metadata, source-native pagination and commercial filters.
- Verified live default, semantic filter and high-volume output behavior.

# Actor input Schema

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

Two-letter provider state abbreviations. Empty means nationwide.

## `specialties` (type: `array`):

Exact CMS specialty labels such as Internal Medicine or Cardiology.

## `brandNames` (type: `array`):

Exact CMS brand names, for example Eliquis or Ozempic.

## `genericNames` (type: `array`):

Exact CMS generic-name labels.

## `providerKeyword` (type: `string`):

CMS full-text keyword search across provider-drug rows.

## `minClaims` (type: `number`):

Minimum total Part D claims for the provider-drug pair.

## `minDrugCost` (type: `number`):

Minimum aggregate drug cost in USD.

## `minBeneficiaries` (type: `number`):

Minimum published beneficiary count for the provider-drug pair.

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

Maximum unique provider-drug records saved.

## Actor input object example

```json
{
  "states": [],
  "specialties": [],
  "brandNames": [],
  "genericNames": [],
  "providerKeyword": "",
  "maxResults": 200
}
```

# 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 = {
    "maxResults": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("logiover/cms-medicare-part-d-prescriber-drug-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 = { "maxResults": 200 }

# Run the Actor and wait for it to finish
run = client.actor("logiover/cms-medicare-part-d-prescriber-drug-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 '{
  "maxResults": 200
}' |
apify call logiover/cms-medicare-part-d-prescriber-drug-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,logiover/cms-medicare-part-d-prescriber-drug-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/DsB6v15aUade6ElTY/builds/OZUafjLROgErrxe4V/openapi.json
