Medicare Hospital Spending by Claim

Also known as Medicare Spending per Beneficiary (MSPB) Spending Breakdowns by Claim Type

Getting Started

All communication with the API is done through HTTPS, and errors are communicated through HTTP response codes. Available response types include JSON, XML, and CSV, which are selectable by the "extension" on API requests or by HTTP Accepts headers.

This documentation also includes inline, runable examples. Click on any link that contains a gear symbol next to it to run that example live against the Medicare Hospital Spending by Claim API.

App Tokens

All requests should include an app token that identifies your application, and each application should have its own unique app token. A limited number of requests can be made without an app token, but they are subject to much lower throttling limits than request that do include one. If you don't have an app token yet, click the button to the right to sign up for one.

Once you have an app token, you can include it with your request either by using the X-App-Token HTTP header, or by passing it via the $app_token parameter on your URL.

Response Codes

One of the following response codes will be returned with every request:

  1. 200Successful request.
  2. 202Request processing. You can retry your request, and when it's complete, you'll get a 200 instead.
  3. 400Bad request
  4. 401Unauthorized. You're not authorized to access this resource.
  5. 404Not found. The resource requested doesn't exist.
  6. 429Too Many Requests. The client has made too many requests and is currently being rate limited.
  7. 500Server errors. Our bad!

Code Samples

#!/usr/bin/env ruby

require 'net/https'
uri = URI('https://data.medicare.gov/resource/spending-breakdown-by-claim.json?recall_id=94')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER

request = Net::HTTP::Get.new(uri.request_uri)
request.add_field('X-App-Token', ARGV[0])

response = http.request(request)
puts response.code
puts response.body
#!/usr/bin/env python

import sys
import requests

r = requests.get('https://data.medicare.gov/resource/spending-breakdown-by-claim.json?recall_id=94', headers={'X-App-Token': sys.argv[1]})
print r.status_code
print r.text
request = require 'request'
options = uri: 'https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$$app_token=APP_TOKEN&recall_id=94'
request options, (err, response, body) ->  console.log body
#!/bin/sh 

curl --header "X-App-Token: $1" "https://data.medicare.gov/resource/spending-breakdown-by-claim.json?recall_id=94"

Fields

The following fields are available on the Medicare Hospital Spending by Claim API.

hospital_name

Human Name: Hospital Name
Type: text

Examples

Retrieve all records with hospital_name equal to ZUNI COMPREHENSIVE COMMUNITY HEALTH CENTER:
Retrieve all records with hospital_name equal to ZUNI COMPREHENSIVE COMMUNITY HEALTH CENTER:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with hospital_name equal to ZUNI COMPREHENSIVE COMMUNITY HEALTH CENTER:

Retrieve all records that are greater than ABBEVILLE GENERAL HOSPITAL:

Retrieve all records with hospital_name equal to ZUNI COMPREHENSIVE COMMUNITY HEALTH CENTER:

Retrieve all records where hospital_name is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(hospital_name, 47.598177,-122.33448, 1000)

provider_number

Human Name: Provider Number
Type: text

Examples

Retrieve all records with provider_number equal to 670082:
Retrieve all records with provider_number equal to 670082:

Retrieve all records where provider_number is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(provider_number, 47.598177,-122.33448, 1000)

state

Human Name: State
Type: text

Examples

Retrieve all records with state equal to WY:

Retrieve all records where state is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(state, 47.598177,-122.33448, 1000)

period

Human Name: Period
Type: text

Examples

Retrieve all records with period equal to During Index Hospital Admission:
Retrieve all records with period equal to During Index Hospital Admission:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with period equal to During Index Hospital Admission:

Retrieve all records that are greater than 1 through 30 days After Discharge from Index Hospital:

Retrieve all records with period equal to During Index Hospital Admission:

Retrieve all records where period is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(period, 47.598177,-122.33448, 1000)

claim_type

Human Name: Claim Type
Type: text

Examples

Retrieve all records with claim_type equal to Total:
Retrieve all records with claim_type equal to Total:

Retrieve all records where claim_type is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(claim_type, 47.598177,-122.33448, 1000)

avg_spending_per_episode_hospital

Human Name: Avg Spending Per Episode (Hospital)
Type: money

Examples

Retrieve all records with avg_spending_per_episode_hospital equal to 33540:
Retrieve all records with avg_spending_per_episode_hospital equal to 33540:

Retrieve all records where avg_spending_per_episode_hospital is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(avg_spending_per_episode_hospital, 47.598177,-122.33448, 1000)

avg_spending_per_episode_state

Human Name: Avg Spending Per Episode (State)
Type: money

Examples

Retrieve all records with avg_spending_per_episode_state equal to 20624:
Retrieve all records with avg_spending_per_episode_state equal to 20624:

Retrieve all records where avg_spending_per_episode_state is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(avg_spending_per_episode_state, 47.598177,-122.33448, 1000)

avg_spending_per_episode_nation

Human Name: Avg Spending Per Episode (Nation)
Type: money

Examples

Retrieve all records with avg_spending_per_episode_nation equal to 18704:
Retrieve all records with avg_spending_per_episode_nation equal to 18704:

Retrieve all records where avg_spending_per_episode_nation is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(avg_spending_per_episode_nation, 47.598177,-122.33448, 1000)

percent_of_spending_hospital

Human Name: Percent of Spending (Hospital)
Type: percent

Examples

Retrieve all records with percent_of_spending_hospital equal to 100.00:
Retrieve all records with percent_of_spending_hospital equal to 100.00:

Retrieve all records where percent_of_spending_hospital is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(percent_of_spending_hospital, 47.598177,-122.33448, 1000)

percent_of_spending_state

Human Name: Percent of Spending (State)
Type: percent

Examples

Retrieve all records with percent_of_spending_state equal to 100.00:
Retrieve all records with percent_of_spending_state equal to 100.00:

Retrieve all records where percent_of_spending_state is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(percent_of_spending_state, 47.598177,-122.33448, 1000)

percent_of_spending_nation

Human Name: Percent of Spending (Nation)
Type: percent

Examples

Retrieve all records with percent_of_spending_nation equal to 100.00:
Retrieve all records with percent_of_spending_nation equal to 100.00:

Retrieve all records where percent_of_spending_nation is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.medicare.gov/resource/spending-breakdown-by-claim.json?$where=within_circle(percent_of_spending_nation, 47.598177,-122.33448, 1000)