Healthcare Interoperability
Building a FHIR API Gateway: Architecture Patterns for Multi-EHR Hospital Networks
Published September 15, 2026 · Influrion Editorial Team
Hospital networks rarely run one EHR. After mergers, specialty acquisitions, and ambulatory roll-ups, you inherit Epic here, Cerner/Oracle Health there, a regional ambulatory stack, and a long tail of departmental systems. Apps, payers, and patient portals still expect one coherent FHIR surface. Influrion Solutions builds healthcare integration software for exactly this problem: a FHIR API gateway that presents a stable contract while adapters speak each EHR’s dialects.
A FHIR API gateway is not “an API Management product with FHIR in the marketing deck.” It is a deliberate control plane for routing, identity, authorization, consent, transformation, observability, and resilience across heterogeneous clinical backends. Done well, new digital products attach once. Done poorly, every app reinvents point-to-point FHIR calls and your network’s technical debt compounds with every merger.
What a FHIR API gateway is (and is not)
Is: A network-facing FHIR R4 (sometimes dual-version) façade that:
- Terminates TLS and OAuth2 / SMART on FHIR
- Routes
Patient,Encounter,Observation, and other resource requests to the right EHR or data service - Normalizes identity (MPI), tenancy (facility / org), and profile validation (US Core or local IGs)
- Enforces consent, break-glass, and audit before clinical data leaves the trust boundary
- Returns FHIR-shaped responses (and errors) even when backends are HL7 v2, proprietary REST, or bulk extracts
Is not: A full EHR replacement, a magic Master Patient Index by itself, or a substitute for clinical data governance. The gateway orchestrates access; the systems of record still own clinical truth.
| Pattern buyers confuse | Reality |
|---|---|
| “We expose each EHR’s FHIR endpoint and document them” | Consumers still do N integrations and N auth models |
| “We’ll put Kong/Apigee in front and call it FHIR” | Without clinical adapters, identity, and IG validation, you only moved the TLS termination |
| “One data lake + GraphQL for everything” | Lakes help analytics; live clinical read/write and SMART apps still need FHIR semantics and audit |
Why multi-EHR networks need a gateway
1. Consumers cannot absorb EHR variance
Patient access apps, care-management tools, and internal service lines want one base URL, one token audience, one CapabilityStatement. EHRs differ in resource support, search parameters, pagination, and SMART scopes. The gateway absorbs that variance.
2. Mergers outpace rewrite programs
You will not finish a single-EHR consolidation before the next acquisition. The gateway lets the network product roadmap move while EHR rationalization proceeds on its own timeline.
3. Security and compliance need one choke point
HIPAA technical safeguards, BAAs with digital vendors, and internal audit teams prefer one place to attach logging, rate limits, anomaly detection, and consent checks—not twelve EHR-native configs that drift.
4. Product teams need a stable SLA
When a specialty clinic’s FHIR sandbox flaps, the gateway can fail closed, degrade gracefully, or serve cached non-sensitive metadata according to policy—without every mobile client implementing custom backoff for each vendor.
Reference architecture: layers that matter
Think in five layers. Skip one and you will rediscover it during an outage or an OCR audit.
Edge and API management
- TLS termination, WAF, DDoS, IP allowlists for B2B partners
- Rate limits per client_id and per patient-access tier
- Request size limits (FHIR Bundles grow fast)
Identity and authorization
- SMART on FHIR / OAuth2 authorization code + PKCE for apps
- Client credentials for trusted backend services
- Token exchange or on-behalf-of flows when the gateway must call EHR token endpoints with different audiences
- Scope mapping: external
patient/*.read→ internal scopes per EHR
Clinical routing and adapters
- Org / facility router: map
Organization/ location context to EHR instance - Patient router: MPI lookup → EHR medical record numbers (MRNs) and issuing authorities
- Resource adapters: translate canonical FHIR requests into EHR FHIR, vendor APIs, or (carefully) v2 queries
- Response normalizer: map vendor extensions into approved profiles; strip unsafe fields
Policy, consent, and audit
- Consent Decision Point before returning clinical resources
- Purpose-of-use and data-segmentation (when your jurisdiction or IG requires it)
- Immutable audit events: who, what patient, which resource, which backend, decision outcome
Observability and ops
- Correlation IDs end-to-end (gateway → adapter → EHR)
- SLOs on p95 latency per resource type
- Synthetic FHIR probes against each adapter (not only the edge health check)
Core architecture patterns
Pattern A — Facade with per-EHR adapters (default)
One public FHIR base URL. Internally, an adapter registry keyed by EHR instance. Best default for multi-hospital networks with 2–6 major EHRs.
Strengths: Clear consumer contract; incremental adapter delivery; easy to add a new EHR after acquisition.
Watch-outs: Adapter quality varies; “80% FHIR parity” across EHRs still feels broken to apps if search parameters differ silently.
Pattern B — Aggregation gateway (fan-out reads)
For cross-facility longitudinal views, the gateway fans out Patient / Encounter / DocumentReference queries, merges Bundles, and deduplicates. Writes stay pin-pointed to a single system of record.
Strengths: Patient-facing apps get a network-level chart view.
Watch-outs: Latency multiplies; partial failures need explicit Bundle semantics (entry.response / OperationOutcome); never invent clinical merges the clinicians did not approve.
Pattern C — Strangler around a legacy integration bus
Keep the existing enterprise service bus for HL7 v2 ADT/ORU while new digital products only speak FHIR to the gateway. Adapters may call the bus for some domains and native EHR FHIR for others.
Strengths: Avoids big-bang; protects revenue systems.
Watch-outs: Dual paths can diverge—contract tests must assert equivalence for critical workflows (ADT → Encounter status).
Pattern D — BFF + gateway (product-specific shapes)
A Backend-for-Frontend sits in front of the FHIR gateway for a portal or mobile app, composing screens from multiple FHIR calls. The gateway remains the only path to EHRs; the BFF never holds EHR credentials.
Strengths: Better UX latency and payload shaping.
Watch-outs: BFFs that bypass the gateway recreate spaghetti—treat that as an architecture defect, not a shortcut.
Identity: the hard part buyers underestimate
Without a trustworthy MPI strategy, your gateway becomes a high-speed wrong-patient machine.
Checklist:
- Canonical patient identifier internal to the network (not a raw MRN from one EHR).
- Crosswalk table (or MPI service) mapping canonical ID → EHR instance + local MRN + assigning authority.
- Explicit failure modes when confidence is low: return OperationOutcome, do not guess.
- Write-path rules: which EHR is system of record for demographics updates; never dual-write blindly.
- Break-glass flows with elevated audit—and automatic review queues.
If your MPI is “we match on name + DOB in the gateway,” stop and fund identity properly before scaling FHIR consumers.
Authorization and SMART realities across EHRs
Each EHR’s SMART/OIDC stack has quirks: launch contexts, refresh token lifetimes, offline access, and which scopes are actually honored. The gateway should:
- Present one authorization server (or a carefully designed multi-IdP broker) to consumers
- Hold the per-EHR token vault for adapter calls
- Map and reduce scopes (never expand)
- Reject tokens that lack patient or encounter context when the route requires it
For B2B partners, prefer client credentials + narrow system scopes plus contractual purpose-of-use over pretending every partner is a SMART app.
Consent, minimum necessary, and data segmentation
A gateway that only checks “valid token” will eventually leak the wrong specialty notes to the wrong app. Wire consent before serialization:
| Decision | Gateway behavior |
|---|---|
| No consent / expired | 403 with FHIR OperationOutcome; audit |
| Category-limited consent | Filter resources / elements per policy |
| Emergency break-glass | Allow with tagged audit + time-boxed elevation |
| Research / secondary use | Separate clients, separate pipelines—do not reuse clinical patient-access tokens |
Keep policy logic out of each adapter; adapters fetch, the policy layer decides what leaves.
Caching, bulk, and performance without clinical regret
- Cache CapabilityStatements, structure definitions, and non-patient reference data aggressively.
- Cache patient clinical data only with explicit TTLs, patient-scoped keys, and invalidation hooks (ADT/ORU events). Prefer short TTLs or no cache for meds and allergies if freshness SLAs are strict.
- For population or analytics use cases, prefer FHIR Bulk Data ($export) or warehouse paths—not hammering interactive FHIR search.
- Paginate consistently; normalize vendor pagination quirks at the adapter boundary.
Resilience patterns that belong in the design doc
- Timeouts and budgets per EHR (do not let one slow site stall the whole Bundle merge).
- Circuit breakers per adapter with clear consumer-facing degradation.
- Idempotent writes where EHRs support them; store gateway request IDs for support.
- Poison-message handling for async subscription/webhook bridges.
- Chaos drills: pull one EHR adapter offline in staging and verify apps see controlled errors.
Implementation sequence CTOs can fund
| Phase | Outcome | Typical duration |
|---|---|---|
| 0 — Discovery | EHR inventory, FHIR maturity, MPI readiness, top 5 consumer use cases | 2–4 weeks |
| 1 — Thin façade | Auth + Patient/Encounter read for one EHR + one pilot app | 6–10 weeks |
| 2 — Multi-EHR reads | Second EHR adapter + MPI crosswalk + audit | 8–14 weeks |
| 3 — Policy hardening | Consent hooks, rate limits, SLO dashboards | parallel with 2 |
| 4 — Controlled writes | Narrow write APIs (e.g., DocumentReference) with SoR rules | after read stability |
| 5 — Aggregation / subscriptions | Fan-out reads, event bridges where EHRs allow | roadmap |
Ship vertical slices. A gateway that “supports 40 resources” on paper but cannot reliably find the patient is not an MVP.
Buyer checklist (RFP / vendor evaluation)
Ask every vendor—including internal platform teams:
- Which FHIR release and IGs are exposed externally vs spoken internally?
- How is patient identity resolved across EHRs, and what happens on low-confidence match?
- Where do EHR credentials and refresh tokens live? Who can export them?
- How are consent and minimum-necessary enforced before response?
- What is the adapter test strategy (contract tests against EHR sandboxes)?
- What are p95 latency targets per resource under fan-out?
- How do you version breaking CapabilityStatement changes for consumers?
- Can we disable an EHR adapter without redeploying consumer apps?
- What audit fields are immutable and retained for how long?
- Which write paths are supported, and which system of record wins conflicts?
Common pitfalls
- Exposing raw EHR FHIR URLs “temporarily.” Temporary becomes permanent; revoke them.
- Building the gateway as a giant shared database. It is a control plane, not a second EHR.
- Ignoring search parameter parity. Apps break on
_include, date ranges, and chained searches more than on single-id reads. - Skipping OperationOutcome design. Clients need actionable, non-leaky errors.
- Letting every product team add “just one” direct EHR integration. The gateway only works if it is the only path.
FAQ
Do we need a FHIR gateway if every EHR already has FHIR APIs?
If you have one EHR and one app, maybe not. Multi-EHR networks with multiple consumers almost always need a façade for auth, identity, consent, and stable contracts—even when each EHR is “FHIR capable.”
Should the gateway store clinical data?
Prefer pass-through with short-lived cache for interactive use. Durable clinical stores (CDRs, lakes) are separate products with their own governance. Mixing “gateway cache” and “network CDR” without design creates dual sources of truth.
FHIR R4 or R5 for the external façade?
Most US and many global counterparties still expect R4 for production apps and IGs. Expose R4 externally unless a concrete partner mandate requires R5; keep adapters free to speak whatever each EHR offers.
How does this relate to HL7 v2?
v2 remains the bloodstream for many ADT/ORU flows. Gateways often bridge: v2 into Encounter/Observation updates for eventing, while interactive apps read FHIR. Do not pretend FHIR replaces every feed on day one.
What is Influrion Solutions’ role?
Influrion Solutions is a software development and healthcare IT company. We design and build FHIR-facing integration layers, adapters, and platform services so hospital networks can present one coherent API across heterogeneous EHRs—without betting the roadmap on a single-vendor cutover.
Closing
A multi-EHR FHIR API gateway is how hospital networks stop paying the merger tax on every new digital product. Start with identity and a thin read façade, enforce consent and audit at the edge, and grow adapters behind a stable consumer contract. If you are scoping a gateway for a multi-hospital estate—or stress-testing a vendor’s architecture against the checklist above—contact Influrion Solutions and we can walk through patterns against your EHR inventory and consumer roadmap.
