Key takeaway
A HIPAA-compliant API is one engineered so that every request carrying ePHI is authenticated, authorized at the object level, encrypted in transit, rate limited and audit logged without writing PHI into logs. The API supports an organization's HIPAA program; it does not by itself make anyone compliant.
Last reviewed November 17, 2026
HIPAA-compliant API development: service overview
This service is for teams that expose health data through APIs: digital health startups with a mobile front end, healthcare SaaS vendors opening partner APIs to hospitals, payers and providers building patient access endpoints, and MedTech companies moving device data to a cloud backend.
We cover API design (resource modeling, versioning, pagination, error contracts), authorization architecture (OAuth 2.0 and OpenID Connect, scopes, claims and policy enforcement), gateway configuration, and the security testing that proves an endpoint only returns what the caller is entitled to. We can build new APIs or harden existing ones.
We align our testing with the OWASP API Security Top 10 (2023 edition) and OWASP ASVS, because those lists describe the failures that actually show up in healthcare APIs. They are recommended practice, not HIPAA mandates, but they map cleanly onto the access control, audit and integrity standards in 45 CFR 164.312.
Healthcare business challenges APIs must solve
Broken object level authorization (BOLA)
A request such as GET /patients/1042/labs succeeds for any authenticated user unless the server checks that the caller is permitted to see patient 1042. BOLA is ranked first in the OWASP API Security Top 10 for good reason, and in healthcare it means one patient seeing another patient's results.
Third-party and partner access
Hospitals, labs, payers and app developers want programmatic access. Each partner needs its own credentials, its own scopes and its own data boundary, and you need a way to revoke one partner without breaking the rest.
Over-broad responses
Endpoints often serialize the whole database object, returning SSNs, insurance member IDs or internal notes the client never displays. The client hides them; an attacker reading raw JSON does not.
PHI leaking into logs and analytics
Default request logging captures query strings, headers and bodies. A URL like /search?name=Jane+Doe&dob=1980-04-02 written to a log aggregator without a BAA is a disclosure problem, not just a hygiene issue.
Abuse and scraping
Patient lookup, appointment and eligibility endpoints are attractive for enumeration. Without rate limits and anomaly detection, a valid token can be used to pull large volumes of records slowly enough to avoid notice.
Interoperability obligations
Certified health IT developers, providers and payers may face information blocking rules and CMS payer API requirements. APIs need to be open enough to meet those obligations while still enforcing authorization.
API development capabilities
OAuth 2.0 and OpenID Connect authorization
Authorization code with PKCE for user-facing apps, client credentials or SMART Backend Services style signed JWT assertions for system clients, short-lived access tokens and rotating refresh tokens.
Scope and claim design
Fine-grained scopes such as patient/Observation.rs or appointments:write, combined with claims for tenant, patient context and role, so tokens carry the minimum authority a client needs.
Object and property level authorization
Centralized policy checks that verify the caller's relationship to each resource (own record, proxy, assigned clinician, tenant) and response shaping that strips fields the caller is not entitled to.
API gateway configuration
TLS termination, token validation, request size limits, schema validation, per-client quotas and routing on a managed gateway or a self-hosted gateway, with configuration kept in version control.
Rate limiting and abuse controls
Per-token, per-client and per-endpoint limits, stricter limits on search and lookup endpoints, and alerts on unusual access patterns such as sequential ID enumeration.
PHI-safe logging and audit trails
Separate operational logs (no PHI, IDs tokenized) from security audit records (who accessed which resource, when, from where), with audit records written to a protected, append-only store.
FHIR and REST API implementation
FHIR R4 resources with US Core profiles where interoperability matters, or clean REST and GraphQL designs where it does not. GraphQL gets query depth and cost limits so a single query cannot pull an entire dataset.
API security testing
Automated authorization tests that try every endpoint with the wrong user, wrong tenant and wrong scope, plus DAST, fuzzing and contract tests in CI.
HIPAA-related security considerations for APIs
The Security Rule does not mention APIs, OAuth or gateways. It sets outcome standards, and an API is one of the places those outcomes have to be achieved. The split below shows what comes from HIPAA itself and what is engineering practice layered on top.
HIPAA requirement
What the rules themselves require
- Unique user identification so every API call can be tied to an individual user or system identity (164.312(a)(2)(i)).
- Audit controls that record and allow examination of activity in systems containing ePHI (164.312(b)).
- Person or entity authentication for every caller, human or machine (164.312(d)).
- Transmission security and integrity controls addressed through the risk analysis; these are addressable specifications, which means assess and implement if reasonable and appropriate, or document an equivalent alternative (164.312(e)).
- Minimum necessary limits on uses and disclosures where the Privacy Rule standard applies (164.502(b)).
Recommended practice
Widely accepted security practice
- OAuth 2.0 with PKCE for public clients and short-lived, audience-restricted access tokens.
- Object level authorization on every request, tested automatically against the OWASP API Security Top 10.
- TLS 1.2 or higher everywhere, with TLS 1.3 preferred and HSTS on public endpoints.
- Rate limiting, request size limits and schema validation at the gateway.
- Logs that exclude PHI from URLs, headers and bodies, with identifiers tokenized.
- An API inventory listing every endpoint, version and consumer so nothing undocumented is exposed.
Architecture decision
Depends on your product and risk analysis
- Mutual TLS for high-trust system-to-system partners.
- Sender-constrained tokens (DPoP or certificate-bound tokens).
- A dedicated policy engine for attribute-based access decisions.
- Field-level encryption for especially sensitive attributes such as SSNs.
- Separate public and internal gateways.
Your organization's responsibility
Policies and operations software cannot do
- BAAs with the API gateway, cloud, logging and monitoring vendors that touch ePHI.
- Partner onboarding policy: who approves new API clients and what data they may access.
- Credential issuance, rotation and revocation procedures.
- Regular review of audit logs and a security incident response procedure (164.308(a)(6)).
- The risk analysis that decides which addressable specifications apply and how.
Technical architecture for healthcare APIs
Edge: gateway and token validation
Requests terminate TLS at the gateway, which validates the access token signature, issuer, audience and expiry before anything reaches application code. The gateway enforces quotas, payload limits and JSON schema validation, and rejects unknown routes so deprecated endpoints are not quietly reachable.
Service layer: authorization close to the data
Coarse checks (does this token have the appointments:read scope) happen at the edge. Fine checks (is this appointment for a patient this caller may see) happen in the service, next to the data query, because only the service knows the relationship. We prefer authorization that filters the database query rather than fetching a record and checking afterwards.
- Tenant ID derived from the token, never from the request body.
- Opaque or random resource identifiers to reduce enumeration, without relying on them as a control.
- Response DTOs defined per role instead of serializing ORM objects.
Observability without PHI
Operational logs record request ID, route template (for example /patients/{id}/labs rather than the literal path), status, latency and a hashed client ID. Audit events go to a separate store with restricted access and longer retention. Traces are sampled and scrubbed before export to a tracing vendor.
Secrets and keys
Signing keys and client secrets live in a managed key store or secrets manager with rotation. Token signing keys are published through a JWKS endpoint so rotation does not require client redeployments.
EHR and API integration options
Many healthcare APIs sit between an app and one or more EHRs. Our API layer can expose a stable, app-friendly contract while integrating downstream through the methods each source supports.
| Integration pattern | Typical use |
|---|---|
| FHIR R4 facade with US Core profiles | Expose your data in a standard shape for partners and patient access use cases |
| SMART on FHIR client | Consume EHR data with user-level authorization in an EHR-launched or standalone app |
| SMART Backend Services | System-to-system bulk or scheduled data exchange using signed JWT client assertions |
| HL7 v2 via interface engine | Receive ADT, results and scheduling messages and expose them through a modern API |
| Webhooks and event streams | Notify partners of changes with signed payloads that carry IDs, not PHI |
| Vendor-specific APIs | Where FHIR coverage is incomplete, subject to the client's EHR contract and vendor program |
Development methodology
- 1
Data and consumer mapping
List every consumer (apps, partners, internal services), the resources each needs and the PHI elements involved. This becomes the scope catalog and feeds the risk analysis.
- 2
Contract-first design
Write OpenAPI or FHIR CapabilityStatement definitions before code, including auth requirements, error formats and which fields each role receives.
- 3
Threat modeling
Walk through each endpoint against the OWASP API Security Top 10: BOLA, broken authentication, property level exposure, resource consumption, function level authorization and the rest.
- 4
Build with authorization tests
Each endpoint ships with negative tests: another patient's ID, another tenant's token, a missing scope, an expired token. These run in CI on every change.
- 5
Gateway and observability setup
Configure quotas, logging redaction, audit event routing and alerts, then verify that a sample of logs contains no PHI.
- 6
Security testing and release
DAST and targeted manual testing before launch, published API documentation and a versioning and deprecation policy for consumers.
Cost and timeline factors
The ranges below are rough, scope-dependent planning ranges to help you budget conversations. They are not quotes and are not derived from our own project data.
| Scope | What drives it | Rough planning range |
|---|---|---|
| Hardening an existing API | Endpoint count, auth refactor needed, test coverage | 4 to 10 weeks |
| New API for a single app | Resource count, roles, one or two integrations | 8 to 16 weeks |
| Partner or public API platform | Multi-tenant scopes, developer portal, onboarding, FHIR conformance | 4 to 9 months |
| FHIR facade over existing data | Mapping complexity, US Core profiles, terminology | 3 to 6 months |
Frequently Asked Questions
Does HIPAA require OAuth 2.0 for healthcare APIs?
No. HIPAA requires person or entity authentication and access control but does not name a protocol. OAuth 2.0 with OpenID Connect is the widely accepted way to meet those requirements for APIs and is the basis of SMART on FHIR, so it is our default recommendation.
What is BOLA and why does it matter for patient data?
Broken object level authorization happens when an API checks that a caller is logged in but not that they may access the specific record requested. Changing a patient ID in a URL then returns someone else's data. We prevent it by scoping database queries to the caller's permitted records and testing every endpoint with cross-user requests.
Can we log API requests for debugging without violating HIPAA?
Yes, if logs are designed for it. Keep PHI out of URLs by using POST bodies or opaque IDs for searches, log route templates instead of literal paths, redact bodies, and keep any logging vendor that might receive ePHI under a BAA. Security audit records are a separate stream with stricter access.
How should rate limits be set for a healthcare API?
Start from expected legitimate use per client and endpoint, then set stricter limits on search, lookup and export endpoints because those enable enumeration. Pair limits with alerts on unusual patterns, since a patient-facing token pulling hundreds of distinct patient records is a signal regardless of request rate.
Do API gateways need a BAA?
If the gateway service processes or stores ePHI, for example by logging request bodies or caching responses, the vendor is a business associate and a BAA is needed. Cloud providers list which gateway services are HIPAA eligible under their BAA. Configuration still matters: an eligible service with full body logging to a non-covered tool is a problem.
Should webhooks include patient data in the payload?
We usually recommend thin webhooks that carry an event type and resource ID, with the receiver calling back through the authenticated API to fetch details. That keeps PHI out of retry queues and partner logs and means revoked partners stop receiving data immediately.