Consent and access model
Who sees what: project isolation, pairwise ids, grants, write ownership, provenance and what the patient sees about every application with access.
Rule: with the patient's consent an organisation sees the whole record — including what other clinics wrote — but can change or delete only what it wrote itself. Every version of every resource records the project that wrote it and the organisation on whose behalf it was written.
Who sees what
- A project (API key) sees the patients it created. Under a grant (OAuth token) an application sees exactly one patient, across all writers, limited to the granted scopes and category filters. Everything else returns 404, never 403, so ids cannot be probed.
- Pairwise ids: each project receives its own id for the same person; internal ids never leave the platform. References to patients outside your scope are masked with an opaque, per-project token.
- Directory (Organization, Practitioner, PractitionerRole): readable by id across the plane so references resolve; searchable only within your project; usable as
X-Anpheros-Acting-As/X-Anpheros-On-Behalf-Ofonly when yours. - Sandbox and production are different databases. A sandbox key physically cannot reach real patients.
Writes and ownership
project_idon every resource version = the writer. Update/delete by another project → 403 with an explanation; write your own resource instead.Provenance.agent.onBehalfOf= the clinic/organisation at the time of writing:X-Anpheros-On-Behalf-Of, else the acting PractitionerRole's organisation, else the project's organisation.- Every write produces a Provenance resource and an audit row (who, what, when, under which grant, which application, from which source fingerprint).
What the patient sees
/me/patients/{id}/grants lists every application with access, its scopes and expiry; …/access-log lists what each read or wrote — under the consent and with the project's own key. Revocation takes effect on the next request; the application cannot refresh back in.
With format=fhir the access log comes back as a Bundle of FHIR R4 AuditEvent resources, shaped after IHE Basic Audit Log Patterns (type rest, the interaction as subtype, the application and the person acting through it as agents, the patient and the resource as entities, no clinical data), so another system can merge it into the person's view of who accessed their record.
Feature consents
Some features need their own consent on top of data access, given by the person (or a guardian for a dependent without an account) to a trusted first-party application through PUT /me/patients/{id}/features/{feature} and withdrawn with DELETE …/features/{feature}. Each one is separate: withdrawing one never touches another.
- anpheros/patterns: background pattern analysis; withdrawing it deletes that project's stored findings, events and feedback.
- anpheros/context-location: a coarse area (about 0.1 degree, never exact coordinates) so local weather, air quality and pollen can be added by day; withdrawing it deletes the area and the cached context of that area. See Context providers.
What each Provenance resource records and how to set it: Medical data provenance explained.
SMART Health Links (sharing by QR or link)
A person can share their record without an application in between: POST /me/patients/{id}/shl creates a
SMART Health Link for the emergency subset (allergies,
medications, problems, immunizations — no results or history) or the full International Patient Summary, with an
optional passcode and expiry. The response carries the shlink:/… URI (for a QR code) and a viewer address on
/shl/view, which opens it in any browser. Whoever scans it posts to the manifest URL and receives the summary as a
JWE (dir + A256GCM) encrypted with the key inside the link; any SMART Health Link reader works.
- The content is generated at each opening (flag
L, statuscan-change), so a card kept in the phone stays current. - A passcode (flag
P) is checked on the server; after 10 wrong attempts the link stops working. GET /me/patients/{id}/shllists the links with how often and when each was opened;…/shl/{link}/revokeswitches one off at once. Every opening is in the access log.- The person's internal id never leaves the platform: the document names them by a pseudonym of the link.
AI agents propose, the person decides
Under a person's consent, a write by an AI agent (an application registered as an agent, for example an assistant
connected through MCP) or any write with author_type ai is not applied at once. The platform validates it and
answers 202 Accepted with the proposal id (header Anpheros-Proposal); nothing changes in the record. The person
sees it in GET /me/patients/{id}/proposals — what it is, which application sent it — and accepts or rejects it
(…/proposals/{proposal}/accept or …/reject). An accepted proposal is written exactly as sent, marked as
AI-written (HL7 AI Transparency). Projects that can see the record get a thin proposal.created webhook. Writes made
with a project's own key, on records the project created, are not held.
Ask your AI
Paste this into Claude, ChatGPT, Cursor or Claude Code. Your assistant reads this guide and adapts it to your code.
Read https://developers.anpheros.com/guides/consent.md and help me apply this guide to my own project. Use the Anpheros sandbox (base URL https://platform.anpheros.com) with my API key from the ANPHEROS_KEY environment variable, never written in the code. Give me complete, runnable code, the response I should expect, and how to fix the errors in https://developers.anpheros.com/guides/troubleshooting.md if a call fails.Open in ClaudeOpen in ChatGPTThis guide as MarkdownBuild the whole integration with an AI coding tool
Try it free in the sandbox · first FHIR call in 5 minutesFree · 30 synthetic patients · no cardYour first API call in 2 minutes →
