Skip to content

← All contracts

OHN-22 Legacy Healthcare Integration

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

Download the contract (JSON)

Contracts are written in English.

Base path /api/ohn/v1. Every POST requires Idempotency-Key; mutations use expected_version. Routes default-deny on role AND purpose (legacy_integration). Request bodies are limited to 256 KB. Dependencies (OHN-23 terminology, OHN-21 contract, OHN-03 identity) are called over their contracts and fail closed with 503 dependency_unavailable. The TypeScript-only synthetic sign-in (POST /legacy/synthetic-token) is not part of this contract; tokens come from the platform gateway (purpose legacy_integration).

Operations

OHN-22

GET/legacy/adaptersAdapter catalog

Operation ID: listAdapters

Authentication: bearer

Parameters

NameInTypeRequiredDescription
standardquerystringno
qquerystringnocase-insensitive name contains
cursorquerystringno

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/adaptersRegister adapter (API-001; F001)

Operation ID: registerAdapter

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
201OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/adapters/{id}Adapter with mappings

Operation ID: getAdapter

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/adapters/{id}/mappingsDraft a mapping version with rules (F002)

Operation ID: createMapping

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
201OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/mappings/{id}Mapping with rules and history

Operation ID: getMapping

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/mappings/{id}/rulesAdd a rule to a draft mapping

Operation ID: addRule

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
201OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/mappings/{id}/samplesDry-run a sample message; passing advances draft to sampled

Operation ID: sampleMapping

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/mappings/{id}/transitionsMapping release transition (W002)

Operation ID: transitionMapping

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/messagesMessages / dead-letter queue (status, dlq_state, adapter_id)

Operation ID: listMessages

Authentication: bearer

Parameters

NameInTypeRequiredDescription
statusquerystringno
dlq_statequerystringno
adapter_idquerystring (uuid)no
cursorquerystringno

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/messagesIngest a legacy message (API-002; W001). 201 for a new message (published, quarantined or rejected); a duplicate redelivery returns 200 with duplicate=true; same id with other content is 409 message_id_conflict

Operation ID: ingestMessage

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
200Duplicate redelivery of the same external_message_id and content: no second result, the attempt is recorded (duplicate=true)
application/json: object
201OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/messages/{id}Message with attempts, errors, history (API-003)

Operation ID: getMessage

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/messages/{id}/triageTriage a failed message

Operation ID: triage

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/messages/{id}/correctAttach a corrected payload (clinical_mapper only; original retained)

Operation ID: correct

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/messages/{id}/retryReplay a failed message (F003; never re-publishes a published one)

Operation ID: retry

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/unit-conversionsUnit conversions

Operation ID: listUnits

Authentication: bearer

Parameters

NameInTypeRequiredDescription
statequery"proposed" | "approved" | "rejected"no

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/unit-conversionsPropose a unit conversion

Operation ID: proposeUnit

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
201OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/unit-conversions/{id}/decisionApprove/reject a unit conversion (proposer cannot decide)

Operation ID: decideUnit

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/code-lists/{list}Read code list

Operation ID: listCodes

Authentication: bearer

Parameters

NameInTypeRequiredDescription
listpath"message_standard" | "transport"yes

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/code-lists/{list}Upsert code list entries

Operation ID: upsertCodes

Authentication: bearer

Parameters

NameInTypeRequiredDescription
listpath"message_standard" | "transport"yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/maintenance/drain-outboxDrain outbox (no sink => nothing marked delivered)

Operation ID: drainOutbox

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/report-catalogReport catalog

Operation ID: reportCatalog

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/reports/{reportId}Run report

Operation ID: runReport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
adapterquerystring (uuid)no
partnerquerystring (uuid)no
standardquerystringno
reasonquerystringno
statusquerystringno
period_fromquerystringno
period_toquerystringno
cursorquerystringno
reportIdpath"OHN-22-R001" | "OHN-22-R002" | "OHN-22-R003"yes

Responses

CodeDescriptionMedia type
200OK
application/json: Report
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
POST/legacy/reports/{reportId}/exportCreate signed single-use export

Operation ID: createExport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
reportIdpath"OHN-22-R001" | "OHN-22-R002" | "OHN-22-R003"yes
Idempotency-Keyheaderstringyes8 to 128 characters of A-Z a-z 0-9 _ . : -. A 5xx answer releases the key; a replay answers with Idempotent-Replay: true.

Request body (required)

Responses

CodeDescriptionMedia type
201OK
application/json: object
400Malformed / missing Idempotency-Key—
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
409Version conflict, illegal transition, already published or idempotency mismatch
application/json: Error
413Request body larger than 256 KB (payload_too_large)—
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—
GET/legacy/exports/{token}Download export (the requesting principal only, single use, 5 minutes). Any other caller or token is 404

Operation ID: fetchExport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
tokenpathstringyes

Responses

CodeDescriptionMedia type
200The export file (CSV or PDF), once
text/csv: string
application/pdf: string (binary)
401Unauthenticated—
403Role/purpose denied (default deny) or separation of duties—
404Not found / out of scope—
410export_expired (after 5 minutes) or export_consumed (already downloaded)
application/json: Error
422Validation or domain refusal
application/json: Error
429Rate limited—
503Dependency unavailable (fails closed)—

Other operations

GET/health/ohn-22Liveness incl. database ping and dependency modes (public; served at the root, not under /api/ohn/v1)

Operation ID: health

Responses

CodeDescriptionMedia type
200ok
503unavailable—

Schemas

Error

NameTypeRequiredDescription
errorstringyes
messagestringno
detailsanynoValidation: {field: issue code} (invalid_type, too_small, too_big, invalid_string, invalid_enum_value, unrecognized_keys under "_"), or a domain object

Adapter

NameTypeRequiredDescription
adapter_namestringyes
message_standardstringyesMust exist in the jurisdiction message_standard code list
source_orgstring (uuid)yes
target_servicestring (uuid)yes
transportstringyesMust exist in the jurisdiction transport code list

Rule

NameTypeRequiredDescription
source_fieldstringyesHL7 v2 address, e.g. PID-5.1 or OBX[2]-5
target_fhir_pathstringyesA path of the canonical FHIR contract, e.g. Patient.identifier; checked against OHN-21 at sign-off
transform_expressionstringyesOne of: copy, trim, upper, lower, hl7_date, number, code, unit(FROM,TO). Not executable code.
terminology_refstring (uuid)yes
fallback_action"reject" | "quarantine" | "omit"yes
mandatorybooleannoA mandatory rule may not use fallback omit

MappingCreate

NameTypeRequiredDescription
version_labelstringyes
rulesarray of Ruleyes

AddRule

NameTypeRequiredDescription
ruleRuleyes
expected_versionintegeryes

Sample

NameTypeRequiredDescription
sample_messagestringyes

MappingTransition

NameTypeRequiredDescription
to_state"draft" | "clinical_review" | "contract_verified" | "active"yes
expected_versionintegeryes
reasonstringyes

Message

NameTypeRequiredDescription
adapter_idstring (uuid)yes
external_message_idstringyes
payloadstringyesHL7 v2 text. The service accepts request bodies up to 256 KB (413 payload_too_large above that), so the effective limit is lower than maxLength.

Triage

NameTypeRequiredDescription
investigated_reasonstringyes
expected_versionintegeryes

Correct

NameTypeRequiredDescription
corrected_payloadstringyes
reasonstringyes
expected_versionintegeryes

Retry

NameTypeRequiredDescription
investigated_reasonstringyes
validated_mapping_versionstringyesLabel of the adapter active mapping; any other label is refused (409 mapping_version_mismatch)
operator_refstring (uuid)yesMust equal the authenticated operator
expected_versionintegeryes

UnitProposal

NameTypeRequiredDescription
from_unitstringyes
to_unitstringyesMust differ from from_unit
factor_numeratorstringyesPositive decimal
factor_denominatorstringyesPositive decimal
reference_notestringyes

UnitDecision

NameTypeRequiredDescription
decision"approved" | "rejected"yes
reasonstringyes
expected_versionintegeryes

CodeListUpsert

NameTypeRequiredDescription
entriesarray of CodeListUpsert.entries.itemyes

ExportCommand

NameTypeRequiredDescription
format"csv" | "pdf"yes
filtersReportFiltersno

Report

NameTypeRequiredDescription
report_id"OHN-22-R001" | "OHN-22-R002" | "OHN-22-R003"no
titlestringno
columnsarray of anyno
rowsarray of anyno
summaryobjectno
state"rendered" | "no_authorized_data"no
generated_atstring (date-time)no
next_cursorstring | nullno

ReportFilters

NameTypeRequiredDescription
adapterstring (uuid)no
partnerstring (uuid)nosource_org of the adapter
standardstringno
reasonstringnoR002 failure reason code
statusstringnoR003 outcome
period_fromstringno
period_tostringnoNot before period_from (422 after_period_to)

Receipt

NameTypeRequiredDescription
receipt_idstring (uuid)no
committed_atstring (date-time)no
aggregate_idstring (uuid)no
versionintegerno
status"committed" | "denied"no

get-health-ohn-22.response-200 defined inline

NameTypeRequiredDescription
status"ok"no
module"OHN-22"no
dependenciesget-health-ohn-22.response-200.dependenciesno

get-health-ohn-22.response-200.dependencies defined inline

NameTypeRequiredDescription
ohn23"live" | "unconfigured"no
ohn21"live" | "unconfigured"no
identity"live" | "unconfigured"no

CodeListUpsert.entries.item defined inline

NameTypeRequiredDescription
codestringyes
label_enstringyes
label_frstringyes
activebooleanno