CMS Medicare Spending Scraper avatar

CMS Medicare Spending Scraper

Pricing

from $19.00 / 1,000 results

Go to Apify Store
CMS Medicare Spending Scraper

CMS Medicare Spending Scraper

Scrapes Medicare Spending Per Beneficiary and Hospital Spending by Claim data from CMS public datasets. Returns flat rows with facility name, state, claim counts, and spending metrics. Filter by state or facility name.

Pricing

from $19.00 / 1,000 results

Rating

0.0

(0)

Developer

ParseForge

ParseForge

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

7 hours ago

Last modified

Share

ParseForge

CMS Medicare Spending Scraper

Scrape Medicare Spending Per Beneficiary and hospital spending data from official CMS datasets, up to a million records per run. Every record includes facility name, state, claim count, and spending metrics. Export to CSV, JSON, Excel, or XML.

CMS publishes detailed Medicare spending data but the official site offers only manual downloads and limited filtering. This Actor queries the public Socrata APIs behind the Medicare Spending Per Beneficiary and Hospital Spending by Claim datasets directly, so you get only the records you need. Filter by state or facility name and pull up to a million rows into one flat dataset.

Who uses itWhat they scrape CMS Medicare Spending for
Health policy analystsCompare per-beneficiary spending across hospitals in a state
Healthcare consultantsBenchmark client hospital spending against national averages
Data journalistsFind outliers in Medicare hospital spending by claim type
Academic researchersBuild longitudinal datasets of Medicare spending for econometric studies

What it does

This Actor collects Medicare spending records from four CMS datasets and returns each one as a flat row with facility identifiers, claim counts, and spending amounts.

  • πŸ₯ Four CMS datasets: Medicare Spending Per Beneficiary by hospital, state, or national level, plus Hospital Spending by Claim.
  • πŸ” State and facility filters: narrow results to a single state with a two-letter code, or search by partial facility name.
  • πŸ“¦ Flat row output: every record arrives with the same schema, ready for analysis in any tool.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

What you can do with CMS Medicare Spending data

πŸ“Š Compare hospital spending by state.

A health policy analyst pulls the State-level MSPB dataset for California and Texas, then ranks facilities by average spending per beneficiary to brief a legislative committee.

πŸ”Ž Audit a single facility.

A consultant enters a partial hospital name and pulls its Medicare Spending Per Beneficiary record to compare against the national average for a client engagement.

πŸ“ˆ Track spending by claim type.

A researcher collects the Hospital Spending by Claim dataset for all states, then groups by claim type to identify which service categories drive the highest Medicare costs.

πŸ—ΊοΈ Build a national spending map.

A data journalist pulls the National MSPB dataset, joins it with hospital geolocation data, and publishes an interactive map of Medicare spending variation across the US.

Why choose this scraper

What you get
No API key requiredQueries the public Socrata endpoint directly, no registration or OAuth
Up to 1M recordsPull a full dataset in one run instead of paginating by hand
Fixed schemaEvery row from a given dataset has the same columns, every time
Multiple export formatsDownload as CSV, JSON, Excel, or XML from your Apify dataset

Configure the run

Choose one of four CMS Medicare spending datasets, then optionally filter by state code or facility name to narrow the pull. The Input tab lists every parameter.

A first run with the defaults:

{
"maxItems": 10,
"dataset": "rrqw-56er"
}

A larger pull:

{
"maxItems": 200,
"dataset": "rrqw-56er"
}

Pricing

Pay-per-result: $0.021 per result collected. You pay only for the results written to your dataset.

Results collectedApproximate cost
100 results$2.10
1,000 results$21.00
10,000 results$210.00

New Apify accounts start with $5 in free credit.

Free users

Free-plan runs return up to 10 results as a preview. Upgrade your Apify plan to collect up to 1,000,000 results per run.

Run it

  1. Create a free Apify account with $5 in credit.
  2. Open the CMS Medicare Spending Scraper.
  3. Set your inputs and any filters, then click Start.
  4. Export the results as CSV, Excel, JSON, or XML from the Dataset tab.

Run it programmatically through the Apify API (run-sync-get-dataset-items) or the ApifyClient for JavaScript and Python.

Use with AI agents (MCP)

Give an AI agent live access to CMS Medicare Spending through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

$claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/cms-data-medicare-spending-scraper"

Then prompt it in plain language to run the scraper and read back the results.

Troubleshooting

Why am I getting no results?

Check your filters. A state code like 'California' instead of 'CA' will return nothing. Also try removing the Facility Name filter to see if the dataset has any records at all.

The run finished but I expected more records.

The CMS Socrata API has a default row limit per query. If you hit it, try increasing the Maximum records field. Some datasets are smaller than others, so check the source on data.cms.gov to confirm the total size.

Some fields are empty in my output.

CMS does not populate every field for every facility. Missing values are normal and reflect what the agency published. Try a different dataset if you need a specific metric.

The Actor is timing out.

Large pulls can take time. Increase the Actor's timeout in the Apify run settings, or lower the Maximum records to pull in smaller batches across multiple runs.

I got an error about the dataset ID.

Select the dataset from the dropdown rather than typing an ID manually. The four enum values in the input schema are the only valid Socrata dataset identifiers.

FAQ

QuestionAnswer
What is Medicare Spending Per Beneficiary data?It is a CMS metric that measures average Medicare Parts A and B spending per beneficiary for a given hospital, compared to the national median. The data includes spending during the inpatient stay and for 30 days after discharge.
Which datasets can I scrape with this Actor?Four datasets: Medicare Spending Per Beneficiary at the hospital, state, and national levels, plus Medicare Hospital Spending by Claim. You pick one per run from the Dataset dropdown.
Do I need a CMS account or API key?No. The Actor queries the public Socrata Open Data API that CMS uses to serve these datasets. No registration, no key, no OAuth.
How do I filter by state?Enter a two-letter US state code like CA, NY, or TX in the State field. Leave it empty to pull records for all states.
Can I search for a specific hospital?Yes. Use the Facility Name field for a partial match. Typing 'Mercy' will return every facility whose name contains that word.
How many records can I pull in one run?Set the Maximum records field to any number from 1 to 1,000,000. The Actor stops when it hits that count or exhausts the dataset.
What fields are in the output?Each dataset returns a fixed set of columns that typically includes facility name, address, state, claim count, and spending metrics. The exact fields depend on which dataset you choose.
How fresh is the data?The Actor pulls whatever CMS has published on their Socrata endpoint. CMS typically updates these datasets annually with a lag of one to two years.
Can I schedule this to run automatically?Yes. Apify schedules let you run the Actor daily, weekly, or monthly. Since CMS updates are annual, a quarterly schedule is usually enough to catch new releases.
What export formats are supported?Your results land in an Apify dataset that you can download as CSV, JSON, Excel, XML, or push to a webhook or cloud storage.

Browse the full ParseForge collection for more scrapers.

πŸ†˜ Need help? Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ Disclaimer. This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Centers for Medicare & Medicaid Services. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.