Skip to content

← All contracts

OHN-18 Clinical Audit and Data Provenance

Version
1.1.0
OpenAPI
3.1.0
Source in the repository
modules/OHN-18/api/openapi.yaml
Servers
https://opeshealthnetwork.com
Authentication
bearerAuth: http bearer (JWT)

Download the contract (YAML)

Contracts are written in English.

Tamper-evident who/what/why/where/when evidence for access, changes and clinical assertions. All routes live under /api/ohn/v1/audit. Every POST requires an Idempotency-Key header. Default deny: only security_auditor and privacy_officer roles are permitted. Synthetic data only. 1.1.0 (2026-11-23): read-only role inspector (purpose regulatory_audit). It may call every GET and POST /reports/{report_id}/export, nothing else (ingest, investigations, integrity/verify, disclosure-trace-requests and transitions answer 403 and are recorded as denied.<action>). Every GET it makes is recorded first in the audit records (action audit.inspector.read); when that record cannot be written the answer is 503 audit_unavailable. Its export download is an attachment (Content-Disposition) and carries the OHN-16 security watermark with "INSPECTION COPY" (header X-OHN-Document-Mark; X-OHN-Unmarked-SHA256 is the digest the export signature covers). Java: tokens are issued by the gateway (ES256, audience ohn-18); the TypeScript synthetic sign-in helpers are not part of this contract.

Operations

events

GET/api/ohn/v1/audit/events

OHN-18-API-001. Cursor-paginated audit envelopes in the caller's jurisdiction. Patient references are masked.

Operation ID: ohn18_getAuditEvents

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
cursorquerystringno
page_sizequerystringnoClamped to 1..100, default 25
decisionquerystringno
kindquerystringno
domainquerystringnoResource type
patient_idquerystringno
period_fromquerystringno
period_toquerystringno

Responses

CodeDescriptionMedia type
200Page of envelopes with provenance and next_cursor
application/json: JsonObject
401Missing or invalid bearer token—
403denied_by_policy (role, purpose or jurisdiction)—
429rate_limited, with Retry-After—
POST/api/ohn/v1/audit/events

Append one access decision to the jurisdiction's hash chain (W001 access_decided).

Operation ID: ohn18_ingestAuditEvent

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Envelope appended; receipt with sequence_number and entry_hash
application/json: JsonObject
400missing_idempotency_key—
403denied_by_policy (role, purpose or jurisdiction)—
409stale_version, idempotency_conflict or request_in_progress—
422domain_validation_failed with field details—
503jurisdiction_unavailable, identity_provider_unavailable or dependency_unavailable; nothing written—
GET/api/ohn/v1/audit/events/{id}

Operation ID: ohn18_getAuditEvent

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
idpathstringyes

Responses

CodeDescriptionMedia type
200Envelope detail with chain verification, provenance links and history timeline
application/json: JsonObject
404not_found—
POST/api/ohn/v1/audit/investigations

Form OHN-18-F001 (Audit investigation).

Operation ID: ohn18_openInvestigation

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Investigation envelope appended with receipt
application/json: JsonObject
404not_found—
422domain_validation_failed with field details—

integrity

POST/api/ohn/v1/audit/integrity/verify

OHN-18-API-003, form OHN-18-F002. Recomputes the hash chain over a sequence range and compares with expected_root_hash. Never repairs. A mismatch emits audit.integrity.failure.

Operation ID: ohn18_verifyIntegrity

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Checkpoint recorded (result passed or failed)
application/json: JsonObject
403denied_by_policy (role, purpose or jurisdiction)—
409stale_version, idempotency_conflict or request_in_progress—
422domain_validation_failed with field details—
503jurisdiction_unavailable, identity_provider_unavailable or dependency_unavailable; nothing written—
GET/api/ohn/v1/audit/integrity/state

Operation ID: ohn18_getIntegrityState

Authentication: bearerAuth

Responses

CodeDescriptionMedia type
200Current chain head, length and computed root hash for the jurisdiction
application/json: JsonObject
GET/api/ohn/v1/audit/integrity/verifications

Operation ID: ohn18_listVerifications

Authentication: bearerAuth

Responses

CodeDescriptionMedia type
200Provenance links (verification runs)
application/json: JsonObject

disclosures

GET/api/ohn/v1/audit/checkpoints

Operation ID: ohn18_listCheckpoints

Authentication: bearerAuth

Responses

CodeDescriptionMedia type
200Disclosure trace requests (AuditIntegrityCheckpoint aggregate)
application/json: JsonObject
POST/api/ohn/v1/audit/disclosure-trace-requests

Form OHN-18-F003. Opens W003 at rights_request_authorized.

Operation ID: ohn18_requestDisclosureTrace

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Trace request recorded
application/json: JsonObject
422domain_validation_failed with field details—
GET/api/ohn/v1/audit/patients/{id}/disclosures

OHN-18-API-002 (relocated under /audit because /api/ohn/v1/patients is owned by OHN-01/02/03). Never returns other patients or staff security secrets.

Operation ID: ohn18_getPatientDisclosures

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
idpathstringyes
purposequerystringno
date_fromquerystringno
date_toquerystringno

Responses

CodeDescriptionMedia type
200Disclosure entries with authorized and denied counts
application/json: JsonObject
400Malformed patient id—

workflows

POST/api/ohn/v1/audit/workflows/{kind}/{id}/transitions

Advance W001 clinical_access_audit, W002 integrity_review or W003 patient_disclosure_accounting by exactly one step with optimistic concurrency.

Operation ID: ohn18_transitionWorkflow

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
kindpathstringyesclinical_access_audit, integrity_review or patient_disclosure_accounting; anything else is 404
idpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Transition committed with receipt
application/json: JsonObject
409stale_version, idempotency_conflict or request_in_progress—
422domain_validation_failed with field details—

reports

GET/api/ohn/v1/audit/reports/{reportId}

Operation ID: ohn18_getReport

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
reportIdpathstringyesOHN-18-R001, OHN-18-R002 or OHN-18-R003; anything else is 404

Responses

CodeDescriptionMedia type
200Report rows, metric definition, period and source freshness
application/json: JsonObject
POST/api/ohn/v1/audit/reports/{reportId}/export

Operation ID: ohn18_createExport

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
reportIdpathstringyesOHN-18-R001, OHN-18-R002 or OHN-18-R003; anything else is 404
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Ed25519-signed export, registered in OHN-45 (signature.ohn45_artifact_ref / ohn45_signature_ref); one-time retrieval path; emits audit.export.generated
application/json: JsonObject
503signing_unavailable (no key or OHN-45 unreachable) or policy_not_configured (R003); nothing generated—
GET/api/ohn/v1/audit/exports/{token}

Operation ID: ohn18_downloadExport

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
tokenpathstringyes

Responses

CodeDescriptionMedia type
200CSV or PDF body with X-OHN-Signature header
text/csv: string (binary)
application/pdf: string (binary)
404not_found—

Other operations

GET/health/ohn-18

Operation ID: ohn18_health

Responses

CodeDescriptionMedia type
200Database reachable
application/json: JsonObject
503Database unavailable—
GET/api/ohn/v1/audit/health

Database and dependency modes (live / unavailable-fail-closed). Reachable through the platform's /api/ohn proxy.

Operation ID: ohn18_externalHealth

Responses

CodeDescriptionMedia type
200Healthy
application/json: JsonObject
503Database unavailable—
GET/api/ohn/v1/audit/jurisdictions

OHN-01 jurisdictions in force (status active or reinstated).

Operation ID: ohn18_listJurisdictions

Authentication: bearerAuth

Responses

CodeDescriptionMedia type
200Jurisdictions from OHN-01
application/json: JsonObject
503jurisdiction_unavailable, identity_provider_unavailable or dependency_unavailable; nothing written—

Schemas

JsonObject

object

AuditDecision

"permitted" | "denied"

RequestPurpose

"patient_rights_request" | "regulatory_audit" | "legal_disclosure" | "continuity_of_care"

AuditEventCommand

NameTypeRequiredDescription
jurisdiction_idstring (uuid)yes
actor_idstring (uuid)yes
actor_rolestringyes
actionstringyes
resource_typestringyes
resource_idstring (uuid)yes
patient_idstring (uuid)no
facility_idstring (uuid)no
purposeRequestPurposeyes
decisionAuditDecisionyes
reasonstringno
event_timestring (date-time)no

AuditInvestigationCommand

NameTypeRequiredDescription
event_idstring (uuid)yes
investigation_reasonstringyes
investigator_idstring (uuid)yes
scopestringyes
case_refstring (uuid)no

IntegrityVerificationCommand

NameTypeRequiredDescription
jurisdiction_idstring (uuid)yes
sequence_fromintegeryes
sequence_tointegeryesMust be >= sequence_from
expected_root_hashstringyes
verification_environment"production" | "staging" | "disaster_recovery"yes

DisclosureTraceCommand

NameTypeRequiredDescription
patient_idstring (uuid)yes
date_fromstring (date)yes
date_tostring (date)yes
request_purposeRequestPurposeyes
recipient_scopestringno

WorkflowTransitionCommand

NameTypeRequiredDescription
expected_versionintegeryes
to_statestringyes
evidence_refstring (uuid)yes
reasonstringyes

ExportCommand

NameTypeRequiredDescription
format"csv" | "pdf"yes
period_fromstring (date-time)no
period_tostring (date-time)no
facility_idstring (uuid)no
severity"low" | "medium" | "high" | "critical"no
patient_idstring (uuid)no
request_purposeRequestPurposeno