Skip to content
HIPAA Compliant AppSecure healthcare engineering

Security & Compliance Resource

HIPAA API Security for APIs That Carry PHI

HIPAA API security matters because APIs are now the main path ePHI takes between apps, EHRs, payers and partners. A single missing authorization check on an API can expose every patient record behind it.

This page maps HIPAA technical safeguards to API controls, walks through the OWASP API Security Top 10 (2023) with healthcare examples, and covers SMART on FHIR scopes, mutual TLS, token lifetimes, rate limiting and logging.

Key takeaway

HIPAA does not have API-specific rules, but APIs that carry ePHI must meet the Security Rule's technical safeguards: access control, audit controls, integrity, person or entity authentication and transmission security (45 CFR 164.312). In practice that means strong client and user authentication, object-level authorization on every request, scoped and short-lived tokens, TLS or mutual TLS, PHI-safe logging and defenses against the OWASP API Security Top 10.

Last reviewed November 17, 2026

Mapping technical safeguards to API controls

SafeguardStatusAPI control
Access control, 164.312(a)(1)StandardOAuth 2.0 scopes, object-level and function-level authorization, tenant isolation.
Unique user identification, 164.312(a)(2)(i)RequiredUnique client IDs per integration; user identity carried in tokens, not shared API keys.
Automatic logoff, 164.312(a)(2)(iii)AddressableShort access token lifetimes, refresh token rotation and revocation.
Audit controls, 164.312(b)RequiredPer-request audit events with client, user, resource and outcome.
Integrity, 164.312(c)Addressable specInput validation, optimistic concurrency, signed payloads where needed.
Authentication, 164.312(d)RequiredOAuth 2.0 and OpenID Connect, private_key_jwt or mTLS client authentication.
Transmission security, 164.312(e)Addressable specsTLS 1.2 or higher, TLS 1.3 preferred; mTLS for system-to-system traffic.

OWASP API Security Top 10 (2023) in healthcare

The OWASP API Security Top 10 is a widely used list of the most critical API risks. It is not a HIPAA requirement, but it is a practical checklist for the vulnerabilities most likely to expose ePHI.

API1 Broken Object Level Authorization

Changing a patient ID in a URL returns another patient's record. Check ownership or care relationship on every object access.

API2 Broken Authentication

Weak token validation, missing expiry checks or credential stuffing on login endpoints.

API3 Broken Object Property Level Authorization

Responses include fields the caller should not see, such as SSN or notes, or accept writes to protected fields.

API4 Unrestricted Resource Consumption

Unbounded searches or exports allow scraping or denial of service. Apply pagination, quotas and rate limits.

API5 Broken Function Level Authorization

A patient token can call clinician or admin endpoints. Enforce role checks per function.

API6 Unrestricted Access to Sensitive Business Flows

Automated abuse of flows such as appointment booking or prescription refill requests.

API7 Server Side Request Forgery

Webhook or document-fetch features that let callers reach internal services or cloud metadata endpoints.

API8 Security Misconfiguration

Verbose errors, permissive CORS, missing TLS hardening or default credentials.

API9 Improper Inventory Management

Old API versions or forgotten test endpoints still serving real ePHI.

API10 Unsafe Consumption of APIs

Trusting data from partner or EHR APIs without validation, or following redirects blindly.

SMART on FHIR scopes and OAuth 2.0

SMART App Launch builds on OAuth 2.0 and OpenID Connect to authorize apps against FHIR APIs. Scopes describe the context and resources an app may access, such as patient-level scopes for a single patient's data and user-level scopes for data the signed-in user can access. SMART App Launch 2.0 introduced finer-grained permissions such as patient/Observation.rs for read and search, and requires PKCE for authorization code flows.

Request the narrowest scopes your use case needs, which supports the minimum necessary standard. For backend integrations, SMART Backend Services uses client credentials with a signed JWT assertion rather than a shared secret. The scopes an EHR grants depend on the client's EHR contract and the vendor's developer program.

Tokens, mTLS and session lifetimes

HIPAA does not set token lifetimes; values should come from the risk analysis and align with automatic logoff decisions. Short-lived access tokens limit the damage of a leaked token, while refresh tokens with rotation and revocation preserve usability. The OAuth 2.0 Security Best Current Practice (RFC 9700) is a useful reference.

Mutual TLS (RFC 8705) authenticates both client and server at the transport layer and can bind tokens to a client certificate, so a stolen token cannot be replayed from another machine. DPoP (RFC 9449) offers application-layer sender-constrained tokens where mTLS is impractical, such as in mobile or browser clients.

  • Access tokens: short-lived, commonly minutes to an hour, validated for signature, issuer, audience, expiry and scope on every call.
  • Refresh tokens: rotated on use, revocable, bound to client, and stored in platform secure storage on mobile.
  • Client authentication: private_key_jwt or mTLS rather than shared secrets for confidential clients.
  • Revocation: revoke tokens on logout, password change, role change and account deactivation.
  • Never place tokens or PHI in URLs or query strings, where they end up in logs and browser history.

Testing and monitoring APIs

  1. 1

    Inventory endpoints

    Generate an inventory from the OpenAPI specification and gateway configuration.

  2. 2

    Automate authorization tests

    Test that each endpoint rejects other users' objects, other tenants and lower-privilege roles.

  3. 3

    Scan and fuzz

    Run API-aware scanners and fuzzers against non-production environments with synthetic data.

  4. 4

    Pen test

    Commission periodic third-party testing that includes business-logic abuse.

  5. 5

    Monitor in production

    Alert on unusual volumes, enumeration patterns and authorization failures.

Rate limiting, validation and safe error handling

Healthcare APIs often expose search endpoints that can be abused to enumerate patients. Rate limits, page-size caps and required search parameters reduce scraping risk, while monitoring for unusual query patterns detects attempts that stay under limits.

Error responses should be generic to callers and detailed only in protected logs. An error such as 'patient 12345 not found in tenant X' leaks information that helps attackers enumerate records. Input validation against the FHIR or OpenAPI schema stops malformed or oversized payloads before they reach business logic.

  • Per-client and per-user rate limits, with stricter limits on search and export endpoints.
  • Maximum page sizes and asynchronous jobs for bulk exports, with separate authorization.
  • Schema validation on every request and response.
  • Consistent error formats that do not reveal whether a record exists for another user.
  • CORS restricted to known origins for browser clients.

How we help

We design and build healthcare APIs with OAuth 2.0 and SMART authorization, object-level access checks, PHI-safe logging and automated security tests, and we can review existing APIs against the OWASP API Security Top 10. Compliance determinations remain with your organization.

This page is general information about software engineering for healthcare, not legal advice. HIPAA compliance depends on your organization's risk analysis, policies, workforce practices, vendor agreements and how PHI is actually handled. No software, hosting provider or development partner can make an organization compliant on its own, and there is no official HIPAA certification for applications.

Frequently Asked Questions

Does HIPAA have specific API security requirements?

No API-specific rules exist, but APIs carrying ePHI must meet the Security Rule's technical safeguards, including access control, audit controls, authentication and transmission security.

What is the most common API vulnerability in healthcare apps?

Broken object level authorization, where changing an identifier returns another patient's data, is the top OWASP API risk and a frequent finding in healthcare APIs.

How long should API access tokens last?

HIPAA sets no number. Short-lived tokens, commonly minutes to an hour, with rotated refresh tokens are typical, and the value should be justified in the risk analysis.

What are SMART on FHIR scopes?

They are OAuth 2.0 scopes defined by SMART App Launch that describe which FHIR resources and patient context an app may access. Requesting narrow scopes supports the minimum necessary principle.

Is mutual TLS required for HIPAA?

No. It is an optional control that strengthens system-to-system authentication and can bind tokens to clients. Many B2B healthcare integrations use it.

Can API keys be used for healthcare APIs?

Static API keys are weak for ePHI access because they are long-lived and often shared. OAuth 2.0 client credentials with signed assertions or mTLS are stronger options.

Should API request bodies be logged?

Generally no, because they often contain PHI. Log identifiers, actions and outcomes, and protect any store that must hold payloads as ePHI.

Plan your HIPAA-compliant app with engineers who start from the data flow.

Tell us what you are building. We will respond with questions about scope, integrations and PHI handling, then a structured estimate. Please do not include patient information.