How to Build HIPAA-Compliant Integrations for Healthcare SaaS
A technical guide to building HIPAA-compliant API integrations for healthcare SaaS — covering BAAs, encryption, access controls, and architecture patterns that minimize PHI exposure.
If you're building a healthcare SaaS product that pulls data from EHRs, HRIS systems, or other clinical tools, the single biggest compliance risk you face isn't your core application — it's your integration layer. Every API connection that touches Protected Health Information (PHI) is a potential breach vector, a BAA requirement, and an audit liability. Integrations concentrate third-party credentials, cross-system access, retry logic, logs, and vendor relationships in one place. That makes them a hot zone.
This guide covers the architectural patterns, legal requirements, and practical engineering decisions you need to get right — without turning your integration layer into a second PHI warehouse.
The High Stakes of Healthcare SaaS Integrations
Healthcare has been the most expensive industry for data breaches for over a decade, and the numbers keep getting worse. As of January 28, 2025, the OCR data breach portal shows 725 data breaches of 500 or more records in 2024, the third consecutive year that more than 700 large data breaches have been reported to OCR. Later portal updates pushed the 2024 total higher, with 734 large breaches and over 276 million affected records. Even using the earlier snapshot, that works out to roughly two large breaches per day.
The financial damage is staggering. For the 14th year in a row, the healthcare sector saw the costliest breaches across industries with average breach costs reaching $9.77 million. That's according to IBM's 2024 Cost of a Data Breach Report, against a global cross-industry average of $4.88 million. And that's the average — the Change Healthcare ransomware attack alone is estimated to have cost billions. Associated Press reported that UnitedHealth told Congress the attack involved compromised credentials and no MFA.
Regulators are responding in kind. In the January 2026 HHS inflation update, the maximum civil money penalty for an uncorrected willful neglect HIPAA violation rose to $2,190,294 — per violation, per year. And the enforcement trajectory is pointing up: The OCR Director has confirmed that in 2026, OCR will expand its risk analysis enforcement initiative to also include risk management, and 22 investigations resulted in penalties or settlements in 2024. On January 6, 2025, OCR published a Notice of Proposed Rulemaking to strengthen the Security Rule with explicit requirements around encryption, MFA, vulnerability scanning, penetration testing, network mapping, and annual compliance audits.
Here's the uncomfortable truth for engineering teams: 8 out of 14 mega-breaches in 2024 involved business associates of HIPAA-covered entities. The third-party vendor layer — the exact place where integrations live — is where the damage keeps happening. Verizon's 2025 DBIR says human involvement still showed up in about 60% of breaches, third-party involvement doubled to 30%, and credential abuse remained a leading initial access vector. Your integration layer sits right in the blast radius of all three failure modes.
What Makes an API Integration HIPAA-Compliant?
A HIPAA-compliant API integration protects the confidentiality, integrity, and availability of electronic Protected Health Information (ePHI) across every stage of data exchange — from authentication and transmission to processing and logging.
HIPAA doesn't hand you a technical checklist for APIs. The HIPAA Security Rule (45 CFR Part 164, Subpart C) mandates administrative, physical, and technical safeguards. Translating those legal requirements into software architecture means enforcing specific engineering patterns.
Technical Safeguards
- Encryption in transit: Enforce secure protocols like TLS 1.2+ for all communications — including API calls and integrations with sub-processors. The proposed HIPAA Security Rule NPRM from December 2024 goes further: TLS 1.3 or higher must be used for secure data transmission.
- Encryption at rest: The proposed rule would require encryption of ePHI at rest and in transit, with limited exceptions. Even under the current rule, not encrypting ePHI at rest is an almost indefensible position during an OCR audit. All credential fields — OAuth tokens, refresh tokens, API keys — must be encrypted using AES-256 and masked in any administrative UI.
- Access controls: Every API call that could return ePHI needs authenticated, authorized, and auditable access. No anonymous endpoints. No shared API keys across tenants. No generic service accounts with permission to see everything.
- Audit logging: HIPAA covered entities leveraging digital technologies for sharing and storing ePHI must have mechanisms to record and examine access and other activities within systems that contain or use ePHI. Log every API request, the identity of the user initiating it, the timestamp, and the specific endpoints accessed. But explicitly avoid logging the actual PHI payload. A common mistake engineering teams make is dumping raw HTTP responses into Datadog or CloudWatch for debugging — instantly creating a HIPAA violation. Log metadata, decisions, and hashes, not full payload bodies.
Administrative Safeguards
- Risk assessments: Every organization must maintain an updated inventory of all technology assets that process, store, or transmit ePHI, including creating a network map that tracks ePHI's movement between internal systems and external partners. This is foundational and ongoing — not a one-time spreadsheet you produce for an auditor and ignore for the next 11 months.
- Workforce training: Anyone who can access or configure integrations touching ePHI needs specific training on handling requirements.
- Incident response: Documented procedures for what happens when an integration leaks data or credentials are compromised.
Physical Safeguards
For cloud-native SaaS, this largely translates to your infrastructure provider's compliance. Make sure your cloud provider (AWS, GCP, Azure) has a BAA in place and that you're only using HIPAA-eligible services.
One nuance matters a lot: addressable does not mean optional. HHS guidance says that when an addressable safeguard is not reasonable and appropriate, you must document why and implement an equivalent measure if one exists. For internet-facing healthcare APIs, this is not a place to improvise.
| Control | What it means in code |
|---|---|
| Risk analysis | Map every place ePHI can land — including retries, logs, dead-letter queues, and support tooling |
| Access control | Limit scopes, roles, and tenant boundaries |
| Audit controls | Log actor, action, target, time, request ID, and outcome — not payloads |
| Integrity | Detect unauthorized changes; use idempotent updates where possible |
| Transmission security | Enforce TLS 1.2+ (preferably 1.3) for all API traffic |
Handling Healthcare API Authentication Quirks
Healthcare APIs are notoriously difficult to authenticate against. Epic and Cerner rely heavily on SMART on FHIR and strict OAuth 2.0 flows with Proof Key for Code Exchange (PKCE).
Epic explicitly requires that credentials and tokens never be passed to non-Epic systems. They must remain confined to the specific application environment authorized by the healthcare provider — you cannot send an Epic access token down to a client-side frontend; it must be held securely in a backend proxy. Epic's rate limits also fluctuate based on data type and time of day, meaning your integration must handle HTTP 429 errors gracefully without dropping sensitive sync jobs.
SMART on FHIR is the right starting point when an EHR supports it well. But anyone who has shipped production healthcare integrations knows the standards story ends quickly when vendor quirks, missing fields, rate limits, and undocumented edge cases show up.
The Non-Negotiable: Business Associate Agreements (BAAs)
If your SaaS product, or any middleware it uses, creates, receives, maintains, or transmits ePHI on behalf of a covered entity, that vendor is a Business Associate under HIPAA and must sign a BAA. No exceptions.
A BAA is a HIPAA-required contract between a covered entity (like a healthcare provider or health plan) and a business associate (like a SaaS company or cloud service provider) that creates, receives, maintains, or transmits protected health information (PHI) on its behalf.
The direct implication for your integration stack: BAAs between developers and their vendors/partners must be in place before ePHI is exchanged, otherwise the exchange becomes a HIPAA violation. Every piece of middleware in your data flow needs a BAA.
The chain of custody looks like this:
%%{init: {'themeVariables': {'fontSize': '18px'}}}%%
graph LR
A[Covered Entity<br>Hospital / Health Plan] -->|BAA Required| B[Your Healthcare SaaS]
B -->|BAA Required| C[Integration Middleware<br>Unified API / iPaaS]
C -->|BAA Required| D[Cloud Infrastructure<br>AWS / GCP / Azure]
B -->|BAA Required| DA common mistake: engineering teams adopt an iPaaS or integration tool that doesn't offer a BAA, assuming the tool "just passes data through" and doesn't really count. Even if a cloud service provider stores only encrypted data, doesn't have a key, and can't view the ePHI — they are still considered a business associate and fully responsible under HIPAA Rules. The legal bar is whether the vendor could access PHI, not whether it does. The conduit exception is narrow and generally limited to transmission-only services with only transient access. Most middleware, storage, queueing, and support vendors are not conduits.
If you route hospital data through a vendor that won't sign a BAA, your company assumes the entirety of the legal liability. When evaluating integration infrastructure, the BAA is the binary filter. If the vendor can't sign one, the technical evaluation stops immediately.
A BAA is necessary, but it is not a substitute for design discipline. A signed contract does not fix broad scopes, raw payload logging, or weak token handling.
Before you add any third-party integration service to your stack, ask three questions:
- Does the vendor sign a BAA? If not, full stop. You cannot use them for any workflow touching ePHI.
- What data does the vendor store, and for how long? More storage means more liability.
- Does the vendor have SOC 2 Type II certification? Not legally required by HIPAA, but a strong signal that security controls have been independently audited. Truto has completed its SOC 2 Type II audit for two consecutive years.
Architecture Patterns for Secure PHI Data Sync
Not all integration architectures are equal when it comes to HIPAA compliance. The fundamental architectural decision is: how much PHI does your integration middleware store, and for how long? Every extra copy of ePHI becomes another thing you have to secure, map, back up, monitor, and explain during an audit.
About 40% of all breaches involved data distributed across multiple environments, and data breaches solely involving public clouds were the most expensive type, costing $5.17 million on average.
Pattern 1: Data-Hoarding Middleware (High Risk)
Many legacy iPaaS platforms operate on a "store and forward" model. They poll the third-party API, pull data into their own managed databases, run transformations, and then push the data to your system.
For healthcare SaaS, this is an architectural nightmare. You're creating a secondary, shadow database of PHI hosted by a third-party vendor. Even if that vendor signs a BAA, you've doubled your attack surface. The middleware vendor now stores ePHI at rest, requiring their own encryption, access controls, and breach notification procedures. If they suffer a breach, your patients' data is in the blast radius.
Pattern 2: Pass-Through Proxy Architecture (Minimal Risk)
The safer approach is a pass-through proxy that fetches data in real time and transmits it directly to your application without storing it at rest. The middleware handles authentication, pagination, and data normalization, but it never keeps a copy.
%%{init: {'themeVariables': {'fontSize': '18px'}}}%%
graph TD
subgraph Data-Hoarding iPaaS
A[EHR System] -->|Raw PHI| B[(Middleware Database<br>Stores PHI at rest)]
B -->|Transformed PHI| C[Healthcare SaaS]
end
C ~~~ D
subgraph Zero-Retention Proxy
D[EHR System] -->|Raw PHI| E[Proxy Layer<br>In-memory processing only]
E -->|Transformed PHI| F[Healthcare SaaS]
end
style B fill:#ffcccc,stroke:#ff0000
style E fill:#ccffcc,stroke:#00aa00In this model, when your application requests a list of patients, the request passes through the proxy. The proxy attaches the encrypted OAuth credentials, forwards the request to the EHR, receives the response, and transforms the payload entirely in memory. The data is delivered to your application, and the memory is flushed. Because PHI is never written to disk on the integration layer, the compliance risk drops dramatically.
%%{init: {'themeVariables': {'fontSize': '18px'}}}%%
sequenceDiagram
participant App as Your Healthcare SaaS
participant Proxy as Integration Layer<br>(Pass-Through)
participant EHR as Third-Party EHR / HRIS
App->>Proxy: GET /unified/hris/employees
Proxy->>EHR: GET /api/v1/employees<br>(with refreshed OAuth token)
EHR-->>Proxy: Employee records (ePHI)
Proxy-->>App: Normalized response<br>(no data stored)This pattern reduces your compliance burden because:
- The middleware never stores ePHI at rest, eliminating an entire class of encryption-at-rest requirements for that layer.
- A breach of the middleware vendor doesn't expose patient data — there's nothing to steal.
- Your data residency footprint stays small: ePHI exists in the source system and in your application. That's it.
The trade-off is latency. Real-time API calls are slower than querying a local cache. For most healthcare SaaS use cases — pulling employee rosters, syncing patient demographics, fetching billing data — this latency is perfectly acceptable.
Pattern 3: Customer-Controlled Data Store (Best of Both)
For cases where you need queryable, cached data or high-throughput analytics, the best approach to handle bulk data extraction is to sync data into your own infrastructure rather than relying on the middleware vendor's storage. Truto's sync jobs push records to your webhook endpoint as they're fetched. You control the data store, the encryption keys, the access policies, and the retention schedule.
This keeps the integration layer stateless while giving you the performance benefits of local data. It's the right separation of concerns — you already have the infrastructure and compliance controls for your own database.
The important thing across all these patterns is what you don't do. You don't spray raw bundles into traces. You don't drop payloads into a queue because they might be handy later. You don't forward them to five internal services before you know whether the caller even needed those fields. That's how a convenient integration layer turns into a second PHI warehouse.
Enforcing the "Minimum Necessary" Rule with Scoped Access
HIPAA's "minimum necessary" standard (45 CFR §164.502(b)) requires that when PHI is used or disclosed, only the minimum amount necessary to accomplish the purpose should be shared. For integrations, this means your API connections should never pull more data than the specific workflow requires.
You cannot simply request GET /patients and pull down the entire hospital directory if your SaaS only needs to track patients participating in a specific clinical trial. Over-fetching data is a compliance liability. Broad access should be the exception you justify, not the default you clean up later.
User-Level Scoping at Connection Time
When your customer connects their third-party account, give them the ability to specify exactly what data should be synced. This means presenting a post-connection form where the end user can select specific workspaces, projects, tags, departments, or patient cohorts to include in the sync.
For example, a healthcare org connecting their ticketing system might only want to sync tickets tagged "clinical-ops" — not the entire ticket backlog that could contain PHI in unrelated support threads. A billing integration should ask the user to select specific billing codes or departments.
{
"name": "ticket_tags",
"type": "multi_select",
"label": "Tags to sync",
"help_text": "Select only the tags relevant to your workflow",
"data_source": {
"type": "proxy",
"resource": "tags",
"method": "list"
},
"options": {
"value": "id",
"label": "name"
}
}These selections are stored as context variables on the connected account and used to filter every subsequent API call. This isn't just a nice UX feature — it's a direct implementation of the minimum necessary rule, and it gives you audit evidence that the customer explicitly chose what data to share.
Field-Level Filtering at the API Layer
Even when you restrict the API query, healthcare APIs often return massive, nested JSON payloads containing sensitive data you don't need — Social Security Numbers, full medical histories, salary data. The burden falls on your integration layer to strip fields before they reach your application.
Using an expression language like JSONata lets you map and filter the response in memory:
response.{
"id": $string(id),
"patient_name": name[0].text,
"condition": condition_code,
"last_visit": $fromMillis(last_updated * 1000)
}By explicitly mapping only the fields your application requires, extraneous PHI is stripped out at the proxy layer and never enters your database. Parameters like truto_exclude_fields and truto_ignore_remote_data give you additional control over exactly what comes through the wire.
Credential Security: The Attack Surface You Forget About
Your integration layer doesn't just move data — it stores the keys to your customers' systems. OAuth tokens, API keys, and service account credentials are high-value targets. If an attacker compromises your integration middleware, they don't just get the data that was synced — they get persistent access to the source systems.
A compliant integration architecture needs to treat credential storage with the same rigor as ePHI storage:
- Encrypt all credentials at rest. Every credential field — OAuth access tokens, refresh tokens, API keys, client secrets, and passwords — should be encrypted using AES-256. These fields must be masked in the UI and only decrypted at the moment they're needed for an API call.
- Proactive token refresh. Expired tokens that force re-authentication create security gaps and operational disruptions. Schedule token refresh proactively — before the token expires — and automatically mark accounts as needing re-authorization if refresh fails, firing a webhook so your application can notify the customer.
- Per-tenant credential isolation. Every connected account needs its own credential context. No shared token pool. A breach of one connected account shouldn't cascade to others.
For a deeper look at how to handle the complexity of enterprise authentication across legacy systems, see our engineering deep-dive.
The Integration Compliance Checklist
Here's the practical checklist for engineering teams shipping healthcare integrations:
| Requirement | What to verify | HIPAA reference |
|---|---|---|
| BAA signed with integration middleware | Vendor provides executed BAA before any data exchange | §164.502(e), §164.504(e) |
| TLS 1.2+ enforced for all API traffic | No plaintext API calls, certificate pinning where possible | §164.312(e)(1) |
| ePHI encrypted at rest in your data store | AES-256 encryption with proper key management | §164.312(a)(2)(iv) |
| Audit logs for all data access | Log every API call that returns ePHI, with timestamps and user identity — not payloads | §164.312(b) |
| Scoped access via user consent | End users select specific data sets at connection time | §164.502(b) — Minimum Necessary |
| Credential encryption | All OAuth tokens and API keys encrypted at rest, masked in UI | §164.312(a)(1) |
| Incident response plan for integration failures | Documented procedure for credential compromise, data exposure | §164.308(a)(6) |
| Automatic re-auth detection | System detects failed tokens and notifies your application | §164.312(d) |
Why Truto Is the Safest Way to Build Healthcare Integrations
Building a zero-retention proxy, managing encrypted OAuth token lifecycles, handling SMART on FHIR quirks, and maintaining field-level filtering engines requires immense engineering effort. For healthcare SaaS companies, spending those cycles on integration infrastructure distracts from core product development.
If you're evaluating how to build vs. buy your integration layer, the compliance dimension deserves serious weight. Just as we've seen compliance platforms abandon point-to-point connectors, building these integrations in-house means your team owns every aspect of HIPAA compliance for those connections: credential storage, encryption, audit logging, token refresh, and the long tail of niche healthcare tools your customers use.
Truto's architecture was designed to minimize compliance exposure by default:
Zero Data Retention Architecture. Truto acts as a pass-through proxy and does not store your customers' data at rest. Data is fetched from the third-party API, transformed in memory using predefined JSONata mappings, and delivered to your system in real time. Truto never caches or persists API payloads. This eliminates the most dangerous class of breach risk at the middleware layer.
Granular Access Control via RapidForm. Truto allows end-users to precisely scope which data is synced, adhering to HIPAA's "minimum necessary" rule. RapidForm injects dynamic forms directly into the connection flow — supporting single-select, multi-select, and dependency-aware fields. A user can select specific folders, tags, departments, or provider groups, and Truto stores these preferences as variables. Your background sync jobs then use these variables to automatically filter the data pulled from the EHR.
Enterprise-Grade Credential Security. Truto encrypts every credential field — OAuth access tokens, refresh tokens, API keys, client secrets, and passwords — at rest using AES-256. These fields are permanently masked in the UI and only decrypted at the moment of the API call. Truto handles complex token refresh logic proactively, refreshing tokens before they expire to prevent sync failures, and automatically marks accounts as needing re-authorization if refresh fails.
Unified API with Proxy Fallback. Truto offers both a normalized Unified API and a direct Proxy API. Use the unified path for common data models and consistent product behavior across multiple EHRs. Use the proxy path when the source system has a vendor-specific endpoint or response shape that doesn't fit the common model — like a proprietary Epic or Cerner endpoint. Both route through the same credential management and encryption layer.
SOC 2 Type II Certified. Truto has completed two consecutive years of SOC 2 Type II audits, providing independent verification of security controls.
To be transparent about the trade-offs: a pass-through architecture means you can't query cached data in the middleware layer. If you need fast, repeated access to synced records, use Truto's sync jobs to push data into your own HIPAA-compliant data store. Truto gives you the transport and normalization; you own the storage and access controls.
Need more control over your data?
Truto allows you to execute custom JSONata transformations on the fly, ensuring you can strip out sensitive remote_data fields before they ever reach your servers.
What to Do Next
HIPAA compliance for integrations isn't a checkbox exercise. It's an architectural decision that affects every layer of your stack. The regulatory environment is tightening fast — On December 27, 2024, HHS issued a Notice of Proposed Rulemaking to modify the HIPAA Security Rule to strengthen cybersecurity protections for ePHI. Encryption that was technically "addressable" is becoming mandatory. Risk assessments are getting more detailed.
Here's the shortlist to push through in the next sprint cycle:
- Audit your integration middleware for BAA coverage. If any tool in your data flow touches ePHI and hasn't signed a BAA, that's a live HIPAA violation. Fix it before your next audit.
- Draw one end-to-end ePHI flow for a single integration. Include retries, logs, dead-letter queues, support tooling, and analytics. Know where PHI can land.
- Strip raw payloads out of logs and traces. Keep audit metadata instead. This is the single most common accidental violation.
- Implement scoped access at connection time. Don't sync everything because it's easier. Let your customers choose what data to share, and log that choice for audit purposes.
- Minimize PHI at the middleware layer. Prefer pass-through architectures. If you must cache, push data into infrastructure you control.
- Tabletop three incidents: compromised credentials, third-party outage, and token reauthorization failure.
The time to get your integration architecture right is before the next round of rules takes effect — not after.
Link format: When linking to other blog posts, always use /blog/<slug>/ as the path.
FAQ
- Do I need a BAA with my integration middleware provider?
- Yes. Under HIPAA, any third-party service that creates, receives, maintains, or transmits ePHI on behalf of a covered entity is a business associate and must sign a BAA before any data is exchanged. This applies even if the middleware only passes data through without storing it, or stores only encrypted data it cannot view.
- Does a pass-through API proxy still need to be HIPAA compliant?
- Yes. Even if the proxy doesn't store ePHI at rest, it transmits ePHI and holds authentication credentials to access source systems. It must enforce encryption in transit, secure credential storage, and sign a BAA. However, the compliance burden is significantly lower than middleware that caches data.
- What encryption standards does HIPAA require for API integrations?
- HIPAA requires encryption of ePHI both at rest (AES-256 recommended) and in transit (TLS 1.2+ minimum, TLS 1.3 recommended). The proposed 2024 NPRM to the Security Rule would make encryption mandatory with limited exceptions, removing the previous 'addressable' classification.
- What is the minimum necessary rule in API integrations?
- The minimum necessary rule mandates that you only request and sync the exact subset of PHI required for your application to function. In practice, this means scoping OAuth permissions tightly, letting end users choose what data to sync at connection time, and filtering out unneeded fields before they reach your database.
- How much does a healthcare data breach cost on average?
- According to IBM's 2024 Cost of a Data Breach Report, the average healthcare data breach costs $9.77 million — the highest of any industry for the 14th consecutive year. This is roughly double the global cross-industry average of $4.88 million.