OHN-32 patient-approved access
- Version
- 1.1.0
- OpenAPI
- 3.1.0
- Source dans le dépôt
modules/OHN-32/api/patient-access.openapi.json- Serveurs
https://opeshealthnetwork.com/api/ohn/v1- Authentification
bearer: http bearer
Les contrats sont rédigés en anglais.
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).
Opérations
OHN-32-patient-access
GET/clinician/patient-access/optionsWhat this person may ask for (purposes, sections, durations) and whether the capability is on.
Identifiant d’opération: paOptions
Authentification: bearer
Réponses
| Code | Description | Type de média |
|---|---|---|
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.
Identifiant d’opération: paIdentify
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | oui |
Corps de la requête (obligatoire)
application/json:IdentifyCommand
Réponses
| Code | Description | Type de média |
|---|---|---|
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).
Identifiant d’opération: paListRequests
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
state | query | "pending" | "approved" | "refused" | "expired" | "cancelled" | non |
Réponses
| Code | Description | Type de média |
|---|---|---|
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.
Identifiant d’opération: paCreateRequest
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | oui |
Corps de la requête (obligatoire)
application/json:CreateRequestCommand
Réponses
| Code | Description | Type de média |
|---|---|---|
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.
Identifiant d’opération: paGetRequest
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
id | path | string (uuid) | oui |
Réponses
| Code | Description | Type de média |
|---|---|---|
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.
Identifiant d’opération: paCancelRequest
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
id | path | string (uuid) | oui | |
Idempotency-Key | header | string | oui |
Corps de la requête
application/json:EmptyCommand
Réponses
| Code | Description | Type de média |
|---|---|---|
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.
Identifiant d’opération: paUseGrant
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
id | path | string (uuid) | oui | |
Idempotency-Key | header | string | oui |
Corps de la requête
application/json:EmptyCommand
Réponses
| Code | Description | Type de média |
|---|---|---|
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).
Identifiant d’opération: paIncoming
Authentification: bearer
Réponses
| Code | Description | Type de média |
|---|---|---|
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.
Identifiant d’opération: paDecide
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
id | path | string (uuid) | oui | |
Idempotency-Key | header | string | oui |
Corps de la requête (obligatoire)
application/json:DecisionCommand
Réponses
| Code | Description | Type de média |
|---|---|---|
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).
Identifiant d’opération: paGrants
Authentification: bearer
Réponses
| Code | Description | Type de média |
|---|---|---|
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).
Identifiant d’opération: paRevoke
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
id | path | string (uuid) | oui | |
Idempotency-Key | header | string | oui |
Corps de la requête
application/json:EmptyCommand
Réponses
| Code | Description | Type de média |
|---|---|---|
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.
Identifiant d’opération: paLog
Authentification: bearer
Réponses
| Code | Description | Type de média |
|---|---|---|
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).
Identifiant d’opération: paNewCard
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | oui |
Corps de la requête
application/json:EmptyCommand
Réponses
| Code | Description | Type de média |
|---|---|---|
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.
Identifiant d’opération: paReadSettings
Authentification: bearer
Réponses
| Code | Description | Type de média |
|---|---|---|
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).
Identifiant d’opération: paWriteSettings
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | oui |
Corps de la requête (obligatoire)
application/json:SettingsCommand
Réponses
| Code | Description | Type de média |
|---|---|---|
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).
Identifiant d’opération: paAudit
Authentification: bearer
Paramètres
| Nom | Emplacement | Type | Obligatoire | Description |
|---|---|---|---|---|
from | query | string | non | |
to | query | string | non | |
format | query | "json" | "csv" | non |
Réponses
| Code | Description | Type de média |
|---|---|---|
200 | OK | application/json: objecttext/csv: string |
400 | Error | — |
401 | Error | — |
403 | Error | — |
404 | Error | — |
409 | Error | — |
422 | Error | — |
503 | Error | — |
Schémas
Error
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
error | string | oui | |
message | string | non | |
details | any | non |
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
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
initials | string | oui | |
birth_year | integer | null | oui |
Options
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
enabled | boolean | oui | |
kind | string | null | oui | |
request_ttl_minutes | integer | null | oui | |
durations_minutes | array of integer | oui | |
purposes | array of Options.purposes.item | oui |
Lookup
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
lookup_id | string (uuid) | oui | |
identified_by | "qr" | "card_code" | "health_id" | oui | |
patient | Masked | oui | |
expires_at | string (date-time) | oui |
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.
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
grant_id | string (uuid) | oui | |
status | "active" | "ended" | "expired" | oui | |
expires_at | string (date-time) | oui |
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.
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
id | string (uuid) | oui | |
state | RequestState | oui | |
purpose | Purpose | oui | 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 | oui | |
duration_minutes | integer | oui | |
answer_by | string (date-time) | oui | |
created_at | string (date-time) | oui | |
decided_at | string | null (date-time) | oui | |
patient | Masked | oui | |
identified_by | string | oui | |
facility_id | string (uuid) | oui | |
grant | Grant | null | oui | |
version | integer | oui | |
note | string | null | non | the requester's note (null for requests made before 1.1.0) |
proposed_sections | array of string | non | what the requester asked for (equal to sections, which keeps its 1.0.0 meaning) |
proposed_duration_minutes | integer | non | what the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning) |
granted_sections | array of string | non | what the patient granted (a subset of proposed_sections); null until accepted |
granted_duration_minutes | integer | null | non | what the patient granted (at most proposed_duration_minutes); null until accepted |
Requester
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
name | string | null | oui | |
name_attested | boolean | oui | |
title | string | null | oui | |
kind | Kind | oui | |
facility_id | string (uuid) | oui |
IncomingView
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
id | string (uuid) | oui | |
state | RequestState | oui | |
requester | Requester | oui | |
purpose | Purpose | oui | 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 | oui | |
duration_minutes | integer | oui | |
answer_by | string (date-time) | oui | |
created_at | string (date-time) | oui | |
on_behalf_of | Masked | null | oui | |
grant | Grant | null | oui | |
version | integer | oui | |
note | string | null | non | the requester's note (null for requests made before 1.1.0) |
proposed_sections | array of string | non | what the requester asked for (equal to sections, which keeps its 1.0.0 meaning) |
proposed_duration_minutes | integer | non | what the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning) |
granted_sections | array of string | non | what the patient granted (a subset of proposed_sections); null until accepted |
granted_duration_minutes | integer | null | non | 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).
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
grant_id | string (uuid) | oui | |
request_id | string (uuid) | oui | |
requester | Requester | oui | |
purpose | Purpose | oui | 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 | oui | |
granted_at | string (date-time) | oui | |
expires_at | string (date-time) | oui | |
status | "active" | "ended" | "expired" | "revoked" | oui | |
uses | integer | oui | |
last_used_at | string | null (date-time) | oui | |
proposed_sections | array of string | non | what the requester asked for (equal to sections, which keeps its 1.0.0 meaning) |
proposed_duration_minutes | integer | non | what the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning) |
granted_sections | array of string | non | what the patient granted (a subset of proposed_sections); null until accepted |
granted_duration_minutes | integer | null | non | what the patient granted (at most proposed_duration_minutes); null until accepted |
LogEntry
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
at | string (date-time) | oui | |
event | "identified" | "requested" | "accepted" | "refused" | "expired" | "cancelled" | "used" | "revoked" | oui | |
request_id | string (uuid) | oui | |
actor | LogEntry.actor | oui | |
purpose | Purpose | oui | 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 | non | refused entries in the patient's own log only: the patient's refusal reason |
note | string | null | non | requested entries: the requester's note |
Card
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
code | string | oui | |
display | string | oui | |
qr_payload | string | oui | |
expires_at | string (date-time) | oui |
Settings
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
configured | boolean | oui | |
enabled | boolean | oui | |
request_ttl_minutes | integer | oui | 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 | oui | |
durations_minutes | array of integer | oui | |
purpose_sections | object | oui | 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 | oui | |
version | integer | oui |
IdentifyCommand
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
code | string | oui | The scanned QR payload (OHN:PA:1:...), the printed card code, or an OHN-02 health ID |
CreateRequestCommand
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
lookup_id | string (uuid) | oui | |
purpose | Purpose | oui | 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 | oui | |
requester_name | string | non | |
requester_title | string | non | |
note | string | non | 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" | non | 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).
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
decision | "accept" | "refuse" | oui | |
expected_version | integer | oui | |
sections | array of "allergies" | "medications" | "conditions" | "results" | "encounters" | "orders" | non | 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 | non | 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 | non | 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
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
enabled | boolean | oui | |
request_ttl_minutes | integer | oui | 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 | oui | |
durations_minutes | array of integer | oui | |
purpose_sections | object | oui | 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 | oui |
Options.purposes.item défini sur place
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
code | Purpose | oui | 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 | oui |
LogEntry.actor défini sur place
| Nom | Type | Obligatoire | Description |
|---|---|---|---|
name | string | null | oui | |
kind | string | oui | |
facility_id | string | null | oui |