CMS Blue Button 2.0 API
sandbox.bluebutton.cms.gov · Health
US Medicare beneficiary data API — claims history, provider encounters, and prescription drug records for 53M+ Medicare patients. Uses FHIR R4 and SMART on FHIR. Free sandbox available.
Authentication
Sample Requests
Get Medicare coverage data for the authenticated patient.
Hover any highlighted part to learn what it does
| Authorization | Bearer YOUR_TOKEN |
curl -X GET "https://sandbox.bluebutton.cms.gov/v2/fhir/Coverage/" \ -H "Authorization: Bearer YOUR_TOKEN"
import requests
headers = {
"Authorization": "Bearer YOUR_TOKEN"
}
response = requests.get(
"https://sandbox.bluebutton.cms.gov/v2/fhir/Coverage/",
headers=headers,
)
print(response.json())const url = 'https://sandbox.bluebutton.cms.gov/v2/fhir/Coverage/';
const response = await fetch(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://sandbox.bluebutton.cms.gov/v2/fhir/Coverage/"
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://sandbox.bluebutton.cms.gov/v2/fhir/Coverage/")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_TOKEN"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://sandbox.bluebutton.cms.gov/v2/fhir/Coverage/";
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"Authorization: Bearer YOUR_TOKEN"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Register at bluebutton.cms.gov/developers for sandbox credentials
- Sandbox uses synthetic patients — no real PHI
- Test patient credentials: BBUser00000 / PW00000!
- Standard FHIR R4 endpoints: /Patient, /Coverage, /ExplanationOfBenefit, /Profile
- Production access requires CMS approval and HIPAA compliance
What can you build with CMS Blue Button 2.0 API?
CMS Blue Button 2.0 API is a Health API. Developers commonly use health APIs for:
- accessing medical reference data and drug information
- building patient-facing health tracking apps
- integrating with EHR and telemedicine platforms
- looking up ICD codes and clinical terminology
- powering wellness and fitness applications
OAuth 2.0. OAuth lets your app act on behalf of a user. You redirect them to authorise access, receive a token, then use that token in requests. Best for accessing user-owned data. CMS Blue Button 2.0 API is free to use up to a usage limit, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide