Skip to content

← All contracts

OHN-53 Notifications and Messaging

Version
1.0.1
OpenAPI
3.1.0
Source in the repository
modules/OHN-53/api/openapi.yaml
Servers
https://opeshealthnetwork.com
Authentication
bearer: http bearer (JWT (ES256 from the platform gateway; iss ohn-platform-gateway, aud ohn-53; role + purpose + jurisdiction + organization_id))

Download the contract (YAML)

Contracts are written in English.

In-app inbox, SMS, email and USSD. Local dev sink by default (no live SMS or email adapter exists: provider contracts and credentials are owner items). No clinical content in SMS or email. Tokens come from the platform gateway (ES256, issuer ohn-platform-gateway, audience ohn-53; claims role, jurisdiction, organization_id, purpose). Every call except GET /health/ohn-53 and the two secret-authenticated callbacks (POST /api/ohn/v1/ussd, POST .../intake/webhook) needs a bearer token; every non-GET call needs an Idempotency-Key (1-255 characters, not blank) except those two callbacks. The operator kill switch refuses every gateway write with 503 not_configured (setting OHN_M53_WRITES_DISABLED).

Operations

Other operations

GET/api/ohn/v1/notifications/inboxList my notifications and unread count

In-app messages are rendered at read time in the requested language (lang query parameter, else Accept-Language, else the language each message was sent in). Messages stored before migration 0002 have no template key and are returned in the language they were sent in (`language`).

Operation ID: OHN-53-API-001

Authentication: bearer

Parameters

NameInTypeRequiredDescription
unreadquery"true" | "false"no
limitqueryintegerno
langquery"en" | "fr"noLanguage of title/body. Overrides Accept-Language.
Accept-LanguageheaderstringnoUsed when lang is absent; the first en or fr entry by weight wins.

Responses

CodeDescriptionMedia type
200OK
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
POST/api/ohn/v1/notifications/inbox/{id}/readMark one as read

Operation ID: OHN-53-API-002

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes
idpathstringyes

Request body (required)

  • application/json: object

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/inbox/read-allMark all as read

Operation ID: OHN-53-API-003

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

  • application/json: object

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
GET/api/ohn/v1/notifications/preferencesMy preferences

Operation ID: OHN-53-API-004

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
PUT/api/ohn/v1/notifications/preferencesUpdate my preferences (optimistic concurrency)

Operation ID: OHN-53-API-005

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409version_conflict: {error, message, details: {current_version}}
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
GET/api/ohn/v1/notifications/contactsMy contacts

Operation ID: OHN-53-API-006

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
503Not configured or dependency unavailable (fail closed)—
POST/api/ohn/v1/notifications/contactsAdd a phone or email and send a code

Operation ID: OHN-53-API-007

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Created
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409contact_in_use (verified for someone else) or already_verified (the caller already verified it)
application/json: Error
422Validation failed
application/json: Error
429rate_limited: too many codes requested in the last hour (default 5)
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/contacts/{id}/resendSend a new code

Operation ID: OHN-53-API-008

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes
idpathstringyes

Request body (required)

  • application/json: object

Responses

CodeDescriptionMedia type
201Created
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404No pending contact of the caller with this id
application/json: Error
409contact_in_use or already_verified
application/json: Error
422Validation failed
application/json: Error
429rate_limited
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/contacts/{id}/verifyVerify with the code

Operation ID: OHN-53-API-009

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes
idpathstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Verified, or already verified ({contact, duplicate: true})
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409invalid_state (revoked contact) or contact_in_use (the number was verified for another account meanwhile)
application/json: Error
410code_expired: no open challenge or it has expired (10 minutes by default); ask for a new code
application/json: Error
422domain_validation_failed (not 6 digits) or wrong_code: {error: wrong_code, message, attempts_left}; the attempt is counted
429too_many_attempts: five wrong codes (configurable); ask for a new code
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/contacts/{id}/revokeRemove a contact

Operation ID: OHN-53-API-010

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes
idpathstringyes

Request body (required)

  • application/json: object

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
GET/api/ohn/v1/notifications/remindersReminders (patient: own; staff: organisation)

Operation ID: OHN-53-API-011

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
POST/api/ohn/v1/notifications/remindersSchedule a reminder

Operation ID: OHN-53-API-012

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Created
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422domain_validation_failed; also when due_at is in the past (details.due_at = past)
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/reminders/{id}/cancelCancel a reminder

Operation ID: OHN-53-API-013

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes
idpathstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409version_conflict, or invalid_transition (only a scheduled reminder can be cancelled)
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/intake/eventsEvent intake (service role)

Operation ID: OHN-53-API-014

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403denied_by_policy: wrong role, or the event belongs to another jurisdiction than the token
application/json: Error
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/intake/webhookOHN-24 signed webhook receiver

OHN-24 webhook receiver. Authenticated by the HMAC-SHA256 of the raw body (header X-OHN-Signature: sha256=<hex>) with the shared webhook secret; no bearer token and no Idempotency-Key (duplicates are ignored by event_id). Unsigned or unconfigured is refused.

Operation ID: OHN-53-API-015

Parameters

NameInTypeRequiredDescription
X-OHN-Signatureheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401bad_signature: X-OHN-Signature missing or not sha256=<hex HMAC-SHA256 of the raw body>
application/json: Error
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/ussdUSSD aggregator callback (CON/END)

Aggregator callback (Africa's Talking format). Header X-OHN53-USSD-Secret or query key. Answers text/plain "CON ..." or "END ...", at most 182 characters.

Operation ID: OHN-53-API-016

Request body (required)

Responses

CodeDescriptionMedia type
200USSD screen
text/plain: string
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401END Not authorised.
text/plain: string
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/ussd-simulatorUSSD simulator

Operation ID: OHN-53-API-017

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200OK
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
GET/api/ohn/v1/notifications/admin/outboxDev sink messages

Operation ID: OHN-53-API-018

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
GET/api/ohn/v1/notifications/admin/deliveriesDeliveries

Operation ID: OHN-53-API-019

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
GET/api/ohn/v1/notifications/admin/deliveries/{id}Delivery and its log

Operation ID: OHN-53-API-020

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstringyes

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
POST/api/ohn/v1/notifications/admin/deliveries/{id}/retryRetry a failed delivery

Operation ID: OHN-53-API-021

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes
idpathstringyes

Request body (required)

  • application/json: object

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found (not a UUID)
application/json: Error
409invalid_transition: only failed or dead deliveries can be retried
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/admin/deliveries/processSend due messages now

Operation ID: OHN-53-API-022

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

  • application/json: object

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/admin/test-notificationSend a test message

Operation ID: OHN-53-API-023

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Created
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
GET/api/ohn/v1/notifications/admin/subscriptionsOHN-24 subscriptions and intake counts

Operation ID: OHN-53-API-024

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
POST/api/ohn/v1/notifications/admin/subscriptions/bootstrapCreate OHN-24 pull subscriptions

Operation ID: OHN-53-API-025

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

  • application/json: object

Responses

CodeDescriptionMedia type
201Created
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
POST/api/ohn/v1/notifications/admin/intake/pollPoll OHN-24 now

Operation ID: OHN-53-API-026

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

  • application/json: object

Responses

CodeDescriptionMedia type
200OK
application/json: object
400missing_idempotency_key (header absent, blank or longer than 255), or malformed_request (body is not valid JSON)
application/json: Error
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
409idempotency_conflict (the key was reused with a different body) or request_in_progress
application/json: Error
422Validation failed
application/json: Error
503not_configured (the operator kill switch, setting OHN_M53_WRITES_DISABLED, or a missing setting) or dependency_unavailable; nothing is stored
application/json: Error
GET/api/ohn/v1/notifications/reportsReport catalogue

Operation ID: OHN-53-API-027

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
GET/api/ohn/v1/notifications/reports/{id}Run report

Operation ID: OHN-53-API-028

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstringyes

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
GET/api/ohn/v1/notifications/reports/{id}/exportSigned CSV

Operation ID: OHN-53-API-029

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstringyes

Responses

CodeDescriptionMedia type
200Signed CSV: header X-OHN53-Signature: hmac-sha256=<hex HMAC-SHA256 of the body with the export signing key>; Content-Disposition attachment
text/csv: string
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503not_configured: the export signing key is not set (details.setting)
application/json: Error
GET/api/ohn/v1/notifications/auditAudit trail

Operation ID: OHN-53-API-030

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503Not configured or dependency unavailable (fail closed)—
GET/health/ohn-53Health and provider modes

Operation ID: OHN-53-API-032

Responses

CodeDescriptionMedia type
200Public. status, module, providers {sms,email,in_app: {provider, mode}}, dependencies {OHN-15, OHN-24: live|unconfigured|test_fake}, worker, event_intake, ussd, contact_protection, real_delivery_allowed (always false: there is no live adapter), writes_enabled, auth_configured, synthetic_auth (always false)
application/json: object
401Unauthenticated—
403Denied by policy (audited)—
404Not found—
422Validation failed
application/json: Error
503status unavailable: the database cannot be reached
application/json: Error

Schemas

Error

NameTypeRequiredDescription
errorstringyes
messagestringno
detailsanyno

Preferences

NameTypeRequiredDescription
language"en" | "fr"yes
channelsPreferences.channelsyes
quiet_hoursnull | Preferences.quiet_hours.option-2yes
opt_outbooleanyes
muted_categoriesarray of stringno
expected_versionintegeryes

StartContact

object | object

ConfirmContact

NameTypeRequiredDescription
codestringyes

Reminder

NameTypeRequiredDescription
patient_idstring (uuid)yes
kind"appointment" | "vaccination_due"yes
due_atstring (date-time)yes
remind_hours_beforeintegerno
place_labelstringyes

ExpectedVersion

NameTypeRequiredDescription
expected_versionintegeryes

EventEnvelope

any

UssdCallback

NameTypeRequiredDescription
sessionIdstringyes
phoneNumberstringyes
textstringno
serviceCodestringno
networkCodestringno

UssdSimulator

NameTypeRequiredDescription
session_idstringyes
phone_numberstringyes
textstringyes

TestNotification

NameTypeRequiredDescription
recipient_idstring (uuid)yes
recipient_kind"patient" | "staff"yes
channelsarray of "in_app" | "sms" | "email"yes

InboxItem

NameTypeRequiredDescription
idstring (uuid)yes
categorystringyes
titlestringyes
bodystringyes
language"en" | "fr"yesLanguage of title/body as returned.
textsobjectyesTitle/body per language: en and fr when the message has a template key, else only the stored language.
linkstring | nullno
readbooleanyes
read_atstring | null (date-time)no
created_atstring (date-time)yes
source_modulestring | nullno

get-api-ohn-v1-notifications-inbox.response-200 defined inline

NameTypeRequiredDescription
itemsarray of InboxItemyes
unreadintegeryes

post-api-ohn-v1-notifications-contacts-id-verify.response-422.option-2 defined inline

NameTypeRequiredDescription
error"wrong_code"yes
messagestringno
attempts_leftintegeryes

post-api-ohn-v1-notifications-ussd-simulator.response-200 defined inline

NameTypeRequiredDescription
replystringyes
kind"continue" | "end"yes
textstringyes

Preferences.channels defined inline

NameTypeRequiredDescription
in_apptrueyes
smsbooleanyes
emailbooleanyes

Preferences.quiet_hours.option-2 defined inline

NameTypeRequiredDescription
startintegeryes
endintegeryes