Build a patient message (HL7 or JSON) and deliver it over URL or TCP/IP

Build the outbound message for a patient event and deliver it. The wire protocol is chosen by ``integration_configs.protocol``: - ``HL7`` builds the ADT message, applies HL7 ``rule_templates``, and delivers the rendered message; - ``JSON`` serialises the canonical event, applies JSON ``rule_templates``, strips transport/rules metadata, and delivers the resulting payload. Any other protocol (or a missing protocol) is rejected with a 422. Delivery mode follows ``configuration_data.connection_type``: an ``ENDPOINT_URL`` template is sent over HTTP to ``endpoint_url``; a ``TCP/IP`` template over a plain TCP socket to ``host``/``port``. Fire-and-forget (no ACK is awaited beyond an HTTP status check). Raises 422 when the payload is invalid or no transport is configured, and 502 when the receiver cannot be reached.

Authentication

AuthorizationBearer

Static shared-secret token for internal service-to-service calls.

Request

This endpoint expects an object.
event_typeenumRequired
Type of patient lifecycle event
event_timestampdatetimeRequired

UTC timestamp when the event occurred (ISO 8601)

event_idintegerRequired
Unique monotonic event identifier
patientobjectRequired
Full patient record
organization_detailsobject or nullOptional

Organisation context (absent when the event has no org)

referral_detailsobject or nullOptional

Referral source context (absent when there is no referral)

laboratory_informationobject or nullOptional

Laboratory context (absent when not supplied)

rule_templateslist of objectsOptional

Rule templates attached to the event (applied downstream)

integration_configsobject or nullOptional
Integration configuration used to build the outbound message
integration_payloadmap from strings to any or nullOptional

Transport/logging metadata (log_id, lab_id, callback context). Not part of the canonical event; forwarded to the delivery layer so the Fusion worker receives full context / the Mirth receiver gets LABID/LOGID segments.

Response

Successful Response
DeliverHl7Responseobject

Successful HL7 delivery: transport outcome plus the message that was sent.

OR
DeliverJsonResponseobject

Successful JSON delivery: transport outcome plus the payload that was sent.

Errors

422
Unprocessable Entity Error