Skip to content

← All contracts

OHN-15 Consent Management and Ledger

Version
1.0.0
OpenAPI
3.1.0
Source in the repository
modules/OHN-15/api/openapi.json
Servers
https://opeshealthnetwork.com/api/ohn/v1
Authentication
bearer: http bearer

Download the contract (JSON)

Contracts are written in English.

Consent grant, revoke, renew, enforcement decision, reports. Default deny. Authentication: bearer token (OHN gateway token (ES256, audience ohn-15, claims role, jurisdiction, organization_id, purpose)). All POSTs require an Idempotency-Key header (8-128 characters).

Operations

OHN-15

POST/consentsRequest a consent (W001 start)

Operation ID: requestConsent

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Created
application/json: object
400Typed error
application/json: Error
401Typed error
application/json: Error
403Typed error
application/json: Error
404Typed error
application/json: Error
409Typed error
application/json: Error
422Typed error
application/json: Error
429Typed error
application/json: Error
503Typed error
application/json: Error
GET/patients/{id}/consentsList a patient's consents

Operation ID: listPatientConsents

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
statusquerystringno
cursorquerystringno

Responses

CodeDescriptionMedia type
200Page of consents
application/json: object
401Typed error
application/json: Error
403Typed error
application/json: Error
404Typed error
application/json: Error
GET/consents/worklistConsents awaiting action (steward)

Operation ID: consentWorklist

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
403Typed error
application/json: Error
GET/consents/{id}Consent detail with workflow history

Operation ID: consentDetail

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200OK
application/json: object
404Typed error
application/json: Error
POST/consents/{id}/transitionsAdvance W001 (informed_choice, granted, denied)

Operation ID: transitionConsent

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
409Typed error
application/json: Error
422Typed error
application/json: Error
POST/consents/{id}/revokeRevoke (W002)

Operation ID: revokeConsent

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Revoked or scheduled; downstream delivery is reported as pending until the outbox relay confirms it
application/json: object
404Typed error
application/json: Error
409Typed error
application/json: Error
422Typed error
application/json: Error
POST/consents/{id}/representative-reviewRepresentative approval (F003, steward only)

Operation ID: reviewRepresentative

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
403Typed error
application/json: Error
422Typed error
application/json: Error
503Typed error
application/json: Error
POST/consents/{id}/renewRenewal (F004)

Operation ID: renewConsent

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
409Typed error
application/json: Error
422Typed error
application/json: Error
POST/consents/decisionsEnforcement decision (service role only)

Operation ID: decideAccess

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200permit or deny; deny always carries error_code
application/json: object
403Typed error
application/json: Error
503Typed error
application/json: Error
POST/consents/maintenance/sweepApply expiry and scheduled revocation (W003)

Operation ID: sweepConsents

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Responses

CodeDescriptionMedia type
200Counts of expired, revoked, activated
application/json: object
POST/consents/maintenance/drain-outboxRelay pending events; with no bus configured reports pending only

Operation ID: drainConsentOutbox

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Responses

CodeDescriptionMedia type
200delivered / pending counts
application/json: object
POST/consent-policyDraft a policy version (steward)

Operation ID: draftConsentPolicy

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Draft created
application/json: object
422Typed error
application/json: Error
POST/consent-policy/{version}/activateActivate (dual control: not the drafter)

Operation ID: activateConsentPolicy

Authentication: bearer

Parameters

NameInTypeRequiredDescription
versionpathintegeryes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Active
application/json: object
403Typed error
application/json: Error
409Typed error
application/json: Error
GET/consents/reports/{reportId}Run OHN-15-R001, R002 or R003

Operation ID: runConsentReport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
reportIdpathstringyes
period_fromquerystringno
period_toquerystringno
purposequerystringno
recipientquerystringno
patient_scopequerystringno
facilityquerystringno
reasonquerystringno
cursorquerystringno

Responses

CodeDescriptionMedia type
200Report
application/json: object
422Typed error
application/json: Error
POST/consents/reports/{reportId}/exportCreate a signed short-lived export (csv|pdf)

Operation ID: createConsentExport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
reportIdpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201download_path valid for five minutes, owner only
application/json: object
GET/consents/exports/{token}Download; 410 when expired or when consent changed after creation

Operation ID: fetchConsentExport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
tokenpathstringyes

Responses

CodeDescriptionMedia type
200File
application/json: object
404Typed error
application/json: Error
410Typed error
application/json: Error

Schemas

Error

NameTypeRequiredDescription
errorstringyes
messagestringno
detailsobjectnofield -> code; never contains submitted values

Code

Controlled-vocabulary code from the active jurisdiction policy

string

ConsentGrantCommand

NameTypeRequiredDescription
patient_idstring (uuid)yes
recipient_orgstring (uuid)yes
data_categoriesanyyesArray of codes (1-64, unique); a comma, semicolon or space separated string is also accepted and normalised
purposeCodeyesControlled-vocabulary code from the active jurisdiction policy
start_atstring (date-time)yes
expires_atstring (date-time)yes
legal_basisCodeyesControlled-vocabulary code from the active jurisdiction policy

TransitionCommand

NameTypeRequiredDescription
expected_versionintegeryes
to_state"informed_choice" | "granted" | "denied"yes
evidence_refstring (uuid)no
reasonstringyes

RevocationCommand

NameTypeRequiredDescription
consent_idstring (uuid)yes
revocation_scope"full" | "data_categories"yes
revoked_data_categoriesanynoArray of codes; required exactly when revocation_scope is data_categories; a separated string is also accepted
reasonstringyes
requested_bystring (uuid)yesMust equal the authenticated principal
effective_atstring (date-time)yes
expected_versionintegeryes

RepresentativeReviewCommand

NameTypeRequiredDescription
consent_idstring (uuid)yes
representative_refstring (uuid)yes
authority_evidencestring (uuid)yes
decision"approve" | "reject"yes
reasonstringyes
expected_versionintegeryes

RenewalCommand

NameTypeRequiredDescription
consent_idstring (uuid)yes
new_expirystring (date-time)yes
scope_changesstringno
patient_confirmationstring (uuid)yes
expected_versionintegeryes

DecisionCommand

NameTypeRequiredDescription
patient_idstring (uuid)yes
recipient_orgstring (uuid)yes
resource_classCodeyesControlled-vocabulary code from the active jurisdiction policy
purposeCodeyesControlled-vocabulary code from the active jurisdiction policy
facility_idstring (uuid)yes
channel"online" | "cache_revalidation" | "async_export"no
cached_decision_epochintegerno

DecisionResult

NameTypeRequiredDescription
decision"permit" | "deny"yes
error_codenull | "no_consent" | "scope_mismatch" | "consent_revoked" | "consent_expired" | "consent_not_yet_effective" | "consent_pending" | "consent_denied"no
consent_idstring | nullno
decision_epochintegeryes
stale_cache_rejectedbooleanno
cacheDecisionResult.cacheyes

PolicyDraftCommand

NameTypeRequiredDescription
configobjectyesSee schema PolicyConfig; validated server-side (codes, no duplicates, strict keys).
reasonstringyes

ConsentView

NameTypeRequiredDescription
idstring (uuid)yes
status"requested" | "identity_authorized" | "informed_choice" | "granted" | "effective" | "denied" | "revocation_requested" | "revoked" | "expired"yesComputed from time, so expiry and revocation apply even before a sweep runs
stored_statusstringno
versionintegeryes
patient_idstringno
recipient_orgstringno
data_categoriesarray of stringno
purposestringno
legal_basisstringno
start_atstringno
expires_atstringno
receiptobjectno

ConsentPage

NameTypeRequiredDescription
itemsarray of ConsentViewno
next_cursorstring | nullno
epochintegerno

Report

NameTypeRequiredDescription
report_idstringyes
columnsarray of stringyes
rowsarray of objectyes
summaryobjectno
next_cursorstring | nullno
state"rendered" | "no_authorized_data"yes
suppressionReport.suppressionno

PolicyConfig

NameTypeRequiredDescription
purposesarray of Codeyes
legal_basesarray of PolicyConfig.legal_bases.itemyes
data_categoriesarray of Codeyes
max_consent_duration_daysinteger | nullyesnull is an explicit jurisdiction decision that no maximum applies
min_aggregate_cell_sizeintegeryes

ExportCommand

NameTypeRequiredDescription
format"csv" | "pdf"yes
filtersobjectnoSame filters as the report (period_from, period_to, purpose, recipient, patient_scope, facility, reason); strict

ActivateCommand

NameTypeRequiredDescription
reasonstringyes

DecisionResult.cache defined inline

NameTypeRequiredDescription
ttl_secondsintegerno
valid_untilstring | nullno

Report.suppression defined inline

NameTypeRequiredDescription
min_cell_sizeinteger | nullno
appliedbooleanno

PolicyConfig.legal_bases.item defined inline

NameTypeRequiredDescription
codeCodeyesControlled-vocabulary code from the active jurisdiction policy
requires_affirmative_consentbooleanyes