OHN-32 patient-approved access
- Version
- 1.1.0
- OpenAPI
- 3.1.0
- Source in the repository
modules/OHN-32/api/patient-access.openapi.json- Servers
https://opeshealthnetwork.com/api/ohn/v1- Authentication
bearer: http bearer
Contracts are written in English.
Scan a patient QR or type a health ID; the patient accepts or refuses; a time-limited grant (an OHN-32 care relationship) follows. ADR: docs/adr/ohn-32-patient-approved-access.md. Paths are under /api/ohn/v1. Every POST needs Idempotency-Key. When the jurisdiction has not switched the capability on, every route except GET options answers 409 patient_access_disabled. Reconciled with the observed TypeScript behaviour (docs/program/java/ohn-32-contract-changes.md): operationIds and a tag added, request bodies named components, query keys closed (422 on unknown). 1.1.0 (owner decisions 2026-11-29): a required note; the requester proposes sections; the patient may narrow sections and duration before accepting; an optional refusal reason kept only in the patient's own log; purpose review; request_ttl_minutes default 15; the request is also announced by SMS (OHN-53 category access_request, generic text, no clinical content). Additive: every new request field is optional in the schema so 1.0.0 clients still parse; the server enforces the note from 1.1.0 (422 note_required).
Operations
OHN-32-patient-access
GET/clinician/patient-access/optionsWhat this person may ask for (purposes, sections, durations) and whether the capability is on.
Operation ID: paOptions
Authentication: bearer
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
POST/clinician/patient-access/identifyIdentify a patient from scanned QR text, a card code or a health ID. Returns masked identity and an opaque lookup id (5 minutes) only.
Operation ID: paIdentify
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:IdentifyCommand
Responses
| Code | Description | Media type |
|---|---|---|
201 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
GET/clinician/patient-access/requestsMy recent requests, newest first (50).
Operation ID: paListRequests
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
state | query | "pending" | "approved" | "refused" | "expired" | "cancelled" | no |
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
POST/clinician/patient-access/requestsAsk the patient for access.
1.1.0: note is required (422 note_required); sections proposes a subset of the purpose's sections. On creation OHN-53 gets event clinician.access-request.created (category access_request: a security notice the patient cannot mute). The in-app notice and the app's modal say who (name, title, facility), the purpose, the sections, the duration and the note; the SMS (only to a verified phone among the patient's OHN-53 contacts, when SMS is on in their preferences) is OHN-53's generic text with no clinical content: a health worker asks to see the record, sign in to answer (opescare.com/m). The patient answers only in the app. Push is not offered until OHN-53 has a push channel.
Operation ID: paCreateRequest
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:CreateRequestCommand
Responses
| Code | Description | Media type |
|---|---|---|
201 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
GET/clinician/patient-access/requests/{id}One of my requests (poll while pending). Carries grant id and expiry once accepted.
1.1.0: shows proposed and granted sections and duration, and the note; never the refusal reason.
Operation ID: paGetRequest
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | yes |
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
POST/clinician/patient-access/requests/{id}/cancelWithdraw a pending request.
Operation ID: paCancelRequest
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes |
Request body
application/json:EmptyCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
POST/clinician/patient-access/requests/{id}/useUse the active grant (audited each time). The only answer that carries the patient reference.
Operation ID: paUseGrant
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes |
Request body
application/json:EmptyCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
GET/clinician/patient-access/incomingPatient: requests waiting for my answer (poll every few seconds while signed in).
Operation ID: paIncoming
Authentication: bearer
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
POST/clinician/patient-access/incoming/{id}/decisionPatient (or verified representative): accept or refuse.
1.1.0: accept may narrow sections (subset of the proposed ones) and duration_minutes (5 up to the proposed duration); the grant and its OHN-16 care_team assertion (registered lazily at the requester's first opening, as in 1.0.0) cover exactly the granted sections and duration. refuse may carry an optional reason (patient's log only). 1.1.0: the chart of a patient-approved grant is limited to its granted sections: the clinician context's allowed_categories are the OHN-16 decision's categories intersected with the granted sections (empty: 403 denied_by_policy); the summary names the rest as not_permitted_sections.
Operation ID: paDecide
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes |
Request body (required)
application/json:DecisionCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
GET/clinician/patient-access/grantsPatient: who can see my record (active and past grants).
Operation ID: paGrants
Authentication: bearer
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
POST/clinician/patient-access/grants/{id}/revokePatient: end an active grant now (id = grant_id).
Operation ID: paRevoke
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes |
Request body
application/json:EmptyCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
GET/clinician/patient-access/logPatient: access history (requests, answers, uses, revocations).
1.1.0: requested entries carry the note; refused entries carry the patient's own reason.
Operation ID: paLog
Authentication: bearer
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
POST/clinician/patient-access/cardPatient: a fresh QR card (short-lived random reference, no clinical data).
Operation ID: paNewCard
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body
application/json:EmptyCommand
Responses
| Code | Description | Media type |
|---|---|---|
201 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
GET/clinician/patient-access/settingsJurisdiction switch and options.
Operation ID: paReadSettings
Authentication: bearer
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
POST/clinician/patient-access/settingsChange the switch and options (audited).
Operation ID: paWriteSettings
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:SettingsCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: object |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
GET/clinician/patient-access/auditStaff audit report: every request, decision, use and revocation (JSON, or CSV with format=csv).
1.1.0: rows record the note, the proposed and granted sections and duration, and whether a refusal reason was given (never its text).
Operation ID: paAudit
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
from | query | string | no | |
to | query | string | no | |
format | query | "json" | "csv" | no |
Responses
| Code | Description | Media type |
|---|---|---|
200 | OK | application/json: objecttext/csv: string |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
Schemas
Error
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes | |
message | string | no | |
details | any | no |
Purpose
care_visit (consult), prescribing (prescribe), dispensing, diagnostics (lab order and imaging). 1.1.0: review (roles licensed_clinician and clinical_supervisor; owner decision: default sections the same as care_visit, which the patient can untick). A jurisdiction settings row stored before 1.1.0 has no review entry: a request for review there answers 422 purpose_not_configured (fail closed) until settings add it.
"care_visit" | "prescribing" | "dispensing" | "diagnostics" | "review"
RequestState
"pending" | "approved" | "refused" | "expired" | "cancelled"
Kind
"clinician" | "pharmacist" | "diagnostics"
Masked
| Name | Type | Required | Description |
|---|---|---|---|
initials | string | yes | |
birth_year | integer | null | yes |
Options
| Name | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes | |
kind | string | null | yes | |
request_ttl_minutes | integer | null | yes | |
durations_minutes | array of integer | yes | |
purposes | array of Options.purposes.item | yes |
Lookup
| Name | Type | Required | Description |
|---|---|---|---|
lookup_id | string (uuid) | yes | |
identified_by | "qr" | "card_code" | "health_id" | yes | |
patient | Masked | yes | |
expires_at | string (date-time) | yes |
Grant
The grant is an OHN-32 care relationship; grant_id is its id. A /p phone-to-PC hand-off must end at expires_at or as soon as status is not active.
| Name | Type | Required | Description |
|---|---|---|---|
grant_id | string (uuid) | yes | |
status | "active" | "ended" | "expired" | yes | |
expires_at | string (date-time) | yes |
RequestView
1.1.0: sections and duration_minutes keep their 1.0.0 meaning (the proposed values); granted_* carry what the patient granted. The refusal reason never appears here.
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | |
state | RequestState | yes | |
purpose | Purpose | yes | care_visit (consult), prescribing (prescribe), dispensing, diagnostics (lab order and imaging). 1.1.0: review (roles licensed_clinician and clinical_supervisor; owner decision: default sections the same as care_visit, which the patient can untick). A jurisdiction settings row stored before 1.1.0 has no review entry: a request for review there answers 422 purpose_not_configured (fail closed) until settings add it. |
sections | array of string | yes | |
duration_minutes | integer | yes | |
answer_by | string (date-time) | yes | |
created_at | string (date-time) | yes | |
decided_at | string | null (date-time) | yes | |
patient | Masked | yes | |
identified_by | string | yes | |
facility_id | string (uuid) | yes | |
grant | Grant | null | yes | |
version | integer | yes | |
note | string | null | no | the requester's note (null for requests made before 1.1.0) |
proposed_sections | array of string | no | what the requester asked for (equal to sections, which keeps its 1.0.0 meaning) |
proposed_duration_minutes | integer | no | what the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning) |
granted_sections | array of string | no | what the patient granted (a subset of proposed_sections); null until accepted |
granted_duration_minutes | integer | null | no | what the patient granted (at most proposed_duration_minutes); null until accepted |
Requester
| Name | Type | Required | Description |
|---|---|---|---|
name | string | null | yes | |
name_attested | boolean | yes | |
title | string | null | yes | |
kind | Kind | yes | |
facility_id | string (uuid) | yes |
IncomingView
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | |
state | RequestState | yes | |
requester | Requester | yes | |
purpose | Purpose | yes | care_visit (consult), prescribing (prescribe), dispensing, diagnostics (lab order and imaging). 1.1.0: review (roles licensed_clinician and clinical_supervisor; owner decision: default sections the same as care_visit, which the patient can untick). A jurisdiction settings row stored before 1.1.0 has no review entry: a request for review there answers 422 purpose_not_configured (fail closed) until settings add it. |
sections | array of string | yes | |
duration_minutes | integer | yes | |
answer_by | string (date-time) | yes | |
created_at | string (date-time) | yes | |
on_behalf_of | Masked | null | yes | |
grant | Grant | null | yes | |
version | integer | yes | |
note | string | null | no | the requester's note (null for requests made before 1.1.0) |
proposed_sections | array of string | no | what the requester asked for (equal to sections, which keeps its 1.0.0 meaning) |
proposed_duration_minutes | integer | no | what the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning) |
granted_sections | array of string | no | what the patient granted (a subset of proposed_sections); null until accepted |
granted_duration_minutes | integer | null | no | what the patient granted (at most proposed_duration_minutes); null until accepted |
PatientGrant
1.1.0: sections is what the grant covers (the granted sections).
| Name | Type | Required | Description |
|---|---|---|---|
grant_id | string (uuid) | yes | |
request_id | string (uuid) | yes | |
requester | Requester | yes | |
purpose | Purpose | yes | care_visit (consult), prescribing (prescribe), dispensing, diagnostics (lab order and imaging). 1.1.0: review (roles licensed_clinician and clinical_supervisor; owner decision: default sections the same as care_visit, which the patient can untick). A jurisdiction settings row stored before 1.1.0 has no review entry: a request for review there answers 422 purpose_not_configured (fail closed) until settings add it. |
sections | array of string | yes | |
granted_at | string (date-time) | yes | |
expires_at | string (date-time) | yes | |
status | "active" | "ended" | "expired" | "revoked" | yes | |
uses | integer | yes | |
last_used_at | string | null (date-time) | yes | |
proposed_sections | array of string | no | what the requester asked for (equal to sections, which keeps its 1.0.0 meaning) |
proposed_duration_minutes | integer | no | what the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning) |
granted_sections | array of string | no | what the patient granted (a subset of proposed_sections); null until accepted |
granted_duration_minutes | integer | null | no | what the patient granted (at most proposed_duration_minutes); null until accepted |
LogEntry
| Name | Type | Required | Description |
|---|---|---|---|
at | string (date-time) | yes | |
event | "identified" | "requested" | "accepted" | "refused" | "expired" | "cancelled" | "used" | "revoked" | yes | |
request_id | string (uuid) | yes | |
actor | LogEntry.actor | yes | |
purpose | Purpose | yes | care_visit (consult), prescribing (prescribe), dispensing, diagnostics (lab order and imaging). 1.1.0: review (roles licensed_clinician and clinical_supervisor; owner decision: default sections the same as care_visit, which the patient can untick). A jurisdiction settings row stored before 1.1.0 has no review entry: a request for review there answers 422 purpose_not_configured (fail closed) until settings add it. |
reason | string | null | no | refused entries in the patient's own log only: the patient's refusal reason |
note | string | null | no | requested entries: the requester's note |
Card
| Name | Type | Required | Description |
|---|---|---|---|
code | string | yes | |
display | string | yes | |
qr_payload | string | yes | |
expires_at | string (date-time) | yes |
Settings
| Name | Type | Required | Description |
|---|---|---|---|
configured | boolean | yes | |
enabled | boolean | yes | |
request_ttl_minutes | integer | yes | unanswered requests expire after this many minutes; 1.1.0: default 15 for a new jurisdiction row (rows already stored keep their value) |
card_ttl_minutes | integer | yes | |
durations_minutes | array of integer | yes | |
purpose_sections | object | yes | sections per purpose (vocabulary: allergies, medications, conditions, results, encounters, orders); 1.1.0: review defaults to the care_visit sections (allergies, medications, conditions, results, encounters) in a new row; a stored row without review refuses it (422 purpose_not_configured) |
approval_reference | string | null | yes | |
version | integer | yes |
IdentifyCommand
| Name | Type | Required | Description |
|---|---|---|---|
code | string | yes | The scanned QR payload (OHN:PA:1:...), the printed card code, or an OHN-02 health ID |
CreateRequestCommand
| Name | Type | Required | Description |
|---|---|---|---|
lookup_id | string (uuid) | yes | |
purpose | Purpose | yes | care_visit (consult), prescribing (prescribe), dispensing, diagnostics (lab order and imaging). 1.1.0: review (roles licensed_clinician and clinical_supervisor; owner decision: default sections the same as care_visit, which the patient can untick). A jurisdiction settings row stored before 1.1.0 has no review entry: a request for review there answers 422 purpose_not_configured (fail closed) until settings add it. |
duration_minutes | integer | yes | |
requester_name | string | no | |
requester_title | string | no | |
note | string | no | Why the requester asks; shown to the patient and audited. Required from 1.1.0 (missing or shorter than 10 characters after trimming: 422 note_required); optional in the schema only so 1.0.0 clients still parse. |
sections | array of "allergies" | "medications" | "conditions" | "results" | "encounters" | "orders" | no | Sections the requester proposes, a subset of the purpose's configured sections (another section: 422 section_not_permitted). Absent: all of the purpose's sections, as in 1.0.0. An empty list or duplicates answer 422 domain_validation_failed (checked by the server: no minItems/uniqueItems, because the generated model defaults an absent list to empty and would refuse every request without sections). |
DecisionCommand
1.1.0: sections and duration_minutes are allowed only with accept, reason only with refuse (otherwise 422 domain_validation_failed, the module's generic validation code; so are a duration under 5 or not whole, a note over 1000 and duplicate sections).
| Name | Type | Required | Description |
|---|---|---|---|
decision | "accept" | "refuse" | yes | |
expected_version | integer | yes | |
sections | array of "allergies" | "medications" | "conditions" | "results" | "encounters" | "orders" | no | accept only: the sections the patient grants, a subset of the proposed sections (narrowing only; another section: 422 section_not_proposed). Absent: all proposed sections. An empty list or duplicates answer 422 domain_validation_failed (checked by the server: no minItems/uniqueItems, because the generated model defaults an absent list to empty and would refuse every request without sections). |
duration_minutes | integer | no | accept only: the duration the patient grants, any whole number of minutes from 5 to the proposed duration (longer: 422 duration_exceeds_proposed). Absent: the proposed duration. |
reason | string | no | refuse only: an optional reason, kept only in the patient's own log; never shown to the requester and never in the staff audit body (the audit records only that a reason was given). |
EmptyCommand
object
SettingsCommand
| Name | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes | |
request_ttl_minutes | integer | yes | unanswered requests expire after this many minutes; 1.1.0: default 15 for a new jurisdiction row (rows already stored keep their value) |
card_ttl_minutes | integer | yes | |
durations_minutes | array of integer | yes | |
purpose_sections | object | yes | sections per purpose (vocabulary: allergies, medications, conditions, results, encounters, orders); 1.1.0: review defaults to the care_visit sections (allergies, medications, conditions, results, encounters) in a new row; a stored row without review refuses it (422 purpose_not_configured) |
approval_reference | string | yes |
Options.purposes.item defined inline
| Name | Type | Required | Description |
|---|---|---|---|
code | Purpose | yes | care_visit (consult), prescribing (prescribe), dispensing, diagnostics (lab order and imaging). 1.1.0: review (roles licensed_clinician and clinical_supervisor; owner decision: default sections the same as care_visit, which the patient can untick). A jurisdiction settings row stored before 1.1.0 has no review entry: a request for review there answers 422 purpose_not_configured (fail closed) until settings add it. |
sections | array of string | yes |
LogEntry.actor defined inline
| Name | Type | Required | Description |
|---|---|---|---|
name | string | null | yes | |
kind | string | yes | |
facility_id | string | null | yes |