Skip to content

← All contracts

OHN-01 Country and Jurisdiction Management

Version
1.0.0
OpenAPI
3.1.0
Source in the repository
modules/OHN-01/api/openapi.yaml
Servers
https://opeshealthnetwork.com/api/ohn/v1
Authentication
gatewayToken: http bearer (JWT)

Download the contract (YAML)

Contracts are written in English.

Written from the observed behaviour of the TypeScript reference (backend/modules/ohn-01, 2026-11-17). Reports (/jurisdictions/reports*) and the legacy /auth/token are NOT part of this version: reports are a pending gap (docs/program/java/ohn-01-analysis.md); /auth/token is retired (issued tokens to anyone) and replaced by Keycloak.

Operations

jurisdictions

GET/countries

Read by every OHN-01 role with action read, including the read-only service role country_reader (OHN-05 facility codes take the jurisdiction's country_code from here; owner decision 2026-11-23).

Operation ID: listCountries

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
cursorquerystringno
page_sizequeryintegerno

Responses

CodeDescriptionMedia type
200Countries
application/json: CountryPage
401application/problem+json with the legacy `error` code
application/problem+json: Problem
403application/problem+json with the legacy `error` code
application/problem+json: Problem
GET/jurisdictions

Operation ID: listJurisdictionPolicies

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
cursorquerystringno
page_sizequeryintegerno

Responses

CodeDescriptionMedia type
200Policies
application/json: PolicyPage
POST/jurisdictions

Operation ID: createCountry

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Created
application/json: Country
409application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/{id}/policies

Operation ID: publishPolicy

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Published
application/json: Policy
404application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
GET/jurisdictions/namespace-rules

Operation ID: listNamespaceRules

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
country_idquerystring (uuid)no

Responses

CodeDescriptionMedia type
200Rules newest first (capped at 500)
application/json: NamespaceRuleList
422application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/namespace-rules

Operation ID: createNamespaceRule

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Created
application/json: NamespaceRule
404application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
GET/jurisdictions/namespace-rules/{ruleId}

Operation ID: getNamespaceRule

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
ruleIdpathstringyes

Responses

CodeDescriptionMedia type
200Rule with overlapping rules
application/json: NamespaceRuleDetail
404application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/{id}/activate

Operation ID: activateCountry

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes
Idempotency-Keyheaderstringyes

Responses

CodeDescriptionMedia type
200Activated
application/json: Country
404application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/{id}/suspendLegacy one-step route; now only records a suspension request (dual control)

Operation ID: suspendCountryLegacy

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Suspension requested
application/json: Country
404application/problem+json with the legacy `error` code
application/problem+json: Problem
409application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/{id}/reinstate

Operation ID: reinstateCountry

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Reinstated
application/json: Country
404application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
GET/jurisdictions/{id}/history

Operation ID: getCountryHistory

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes

Responses

CodeDescriptionMedia type
200Audit trail oldest first
application/json: HistoryList
404application/problem+json with the legacy `error` code
application/problem+json: Problem
GET/jurisdictions/{id}/suspension-request

Operation ID: getSuspensionRequest

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes

Responses

CodeDescriptionMedia type
200State
application/json: SuspensionState
404application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/{id}/suspension-request

Operation ID: requestSuspension

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Requested
application/json: Country
404application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/{id}/suspension-request/approve

Operation ID: approveSuspension

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Suspended
application/json: Country
403application/problem+json with the legacy `error` code
application/problem+json: Problem
409application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/{id}/suspension-request/withdraw

Operation ID: withdrawSuspension

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
idpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Withdrawn or refused (back to active)
application/json: Country
409application/problem+json with the legacy `error` code
application/problem+json: Problem

reports

GET/jurisdictions/reports

Operation ID: listReports

Authentication: gatewayToken

Responses

CodeDescriptionMedia type
200Available reports
application/json: ReportList
403application/problem+json with the legacy `error` code
application/problem+json: Problem
GET/jurisdictions/reports/{reportId}

Filters are strict; an unknown query parameter is refused with 422. Scope comes from the token jurisdiction claim (country id or *).

Operation ID: runReport

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
reportIdpathstringyes
jurisdictionquerystringno
statusquerystringno
policy_domainquerystringno
issuerquerystringno
actorquerystringno
datequerystringno
period_fromquerystringno
period_toquerystringno
cursorquerystringno

Responses

CodeDescriptionMedia type
200Report
application/json: Report
403application/problem+json with the legacy `error` code
application/problem+json: Problem
404application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
POST/jurisdictions/reports/{reportId}/export

Operation ID: exportReport

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
reportIdpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Export created - single use and valid for five minutes
application/json: ExportReceipt
404application/problem+json with the legacy `error` code
application/problem+json: Problem
422application/problem+json with the legacy `error` code
application/problem+json: Problem
GET/jurisdictions/report-exports/{token}

Operation ID: downloadReportExport

Authentication: gatewayToken

Parameters

NameInTypeRequiredDescription
tokenpathstringyes

Responses

CodeDescriptionMedia type
200The file as csv or pdf
text/csv: string (binary)
application/pdf: string (binary)
404application/problem+json with the legacy `error` code
application/problem+json: Problem
410application/problem+json with the legacy `error` code
application/problem+json: Problem

Schemas

Problem

NameTypeRequiredDescription
typestringno
titlestringno
statusintegerno
detailstringno
errorstringyesunauthenticated | denied_by_policy | not_found | conflict | domain_validation_failed | missing_idempotency_key | idempotency_conflict | request_in_progress | no_pending_request | second_approver_required | payload_too_large | server_unavailable
messagestringyes
trace_idstringno
detailsobjectno

CountryStatus

"draft" | "reviewed" | "approved" | "active" | "suspension_requested" | "suspended" | "reinstated" | "superseded"

Country

NameTypeRequiredDescription
idstring (uuid)yes
country_codestringyes
country_namestringyes
default_localestringyes
time_zonestringyes
issuing_authoritystring (uuid)yes
activation_datestring | null (date-time)no
statusCountryStatusyes
versionintegeryes
created_atstring (date-time)yes
updated_atstring (date-time)yes

CountryCommand

NameTypeRequiredDescription
country_codestringyes
country_namestringyes
default_localestringyes
time_zonestringyes
issuing_authoritystring (uuid)yes
activation_datestring (date-time)no

CountryPage

NameTypeRequiredDescription
dataarray of Countryyes
next_cursorstring | nullyes
page_sizeintegeryes

Policy

NameTypeRequiredDescription
idstring (uuid)no
country_idstring (uuid)no
policy_domainstringno
policy_versionstringno
effective_fromstring (date-time)no
policy_documentstringno
reviewer_idstring (uuid)no
reasonstringno
statusstringno
versionintegerno
created_atstring (date-time)no
updated_atstring (date-time)no

PolicyCommand

NameTypeRequiredDescription
jurisdiction_idstring (uuid)yes
policy_domainstringyes
policy_versionstringyes
effective_fromstring (date-time)yes
policy_documentstringyes
reviewer_idstring (uuid)yes
reasonstringyes

PolicyPage

NameTypeRequiredDescription
dataarray of Policyno
next_cursorstring | nullno
page_sizeintegerno

NamespaceRule

NameTypeRequiredDescription
idstring (uuid)no
country_idstring (uuid)no
identifier_namespacestringno
issuer_idstring (uuid)no
format_patternstringno
uniqueness_scope"country" | "jurisdiction" | "facility"no
valid_fromstring (date)no
versionintegerno
created_atstring (date-time)no
updated_atstring (date-time)no

NamespaceRuleCommand

NameTypeRequiredDescription
country_idstring (uuid)yes
identifier_namespacestringyes
issuer_idstring (uuid)yes
format_patternstringyes
uniqueness_scope"country" | "jurisdiction" | "facility"yes
valid_fromstring (date)yes

NamespaceRuleList

NameTypeRequiredDescription
dataarray of NamespaceRuleno

NamespaceRuleDetail

NameTypeRequiredDescription
idstring (uuid)no
country_idstring (uuid)no
identifier_namespacestringno
issuer_idstring (uuid)no
format_patternstringno
uniqueness_scope"country" | "jurisdiction" | "facility"no
valid_fromstring (date)no
versionintegerno
created_atstring (date-time)no
updated_atstring (date-time)no
overlapping_rulesarray of NamespaceRuleno

SuspendCommand

NameTypeRequiredDescription
reasonstringyes
second_approver_idstring (uuid)yes

ReasonCommand

NameTypeRequiredDescription
reasonstringyes

ReportList

NameTypeRequiredDescription
reportsarray of ReportList.reports.itemno

Report

NameTypeRequiredDescription
report_idstringyes
titlestringyes
columnsarray of stringyes
rowsarray of objectyes
summaryobjectyes
state"rendered" | "no_authorized_data"yes
generated_atstring (date-time)yes
next_cursorstring | nullyes

ExportCommand

NameTypeRequiredDescription
format"csv" | "pdf"yes
filtersobjectno

ExportReceipt

NameTypeRequiredDescription
export_idstring (uuid)no
report_idstringno
formatstringno
rowsintegerno
expires_atstring (date-time)no
single_usebooleanno
download_pathstringno

HistoryEntry

NameTypeRequiredDescription
idstring (uuid)no
event_typestringno
atstring (date-time)no
statusstring | nullno
previous_statusstring | nullno
policy_domainstring | nullno
policy_versionstring | nullno
reasonstring | nullno
actorstring | nullno
requested_bystring | nullno
decisionstring | nullno

HistoryList

NameTypeRequiredDescription
dataarray of HistoryEntryno

SuspensionState

NameTypeRequiredDescription
country_idstring (uuid)no
statusCountryStatusno
pendingSuspensionState.pendingno

ReportList.reports.item defined inline

NameTypeRequiredDescription
idstringno
titlestringno

SuspensionState.pending defined inline

NameTypeRequiredDescription
requested_bystringno
reasonstringno
atstring (date-time)no