How a Medplum team connects to Epic's FHIR API
A team that needs Medplum to read and write Epic data should start from one fact: Medplum's integration catalog lists Epic Systems for read and write through the FHIR API using Epic JWT authentication. That method relies on signed JWT client assertions as specified in RFC 7523, the same mechanism the SMART on FHIR Backend Services specification uses for server-to-server access. In practice, Medplum signs a short-lived assertion with a private key, exchanges it for an access token, and calls Epic's FHIR endpoints with that token. Nothing in this flow depends on a user signing in, which is why the setup is owned by the integration team and the Epic customer's administrators rather than by clinicians.
This page covers the Medplum side: how the client is registered, how the key pair and signed assertion are produced and rotated, which read and write workflows run in Medplum Bots, and what the integration team should agree with the Epic customer before go-live. It does not replace Epic's own onboarding. Epic's app registration, the scopes the customer approves, the sandbox and production environments, and any Epic-side review or certification steps are set by Epic and by the customer's Epic team, and the exact requirements should be confirmed directly with them. Before writing code, confirm which Epic FHIR resources and operations the customer has enabled, and which of them your Medplum workflows will write back to, because write access is usually the decision that changes the risk review.
What your team and the Epic customer must have in place before setup
Epic connections depend on decisions made outside the Medplum codebase, including who registers the client, who holds the signing keys and which environment is used for testing. Settle these items before any Bot is written, because each one blocks the next step.
Medplum environment your team controls
Decide whether the Medplum server runs as Medplum Cloud or as a self-hosted deployment in infrastructure your organization operates. The Bots that call Epic run in that environment, so its version, patch cadence and access controls become part of the Epic integration's risk profile. Confirm which Medplum version you will pin and who is responsible for applying security patches to it.
Medplum self-hosting docsNamed Epic customer contact
Epic's client registration and environment access are handled by the health system's Epic team, not by DeployOpen or Medplum. Name one contact who owns the registration request, the scopes it asks for and the follow-up when Epic asks questions. Without a named owner, the registration tends to stall between the integration team and the Epic administrators.
Key pair ownership and storage
Client assertion with signed JWTs, as described in RFC 7523, depends on a private key that only your side holds and a public key registered with Epic. Decide who generates the key pair, where the private key is stored (for example a secrets manager your team already audits) and who can rotate it. Confirm with Epic which key formats and algorithms its registration accepts before generating anything.
Client assertion docsNetwork paths to Epic's FHIR endpoints
The Medplum server or Bot runtime must reach Epic's token endpoint and FHIR base URLs over HTTPS. Map the outbound path through your proxies, firewalls and egress policies, and check whether the health system requires allow-listed source addresses or a specific network zone. Ask Epic for the current endpoint list for your environment, since these details are not assumed from this page.
Agreed test environment
Ask the Epic customer which non-production environment is available for registration testing, sample patients and read and write checks. Agree on how test data is created, who may write to it and how it is cleared, so that no Bot writes into a production chart during setup. Record the test environment's base URL and registration status in the project plan before development starts.
Confirmed Epic steps and documentation
Epic's registration workflow, scope approvals and environment requirements change over time and vary by customer configuration. Do not build the plan from this page alone. Obtain the current Epic documentation through the customer, confirm each registration step with their Epic team in writing and record the version of the documentation you followed.
How the JWT backend flow moves a token request from Medplum to Epic
The flow starts in a Medplum Bot or scheduled job, which builds a token request. Medplum signs a client assertion with a private key that stays in its own environment, then sends only the signed assertion to Epic's token endpoint. Epic returns an access token, which Medplum holds and uses to call the FHIR API. The results are then written into the Medplum data store. Check that the private key never leaves the Medplum side and that the token covers only the Epic resources the workflow needs.
The private key stays in Medplum while only the signed assertion crosses into Epic.
Registering the Medplum client with Epic and wiring signed assertions
This sequence takes the Epic customer and the Medplum deployment from agreed scopes to a working JWT backend connection, proven first in the test environment and then promoted to production with a documented configuration.
Agree Epic environments and scopes
Before any technical work, the DeployOpen team and the Epic customer's integration team agree which Epic environments will be used (typically a non-production environment first), which FHIR resources and operations the Medplum client needs, and who at the customer owns the Epic app registration and approvals. Confirm the exact scope names, the test patient population and the named contacts in writing. The step is done when the scope list and test data plan are signed off by both sides. Confirm the current registration steps and environment names directly with Epic and the customer's Epic administrators, since these depend on their Epic version and hosting.
Generate the key pair and publish the public key
The team generates an asymmetric key pair in the self-hosted environment, keeping the private key in a secrets store that only the Medplum server and its Bots runtime can read. The public key, packaged in the format Epic's registration process requires, is submitted through the Epic app registration. Record the key identifier, the algorithm and the expiry so rotation can be planned. The step is done when Epic confirms it has received the public key and the registration shows the key as active in the test environment. Ask Epic which key format and algorithms it accepts for backend authentication.
Configure the Medplum client for signed assertions
In Medplum, create or update the ClientApplication for the Epic connection and configure it for client assertion with a signed JWT, the RFC 7523 method used by SMART Backend Services. Set the token endpoint, the Epic client identifier, the audience and the scopes agreed in step one, and point the signing configuration at the private key held in the secrets store. Keep the configuration in version control with secret values excluded. The step is done when the ClientApplication validates in the test project and the signing key loads without errors at server start. Check the current configuration keys against Medplum's client assertion documentation before you deploy.
Run a token request in the test environment
Trigger a backend token request from the Medplum server to Epic's test authorization endpoint. The request contains a signed client assertion with the required claims, and Epic returns an access token for the agreed scopes. Log the request and response metadata without logging the assertion or the token. Verify that the token's scopes match the agreed list and that its lifetime matches what Epic documents. The step is done when the token response is received and the scopes are confirmed, with a failure reason recorded for any rejected assertion such as a clock skew, a wrong audience or an unregistered key.
Read a test Patient from Epic
Using the token from the previous step, issue a read against a Patient in the Epic test environment that the customer has agreed to use. Run the read from a Medplum Bot or a server-side script, not from a browser, so the call follows the same path production will use. Confirm that the returned resource is a valid FHIR Patient, that its identifiers match the test record, and that the response contains only the fields the scope allows. The step is done when the readable test Patient is stored or displayed in Medplum with the Epic source identifier preserved. Confirm with the customer which read operations are enabled for the test app.
Write one test resource against agreed data
Perform one write to the Epic test environment using a resource type the customer has approved for writing, such as a test Observation or a test Encounter linked to a test Patient. Make the write through the same Bot path planned for production, with idempotency handled so a retry cannot create duplicates. Read the resource back through Epic's API to confirm it persisted with the expected values. The step is done when the write is confirmed by a read-back and the customer's Epic team confirms the record appears in their test chart. Confirm with the customer that test writes are permitted and how the test records will be removed.
Promote the configuration to production
Move the approved configuration, not the test secrets, into the production Medplum deployment through the standard change process. Generate or import the production key pair under the same controls, have the customer's Epic team register the production public key and confirm production scopes, and run a single production token request and read against a patient the customer designates. Record the production client identifier, key identifier and expiry in the runbook and set a rotation reminder. The step is done when production returns a valid token and the designated read succeeds, and both teams sign off the integration as live.
Which Epic FHIR data maps to which Medplum records
This table compares each Epic-side FHIR resource with its Medplum counterpart, the identifier used to match records and the owner who signs off on the mapping. Treat every row as a proposal to confirm against the Epic build for your organization, since the resources Epic exposes depend on what your Epic customer has enabled and agreed to share.
| Epic-side resource | Medplum resource | Match identifier | Confirmed by |
|---|---|---|---|
| Patient identity and identifiers | Patient | Epic FHIR Patient ID plus the MRN or other identifiers your customer agrees to share, stored in Patient.identifier | Epic customer's registration or HIM team, with your integration lead |
| Encounter | Encounter | Epic FHIR Encounter ID, linked to the Patient reference and encounter class agreed for the workflow | Epic customer's clinical informatics team |
| Observations such as vitals and labs (if agreed) | Observation | Epic FHIR Observation ID plus the source Encounter and code system used in the Epic build | Epic customer's clinical informatics and lab teams |
| Diagnoses and problems (if agreed) | Condition | Epic FHIR Condition ID plus ICD-10-CM or SNOMED CT code as published in the Epic build | Epic customer's clinical documentation team |
| Medications (if agreed) | MedicationRequest or MedicationStatement | Epic FHIR medication ID plus RxNorm code and the prescription or statement reference | Epic customer's pharmacy and clinical informatics teams |
| Clinical documents (if agreed) | DocumentReference | Epic document ID plus the document type and author reference | Epic customer's HIM team and your compliance lead |
| Practitioner and location references | Practitioner, Location | Epic provider and department IDs, mapped to your own identifiers in a reference table | Epic customer's provider data owner |
What to agree with the Epic customer's team before any data moves
The most important decisions for an Epic connection sit outside Medplum. Before any data moves, agree in writing which Epic environment will be used for testing, who owns client registration in the customer's Epic instance, who holds the private key used to sign client assertions, and how and when that key is rotated. Confirm with the customer's Epic team which registration type and JWT signing method their instance expects, and which Medplum ClientApplication and key identifiers will be registered against it. Ownership should be named by role and by person, with a backup for each, because a rotation that nobody owns is the most common reason a working backend connection stops.
Next, agree the resources and scopes the customer approves for reading and writing, and the workflows that will use them. The customer's clinical informatics and privacy owners should sign off on each resource type, each read or write direction, and the reason for it, since the scopes granted in Epic set the outer limit for everything a Medplum Bot can do. Patient matching needs the same care. Decide which identifiers Epic will use to match records, who confirms an ambiguous match, and what happens when Medplum receives a result for a patient it cannot match. Document these rules before go-live rather than letting each Bot make its own choice.
Finally, agree who receives alerts when a token request fails, when a read or write returns an error, and when Epic changes its FHIR behavior or sandbox availability. Name a monitoring owner on each side, define the escalation path and the hours of cover, and record the contacts in the integration runbook. Confirm with the customer what must be logged for their audit and retention needs. The agreements should be documented in writing and signed off by both sides before a production connection is created, and they should be reviewed whenever keys, scopes or workflows change.
Which workflows run as Medplum Bots and which stay outside them
Pulls bring Epic data into Medplum on a schedule or when an operator starts one. A Bot fits when the work is a bounded fetch, map and store: call Epic's FHIR API with a signed client assertion, read the results and write the mapped resources into Medplum. Bots are Medplum's server-side logic, so the code that reads Epic runs in the same deployment that holds the data.
- Trigger: a schedule or a manual invocation, with the search window or patient list fixed in the Bot's input.
- Secrets: the Epic client identifier, the private key used to sign the client assertion and the Epic token endpoint, held as Bot secrets or in a secrets manager, never in source code.
- Access: an Epic app registration limited to the resource types and read scopes the workflow needs, plus a Medplum access policy that limits what the Bot can write.
- Keep outside: long paging runs, bulk exports and any work that needs a persistent worker, which belong in a separate service that calls the Medplum API.
Check the Epic scopes and the Medplum access policy together, since a narrow Epic scope does not limit what a Bot with broad Medplum write access stores.
Writes send Medplum changes to Epic when something happens in Medplum, such as a resource being created or finalized. A Bot fits the mapping step, because it can read the triggering resource, transform it to the form Epic accepts and make a single authenticated call. Which resources Epic accepts for writes depends on the customer's Epic configuration, so confirm that before any Bot is built.
- Trigger: a Subscription or an explicit Bot invocation tied to a specific Medplum resource change.
- Secrets: the Epic signing key and client identifier, ideally in a separate Epic client registration from the read workflows so write permissions stay isolated.
- Access: write scopes granted by the Epic customer for named resource types only, and a Medplum project setup that limits which resources can trigger the Bot.
- Keep outside: retry queues, dead-letter storage, rate-limit handling and the record of what Epic accepted or rejected, which belong in a service that can hold state across failures.
Ask the Epic customer's team which write operations they have enabled and how they expect failed writes to be handled before the trigger is designed.
Reconciliation compares the records held in Epic with those in Medplum and reports where they differ. A Bot can run a bounded comparison, such as checking one patient or one encounter list, and return the differences. Full-population comparisons and the review workflow around them usually need a process that runs longer and stores its own results.
- Trigger: a schedule for routine checks, or an operator request for a specific patient or encounter set.
- Secrets: read-only Epic credentials, so the job cannot change data on either side.
- Access: a Medplum access policy that lets the Bot read the compared resources but not write to them, and a defined place to record each run.
- Keep outside: large comparisons, matching logic that needs tuning over time, the queue of discrepancies for human review and alerting, which belong in a separate service.
Agree with the Epic customer's team which identifiers are used to match records and how often comparisons may query their API, since these choices set the load on Epic and the quality of the results.
Hardening the private key, token lifetimes and data access
The Epic connection runs on one signing key, one set of scopes and one Bot configuration, and each of them can expose patient data if it is left open. The controls below cover how the key is stored and rotated, what the token request can reach, what stays out of logs, who can change Bots and how reads and writes are recorded. Agree the specifics with the Epic customer's team before go-live.
Store the signing key in a secrets manager
The private key that signs each client assertion is the credential that lets Medplum obtain Epic access tokens, so it should never sit in a repository, a container image or a plain environment file. Keep it in a secrets manager that your infrastructure controls, and grant read access only to the service identity that runs the token request. Check who can export the key, whether access is logged, and whether the key can be restored after a host is rebuilt. Under the HIPAA Security Rule, access control standards in 45 CFR 164.312 expect you to limit access to systems holding ePHI to authorized users and software, and the key is part of that path.
Rotate keys on an agreed schedule
Key rotation limits how long a leaked key remains useful. Agree the rotation interval and the procedure with the Epic customer's team, including how the new public key is registered with Epic, how the old key is retired, and what happens to tokens already issued. Test the rotation in a non-production environment first so a failed swap does not stop clinical data flow. Document who approves a rotation and who can run it on short notice if a compromise is suspected. Keep the record of each rotation as evidence for your access control review.
Limit scopes to the agreed resource mapping
The SMART Backend Services scopes requested in the token call should match the resource mapping signed off with Epic, and nothing broader. A scope that grants read access to every Patient or Observation record gives a Bot far more data than its workflow needs. Compare each requested scope against the mapping document, remove scopes that no Bot uses, and confirm with the Epic team that the granted scopes match what you asked for. The HIPAA Security Rule's access control standard expects access to ePHI to be limited to what each user or program needs, so the mapping is your evidence.
Keep tokens and assertions out of logs
The signed client assertion and the access token are both credentials, and a token written to a log file or a log platform can be replayed until it expires. Configure the Bot runtime and any proxy or gateway in front of Epic so that request bodies, authorization headers and token responses are not logged. Check the logs for accidental leaks after each change to logging settings, and restrict who can read the logs. Short token lifetimes shrink the window of misuse, but only if the tokens themselves stay out of storage that others can read.
Restrict who can change Bot configuration
A change to a Bot's code, its secrets or its trigger can alter which Epic records are read or written, so changes need the same control as a change to the token setup. Limit edit rights on the Bots that call Epic to a named group, require review of code changes before deployment, and keep a record of who changed each secret reference. Confirm with your own team which Bot changes need a second approver. Medplum's access policies control who can use the platform, and your change process controls what those users can alter.
Record audit trails for reads and writes
Audit controls in 45 CFR 164.312 expect hardware, software and procedural mechanisms that record and examine activity in systems containing ePHI. For the Epic connection, this means logging each Bot run, each read from Epic and each write back, with the identity that triggered it and the resource affected. Confirm that Medplum's audit records and your log platform retain these entries for the period your policy requires, and test that you can reconstruct one patient's access history from them. The HIPAA Security Rule has no certification, so the audit trail is what you show an auditor or the HHS Office for Civil Rights.
Subpart C textCommon failures in the Epic token and data flow
This table pairs each failure the Epic token and data flow commonly produces with its likely cause and a first check the team can run. Work down the symptoms in the order a request travels: token request, data read, then write. The main takeaway is that most failures trace to a mismatch between the key, the clock, the environment URL, or the scopes granted, and each can be confirmed before anyone changes code.
| Symptom | Likely cause | First fix |
|---|---|---|
| Epic rejects the client assertion with an invalid signature error | The JWT was signed with a private key that does not match the public key registered with Epic for this client | Export the public key from the JWKS endpoint you registered and compare its key ID and modulus with the key your Bot loads. Re-sign a test assertion locally and verify it against that public key before calling Epic. |
| Token request fails with an expired or not-yet-valid assertion | Clock skew on the host that signs the JWT, or an exp or iat claim set outside the window Epic accepts | Check the host's time sync status and compare its UTC time with a trusted time source. Decode a fresh assertion and confirm iat is current and exp is only a few minutes ahead. |
| Token request fails with a client not found or unknown key error | The key or client was registered in a sandbox or non-production environment but the request targets production, or the reverse | Confirm the client ID and key ID exist in the exact Epic environment whose token endpoint you are calling. Record the token URL in your configuration and check that it matches the environment in the Epic customer's registration record. |
| Token issued, but data calls return 401 or 403 | The access token does not carry the scopes the resource needs, or the scopes requested differ from those approved for the client | Decode the access token and list its scope claim. Compare it with the scopes approved in the Epic registration and request only the approved set in the token call. |
| Patient search returns zero results | The identifier, demographic set, or patient ID format sent does not match what Epic holds for that person, or the identifier system URI is wrong | Run the same search by a known test patient's Epic FHIR ID and by a second identifier. Confirm with the Epic customer's team which identifier system and search parameters their instance supports. |
| Write rejected with an OperationOutcome validation error | The resource violates a profile or required element that Epic enforces, such as a missing required field, a code outside the expected value set, or an unsupported resource type for write | Capture the OperationOutcome issue expression and text. Validate the outgoing resource against the Epic-specified profile in a non-production environment, then fix the element named in the issue. |
| Calls succeed in one environment and fail in another with identical code | Environment URLs in configuration point to different Epic instances, or the base URL and token URL come from different environments | Print the resolved base URL and token URL at startup and compare both against the environment list supplied by the Epic customer. Keep them in one environment-specific configuration file so they cannot mix. |
| Bot runs but Epic data does not change or appears stale | The Bot or its caller reads a cached token or a Medplum resource that was not refreshed, so the call path differs from what was tested | Log the token expiry and the timestamp of the last successful Epic call. Force a fresh token request in a test run and confirm the response reflects the current record in Epic. |
What buyers ask before connecting Medplum to Epic
What drives the cost of connecting Medplum to Epic?
The main cost drivers are the number of Epic workflows in scope, how many Epic environments you need (sandbox, test and production), and how much of the Epic-side setup your team must coordinate. Each Epic connection also depends on the Epic customer's team completing client registration and approving scopes, so their availability shapes the schedule as much as the build does. Ask for a written scope that lists each read and write workflow, each environment, and who performs each Epic-side step. Any quote follows from that scope, and DeployOpen does not publish a price list.
How long does an Epic FHIR integration take?
Duration depends on how many resources and workflows are in scope, how quickly Epic client registration and sandbox testing are completed, and whether production approval needs a separate review cycle on the Epic side. The timeline is set by those external approvals as much as by the build. Confirm the schedule with the Epic customer's team before work starts, and ask that the written scope tie each milestone to a dependency on either side.
What does the work need from our Epic team?
Your Epic customer's team needs to agree which FHIR resources and operations the integration may read and write, register the backend application in their Epic environment, and provide the non-production and production endpoints and client identifiers. They also need to confirm which Epic data sets are in scope for each clinical workflow. Ask for a named contact for registration, change approvals and test patient access, since these steps gate every later phase.
Can our internal team build the Epic connection alone?
An internal team can build it if it already has engineers who know SMART on FHIR Backend Services, signed JWT client assertions under RFC 7523, Medplum Bots, and Epic's own registration process. The harder parts are usually the Epic-side coordination, testing against Epic's non-production environments, and handling key rotation and change control after go-live. Compare your team's experience with those areas against the written scope, and decide which parts you will own before you choose between an internal build and a partner.
What should a quote for an Epic integration include?
A useful quote lists each in-scope Epic workflow and the Medplum Bots or services that implement it, along with the environments covered and the testing and cutover steps. It should state which party performs each Epic registration, sandbox test and production approval step, and what evidence is delivered at handover. Ask for the assumptions behind the estimate, the exclusions, the change-request process, and whether ongoing key rotation and Epic upgrade support are included or sold separately as a retainer.
How are signing key rotation and Epic changes handled after go-live?
Signing keys used for client assertions should have a documented owner, a rotation schedule set by your security policy, and a tested procedure to register the new public key with Epic before the old one is retired. Epic may also change its FHIR endpoints, supported resources or registration requirements, so someone must monitor Epic release communications and test changes in a non-production environment. Ask the provider to define who performs rotation, how Epic changes are tracked, and whether this support is covered by a retainer.
Which compliance evidence should we expect from the integration?
Expect the integration to produce evidence of access scope, key handling, audit logging and change approvals, because the HIPAA Security Rule applies to ePHI that your organization creates, receives, maintains or transmits. Its technical safeguards cover unique user identification, audit controls and encryption, and a business associate contract must cover any vendor that handles ePHI. HIPAA has no certification, so ask for documented controls and an independent assessment where your contracts require one, and confirm the Epic data-sharing agreement with your legal team.
How DeployOpen scopes, builds and supports a Medplum to Epic connection
DeployOpen plans, builds, documents and supports self-hosted open-source platforms inside the client's own infrastructure. For a Medplum to Epic connection, that means agreeing the Epic-side registration and access with the Epic customer's team first, then building the JWT backend authentication and Bot workflows in your environment. Engagements are fixed-scope, with scope and deliverables agreed in writing before work starts.
How we scope
- Written scope listing which Epic resources, read and write workflows, and Bots are in the connection
- Confirmation of the Epic customer's requirements, including sandbox and production environments and the registered application details
- Agreed responsibilities for your Epic customer team, your Medplum operators and DeployOpen, recorded before build starts
How we build
- Medplum client configuration and key handling for signed client assertions, with private keys kept in infrastructure you control
- Bots that implement each agreed read and write workflow, with error handling and logging for failed Epic calls
- Test runs against the Epic sandbox your team confirms is available, with results recorded against the agreed scope
How we hand over
- Written documentation of the registration steps, token flow, Bot logic, configuration keys and secret locations
- A runbook covering key rotation, failed authentication, Epic API errors and Bot redeployment
- Handover sessions with your engineers and security team, with open items listed and assigned
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, scoped in writing
- Review of Medplum version changes and their effect on the Epic connection before you upgrade
- Retesting after changes to Epic scopes, Bots or the Medplum deployment, with findings and fixes documented

