# HIPAA mode and PHI projects
Source: https://sovaria.in/docs/hipaa

Store protected health information (PHI) on Sovaria: HIPAA-ready with a signed BAA on the Enterprise plan. MFA for every member, shorter sessions, six-year audit logs, per-project PHI protections, a PHI access log and a safeguards report.

**HIPAA mode** is for organizations whose apps store protected health information. It is an Enterprise add-on that Sovaria switches on for your organization once you have signed a **Business Associate Agreement (BAA)** with us. You then mark each project that holds PHI; those projects get stricter rules at every layer. Sovaria is not "HIPAA certified" — there is no such certification — HIPAA compliance is shared: we provide these controls, you configure your app and your own policies.

> **Where Sovaria stands (7 November 2026):** **HIPAA-ready with a BAA on Enterprise.** The technical safeguards below are built and enforced on the server. Sovaria has not yet had an independent HIPAA risk assessment, and accepts the AWS BAA (which covers our own processing on AWS) before the first HIPAA customer goes live. Ask us for the current state before you sign.

## How it works

(Diagram: Where the HIPAA rules apply — Rules are enforced on the server: the gateway, Auth, Storage, backups and the audit log.)

### For the whole organization (HIPAA mode on)

- Every console member needs two-factor authentication (authenticator app or passkey). Members without it lose access to the organization until they set it up.
- Sessions end after 15 minutes without activity and after 12 hours in total.
- Audit logs are kept at least 6 years (2,190 days).
- Features outside the AWS BAA are turned off: the Sovariq AI assistant and project agents, AI assistants connected over MCP (Claude, ChatGPT…), push notifications and messaging campaigns, log drains to third-party services, third-party integrations (Slack, Discord, Vercel…), and SMS one-time passwords. Calls return `403 HIPAA_FEATURE_UNAVAILABLE`.

### For projects marked as holding PHI

| Rule | What you see |
|---|---|
| No public buckets or public file links | Creating or switching a bucket to public returns `403 PHI_PUBLIC_BUCKET_DISABLED`; existing public links stop working. Use signed URLs. |
| The anon key can sign users in but not read or write data | Data calls with the anon key return `403 PHI_ANON_KEY_DISABLED`. Call with the signed-in user's token (row policies still apply) or from your server with a service key. |
| Every data request is logged, reads included | Each request is written to your organization's hash-chained audit log with who, what and when (no row contents). |
| Backups are encrypted | Backups are only taken encrypted; Sovaria never writes a plaintext dump of a PHI project. |
| App user sessions | Your project's session settings can only be stricter than 15 minutes idle / 12 hours total. |

These project rules stay on even if HIPAA mode is later turned off for the organization: only unmarking the project removes them.

## Which plans include it

HIPAA comes with the **Enterprise** plan. On Free, Pro, Ultra and Team the console shows HIPAA as an Enterprise feature with a **Contact sales** link, and nothing more: there is no switch to flip and no HIPAA download. The server enforces the same rule, not just the console:

- Marking a project as holding PHI returns `403 PLAN_FEATURE_REQUIRED` until HIPAA mode is on for the organization.
- The organization's HIPAA routes (status and safeguards report) return `403 PLAN_FEATURE_REQUIRED` with `"required_plan": "Enterprise"` on other plans.
- Sovaria turns HIPAA mode on only where the plan includes HIPAA. For a contract on another plan (for example an Enterprise addendum to Team) staff can make HIPAA available for that one organization; every such change is audited with its reason.
- If an organization leaves Enterprise, HIPAA mode stops applying, but projects marked as holding PHI keep their PHI protections until you unmark them.

## Turn it on

1. **Sign the BAA** — On the Enterprise plan, contact support or your account manager. Sovaria turns HIPAA mode on for the organization (recorded with the BAA reference).
2. **Set up MFA for everyone** — Each member enables two-factor authentication under **Account → Security**.
3. **Prepare the project** — Make public buckets private and move anything your app reads with the anon key behind signed-in users and [policies](https://sovaria.in/docs/security-and-policies).
4. **Mark the project** — In **Project settings → Security → HIPAA**, turn on **This project stores PHI**.
5. **Check the safeguards** — In **Organization → Compliance → HIPAA**, download the **HIPAA report**: each Security Rule technical safeguard, judged from your live configuration. Fix anything marked **Action needed**.

HTTP:
```http
GET /api/v1/project-settings/compliance
X-Sovaria-Project-ID: <project-id>

PUT /api/v1/project-settings
{ "settings": { "containsPHI": true } }
```

App (JS):
```ts
// On a PHI project the browser signs users in with the anon key,
// then reads data with the user's own session.
const sovaria = createClient('https://<project-ref>.sovarias.in', '<anon-key>');
await sovaria.auth.signInWithPassword({ email, password });
const { data } = await sovaria.from('appointments').select('*'); // user token + row policies
```

## The HIPAA safeguards report

Owners and admins download it from **Organization → Compliance** or with `sov compliance hipaa --report`. It is a ZIP with `hipaa_safeguards.md`, `hipaa.json` and a `MANIFEST.json` of SHA-256 sums. Each row is judged from data when you download it, never from a fixed statement:

| Safeguard (45 CFR) | What the report checks |
|---|---|
| 164.312(a)(2)(i) Unique user identification | Members and API keys: every person has their own account; keys are named and revocable. |
| 164.312(a)(2)(iii) Automatic logoff | HIPAA mode's session limits, or your organization's own session timeouts ([Organizations, members and roles](https://sovaria.in/docs/organizations#session-timeouts)). |
| 164.312(a)(2)(iv) Encryption at rest | Your projects' backup records: how many completed backups are encrypted, and with which algorithm. |
| 164.312(b) Audit controls | The hash-chained audit log verifies end to end now, and retention is at least 2,190 days. |
| 164.312(c)(1) Integrity | The audit chain, and point-in-time recovery on every PHI project. |
| 164.312(d) Person or entity authentication | Members without two-factor authentication. |
| 164.312(e)(1) Transmission security | Checked on api.sovaria.in when the report is made (cached for an hour): the TLS version it negotiates, its HSTS header, and that TLS 1.1 is refused when the server can test it (otherwise that part reads unknown). |
| 164.308(a)(1)(ii)(D) Activity review | PHI projects exist and every request to them is logged. |
| 164.308(b)(1) Business associate contract | HIPAA mode is on, which Sovaria does only after the BAA is signed. |

Each download counts toward your plan's evidence packs per day and is written to your audit log. The report is evidence for your own risk analysis, not a certification.

## The PHI access log

Every request to a PHI project is in your audit log with `metadata.phi = true`: who, which route, which tables or collection, the status and a hash of the request body (no row contents). Export only those entries with **PHI access log (CSV)** on Organization → Compliance, `sov compliance audit-log --phi-only`, or the API. Each export is itself recorded as `audit.exported`.

CLI:
```bash
sov compliance hipaa                 # status: BAA, sessions, retention, PHI projects
sov compliance hipaa --report -o hipaa.zip
sov compliance audit-log --phi-only --since 2026-11-01T00:00:00Z -o phi-access.csv
```

HTTP:
```http
GET /api/v1/org/<org-id>/compliance/hipaa
GET /api/v1/org/<org-id>/compliance/hipaa/report
GET /api/v1/audit/export?format=csv&phi_only=true
X-Sovaria-Org-ID: <org-id>
```

## Sovaria staff access

Sovaria staff can read your data only for a support, security or legal case, with a time-boxed access grant that carries a reason. With it they can look at your organization as one of your users (a read-only session; every request made in it is written to your audit log) or run read-only queries on a project database. The grant, each session, each query and the other staff actions Sovaria's admin audit records against your organization appear in **Organization → Access transparency**, with a reason written for you when there is one.

## Plans

|  | Free | Pro | Ultra | Team | Enterprise |
|---|---|---|---|---|---|
| HIPAA mode (with a signed BAA) | — | — | — | — | ✓ |
| HIPAA safeguards report and status | — | — | — | — | ✓ |
| PHI access log export | — | — | — | — | ✓ (PHI projects) |
| Organization session timeouts | — | ✓ | ✓ | ✓ | ✓ |
| Audit log export | ✓ | ✓ | ✓ | ✓ | ✓ |
| Compliance evidence pack | ✓ | ✓ | ✓ | ✓ | ✓ |

Audit log export covers each plan's audit retention ([Plan limits](https://sovaria.in/docs/plan-limits)); with HIPAA mode on, retention is at least six years.

## Common mistakes

- Marking a project as PHI while the app still reads data with the anon key — those calls start failing. Sign users in first.
- Storing PHI in a project that isn't marked. The PHI protections only apply to marked projects.
- Putting PHI in function logs or error messages. Logs are kept per plan and are not a place for patient data.
