Skip to content

← All contracts

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

Download the contract (JSON)

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

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
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

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
GET/clinician/patient-access/requestsMy recent requests, newest first (50).

Operation ID: paListRequests

Authentication: bearer

Parameters

NameInTypeRequiredDescription
statequery"pending" | "approved" | "refused" | "expired" | "cancelled"no

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
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

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
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

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
POST/clinician/patient-access/requests/{id}/cancelWithdraw a pending request.

Operation ID: paCancelRequest

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
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

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
GET/clinician/patient-access/incomingPatient: requests waiting for my answer (poll every few seconds while signed in).

Operation ID: paIncoming

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
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

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
GET/clinician/patient-access/grantsPatient: who can see my record (active and past grants).

Operation ID: paGrants

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
POST/clinician/patient-access/grants/{id}/revokePatient: end an active grant now (id = grant_id).

Operation ID: paRevoke

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
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

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
POST/clinician/patient-access/cardPatient: a fresh QR card (short-lived random reference, no clinical data).

Operation ID: paNewCard

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body

Responses

CodeDescriptionMedia type
201OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
GET/clinician/patient-access/settingsJurisdiction switch and options.

Operation ID: paReadSettings

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
POST/clinician/patient-access/settingsChange the switch and options (audited).

Operation ID: paWriteSettings

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—
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

NameInTypeRequiredDescription
fromquerystringno
toquerystringno
formatquery"json" | "csv"no

Responses

CodeDescriptionMedia type
200OK
application/json: object
text/csv: string
400Error—
401Error—
403Error—
404Error—
409Error—
422Error—
503Error—

Schemas

Error

NameTypeRequiredDescription
errorstringyes
messagestringno
detailsanyno

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

NameTypeRequiredDescription
initialsstringyes
birth_yearinteger | nullyes

Options

NameTypeRequiredDescription
enabledbooleanyes
kindstring | nullyes
request_ttl_minutesinteger | nullyes
durations_minutesarray of integeryes
purposesarray of Options.purposes.itemyes

Lookup

NameTypeRequiredDescription
lookup_idstring (uuid)yes
identified_by"qr" | "card_code" | "health_id"yes
patientMaskedyes
expires_atstring (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.

NameTypeRequiredDescription
grant_idstring (uuid)yes
status"active" | "ended" | "expired"yes
expires_atstring (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.

NameTypeRequiredDescription
idstring (uuid)yes
stateRequestStateyes
purposePurposeyescare_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.
sectionsarray of stringyes
duration_minutesintegeryes
answer_bystring (date-time)yes
created_atstring (date-time)yes
decided_atstring | null (date-time)yes
patientMaskedyes
identified_bystringyes
facility_idstring (uuid)yes
grantGrant | nullyes
versionintegeryes
notestring | nullnothe requester's note (null for requests made before 1.1.0)
proposed_sectionsarray of stringnowhat the requester asked for (equal to sections, which keeps its 1.0.0 meaning)
proposed_duration_minutesintegernowhat the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning)
granted_sectionsarray of stringnowhat the patient granted (a subset of proposed_sections); null until accepted
granted_duration_minutesinteger | nullnowhat the patient granted (at most proposed_duration_minutes); null until accepted

Requester

NameTypeRequiredDescription
namestring | nullyes
name_attestedbooleanyes
titlestring | nullyes
kindKindyes
facility_idstring (uuid)yes

IncomingView

NameTypeRequiredDescription
idstring (uuid)yes
stateRequestStateyes
requesterRequesteryes
purposePurposeyescare_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.
sectionsarray of stringyes
duration_minutesintegeryes
answer_bystring (date-time)yes
created_atstring (date-time)yes
on_behalf_ofMasked | nullyes
grantGrant | nullyes
versionintegeryes
notestring | nullnothe requester's note (null for requests made before 1.1.0)
proposed_sectionsarray of stringnowhat the requester asked for (equal to sections, which keeps its 1.0.0 meaning)
proposed_duration_minutesintegernowhat the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning)
granted_sectionsarray of stringnowhat the patient granted (a subset of proposed_sections); null until accepted
granted_duration_minutesinteger | nullnowhat the patient granted (at most proposed_duration_minutes); null until accepted

PatientGrant

1.1.0: sections is what the grant covers (the granted sections).

NameTypeRequiredDescription
grant_idstring (uuid)yes
request_idstring (uuid)yes
requesterRequesteryes
purposePurposeyescare_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.
sectionsarray of stringyes
granted_atstring (date-time)yes
expires_atstring (date-time)yes
status"active" | "ended" | "expired" | "revoked"yes
usesintegeryes
last_used_atstring | null (date-time)yes
proposed_sectionsarray of stringnowhat the requester asked for (equal to sections, which keeps its 1.0.0 meaning)
proposed_duration_minutesintegernowhat the requester asked for (equal to duration_minutes, which keeps its 1.0.0 meaning)
granted_sectionsarray of stringnowhat the patient granted (a subset of proposed_sections); null until accepted
granted_duration_minutesinteger | nullnowhat the patient granted (at most proposed_duration_minutes); null until accepted

LogEntry

NameTypeRequiredDescription
atstring (date-time)yes
event"identified" | "requested" | "accepted" | "refused" | "expired" | "cancelled" | "used" | "revoked"yes
request_idstring (uuid)yes
actorLogEntry.actoryes
purposePurposeyescare_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.
reasonstring | nullnorefused entries in the patient's own log only: the patient's refusal reason
notestring | nullnorequested entries: the requester's note

Card

NameTypeRequiredDescription
codestringyes
displaystringyes
qr_payloadstringyes
expires_atstring (date-time)yes

Settings

NameTypeRequiredDescription
configuredbooleanyes
enabledbooleanyes
request_ttl_minutesintegeryesunanswered requests expire after this many minutes; 1.1.0: default 15 for a new jurisdiction row (rows already stored keep their value)
card_ttl_minutesintegeryes
durations_minutesarray of integeryes
purpose_sectionsobjectyessections 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_referencestring | nullyes
versionintegeryes

IdentifyCommand

NameTypeRequiredDescription
codestringyesThe scanned QR payload (OHN:PA:1:...), the printed card code, or an OHN-02 health ID

CreateRequestCommand

NameTypeRequiredDescription
lookup_idstring (uuid)yes
purposePurposeyescare_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_minutesintegeryes
requester_namestringno
requester_titlestringno
notestringnoWhy 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.
sectionsarray of "allergies" | "medications" | "conditions" | "results" | "encounters" | "orders"noSections 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).

NameTypeRequiredDescription
decision"accept" | "refuse"yes
expected_versionintegeryes
sectionsarray of "allergies" | "medications" | "conditions" | "results" | "encounters" | "orders"noaccept 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_minutesintegernoaccept 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.
reasonstringnorefuse 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

NameTypeRequiredDescription
enabledbooleanyes
request_ttl_minutesintegeryesunanswered requests expire after this many minutes; 1.1.0: default 15 for a new jurisdiction row (rows already stored keep their value)
card_ttl_minutesintegeryes
durations_minutesarray of integeryes
purpose_sectionsobjectyessections 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_referencestringyes

Options.purposes.item defined inline

NameTypeRequiredDescription
codePurposeyescare_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.
sectionsarray of stringyes

LogEntry.actor defined inline

NameTypeRequiredDescription
namestring | nullyes
kindstringyes
facility_idstring | nullyes