Register your application on the Blue Button 2.0 developer portal; obtain client ID and secret for the OAuth2 authorization code flow; configure your redirect URI and request the 'patient/ExplanationOfBenefit.read' and 'patient/Patient.read' scopes
Initiate the OAuth2 authorization code flow: redirect the beneficiary to the Blue Button authorization endpoint with your client ID, requested scopes, state parameter, and PKCE code challenge; handle the callback to exchange the authorization code for an access token using YOUR_TOKEN
GET the beneficiary's Patient resource to confirm identity and retrieve the FHIR patient ID; then GET ExplanationOfBenefit resources with a search by patient: GET /v2/fhir/ExplanationOfBenefit?patient={patient_id}&_count=50
Paginate through Bundle.link[rel='next'] links to retrieve the full claims history; Blue Button returns Part A (inpatient), Part B (outpatient and professional), and Part D (drug) claims as distinct ExplanationOfBenefit profiles — distinguish by ExplanationOfBenefit.type coding
For each EOB parse: EOB.item for service lines with procedureSequence, productOrService (CPT/HCPCS/NDC), adjudication amounts (submitted, allowed, paid, patient liability); EOB.payment for total claim payment; EOB.diagnosis for ICD-10 codes
Store the access token securely; Blue Button tokens have an expiration — implement refresh token logic to maintain access across multi-step workflows without requiring the beneficiary to re-authorize
Known gotchas
Blue Button 2.0 returns claims data with a lag of approximately 2 weeks from adjudication; real-time claims data is not available — do not use Blue Button for concurrent billing or real-time COB purposes
Part D ExplanationOfBenefit resources use NDC codes in item.productOrService rather than HCPCS codes used in Part B; ensure your parsing logic handles both coding systems rather than assuming all EOBs use the same code system
The Blue Button sandbox uses synthetic beneficiary data (BENE IDs in the test range) that does not match production IDs; production tokens and synthetic tokens are not interchangeable — test and production environments are completely separate
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp