Epic FHIR R4 REST API

N/A · active · verified Tue Mar 17

Epic's FHIR R4 API enables access to electronic health record (EHR) data including patients, encounters, observations, conditions, medications, and more. Epic supports SMART on FHIR and OAuth 2.0 for authorization. The open sandbox at fhir.epic.com allows testing with synthetic data. Production access requires registration with Epic's App Orchard and approval from individual health systems.

Warnings

Install

Imports

Quickstart

Fetch a test patient resource from the Epic FHIR R4 open sandbox using a Bearer token.

import os
import requests

BASE_URL = "https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4"
access_token = os.environ.get("EPIC_FHIR_ACCESS_TOKEN", "")

headers = {
    "Authorization": f"Bearer {access_token}",
    "Accept": "application/fhir+json"
}

# Read a test patient from the Epic open sandbox
resp = requests.get(
    f"{BASE_URL}/Patient/erXuFYUfucBZaryVksYEcMg3",
    headers=headers
)
resp.raise_for_status()
patient = resp.json()
print(f"Patient: {patient['name'][0]['given'][0]} {patient['name'][0]['family']}")

view raw JSON →