Skip to content
Engine API

Messages

Messages endpoints of the MedHook engine API: 21 operations with parameters, schemas and a curl example for each.

On this page

Inbound messages, as the Messages screen reads them.

List messages

get/api/messages

Executions of every trigger type (mllp, webhook, x12, fhir-subscription, polling, cron, schedule, manual, replay), newest first, with cursor paging. Each row may carry failure, the kind of failure of a failed or partly failed run (unreachable, timeout, auth, conflict, rate-limit, server, version, filter, data, uncertain, rejected), never the error text. A row may also carry destinations ([{ name, state }], state ok, failed or queued: the run's send steps by step name) and failedStep (the number the message's Steps tab gives the last failed step row: every step row counted from 1 in start order, retries and loop items included), read for the whole page from the steps' metadata, one row per step (G-messages-3); a count=1 read and the CSV export have neither. A row may also carry peer (#946): { address, tunnel, ambiguousTunnels? }, the sender's address as intake stored it (an MLLP listener's socket address; a webhook's client address through CLIENT_IP_SOURCE) and the { id, name, source? } of the tunnel whose most specific remote subnet holds it (source: "fortigate" for a tunnel on the customer's FortiGate, by the subnets the engine sees), tunnel: null when none does, or ambiguousTunnels when two or more hold it equally (none is picked); absent when intake stored no address (other trigger types, older listener images). Totals and the rate are GET /api/messages/stats. A row's status is its run's stored status, except filtered for a completed run whose every router destination filtered the message out (G-messages-1; clients that switch on the execution status see this new value), and the CSV status column reads the same. Rows carry only the patient's family name, given initial and MRN, as one patient label. PHI is masked by default (R38): the label reads D••• J••• · 48•••• until phi=reveal&reason= shows DOE, J · 483920 (audited as phi.revealed); a count=1 read has no patient and is never a reveal. control:, an exact correlation:, mrn:, sender:, the type filter, body: and HL7 field terms (once the body index is built) pick their candidates through indexes over the whole window; the query language then runs in memory over at most 2,000 rows per request: when it stops there before filling the page, scanCapped is true and nextCursor continues the search. A lone id-shaped bare term is also looked up as control: on the first page. With count=1 it returns only { total: { count, complete, scanned } }: the matches over the whole window, exact when complete, else a lower bound after 10,000 rows. A search that runs past MESSAGE_SEARCH_TIMEOUT_MS (default 20 s) answers 503 SEARCH_TIMEOUT. A search that reads message bodies is audited with the field names used, never the values. Viewers never see message content (G32): their rows have patient: null, and a search with free text or any HL7 field is refused with 403 PHI_SEARCH_FORBIDDEN (they may search control, correlation, type, workflow, status, ack and source). A query that can carry a patient (a field of PID, PD1, NK1, GT1, IN1 or IN2, such as PID.3, PID.5, PID.7 and PID.11, or mrn:, body:, json: or free text) is a 400 PATIENT_SEARCH_IN_URL ("Send patient searches in the request body"), whatever the role: send it to POST /api/messages/search, so it never reaches access logs, browser history or a Referer.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: listMessages

Parameters

NameInTypeDescription
qquerystring

A query in the message query language. Top-level since:15m (m, h or d, at most 90 days; once, outside OR, NOT and parentheses), workflow:"<name>", type:, ack: and status:failed|queued|delivered|filtered terms narrow the search like the matching parameters (delivered is a completed run not filtered out; filtered a completed run whose every router destination filtered the message out, and its row status reads filtered; the stored status:completed matches both); since: wins over the since parameter and is a 400 with from/to. correlation:<id> (also corr:) finds a run by its correlation id: the inbound X-Request-Id, the Idempotency-Key (or X-Idempotency-Key, Webhook-Id) or the execution id, the id an outbound REST call carries in its correlation header; viewers may search it. json:$.a.b:<value or glob> matches a field of a JSON message body ($, then .name and [n] steps, at most 16; a name step over an array applies to each element); it reads message content, so it is PHI-gated like body: and goes in the body of POST /api/messages/search. peer:<name or address> matches the healthcare organization a message came from (#946): the name of the Cloud VPN or tracked FortiGate tunnel whose most specific subnet holds the sender address, or that address itself (a glob); a message two tunnels hold equally matches either name. It is evaluated in memory, like source:, and viewers may search it.

workflowIdquerystring

Only this workflow.

typequerystring

Message type, for example ADT^A01.

sincequeryinteger

Only the last N minutes (at most 90 days). Not with from/to.

fromquerystring (date-time)

Start of an absolute range on the received time (ISO-8601 date-time with an offset or Z). Not with since. No length cap: retention is the bound.

toquerystring (date-time)

End of the range (ISO-8601 date-time). Must not be before from or more than 5 minutes in the future.

ackquerystring

ACK code.

triggerTypequerystring

Comma list of source trigger types: mllp, webhook, x12, fhir-subscription, polling, cron, schedule, manual, replay. Unknown types are a 400.

cursorquerystring

From nextCursor of the previous page.

limitqueryinteger

Rows per page, 1 to 200.

countquerystring

Set to 1 for the match count over the window only.

formatquerystring

Set to csv to download the search as CSV, the export POST /api/messages/export answers (cursor and limit are ignored, no control: lookup is added). Columns time,id,type,workflow,status,ack,result (operational only: no patient, MRN or message content for any role, and phi=reveal adds none; result is the Stream's Result sentence, PHI-masked). Read from the newest message in pages of 1,000; above 50,000 matches (or 250,000 rows read) it is a 413 EXPORT_TOO_LARGE, "Exports stop at 50,000 messages. Narrow the search." X-Export-Rows is the row count. Audited as message.export with the count, the field names used and a keyed hash of the query, never the query. Its own rate limit, 10 requests a minute, shared by every CSV export. Any other value is a 400.

phiquerystring

reveal to get PHI unmasked. Operators and admins only (a viewer gets 403 PHI_REVEAL_FORBIDDEN); needs reason. The read is audited as phi.revealed with the reason and a keyed hash per patient, never a value.

reasonquerystring

Why PHI is shown, with phi=reveal. Anything else is a 400.

grantquerystring

With phi=reveal: the id of the caller's open reveal window (POST /api/phi/reveal-grant), used instead of asking for a reason on each view. Checked on every request: a window that ended, expired, or belongs to someone else or another workspace is 403 PHI_REVEAL_GRANT_ENDED and nothing is shown. The read is audited as phi.revealed with the window's reason and grantId.

Responses

  • 200A page of messages.
    Response fields

    application/json · object

    • messagesarray of object
    • nextCursorstring | null
    • scannedinteger

      Rows read in memory for this page.

    • scanCappedboolean

      The search stopped at its 2,000-row scan cap before filling the page; continue with nextCursor.

    • jsonParseBudgetExhaustedboolean

      A json: term read as much JSON text as one request may (32 MiB, each row's JSON counted once). The page stopped before the row it could not read; nextCursor continues there. Narrow the search.

    • remediationstring

      With jsonParseBudgetExhausted: how to narrow the search.

    • readAtstring (date-time)

      The server time just before the read (ISO-8601). Open GET /api/messages/stream?after= with it so messages that arrive meanwhile are streamed.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages" \
  -H "Authorization: Bearer $TOKEN"

Get one message

get/api/messages/{id}

One message for the inspector: message, raw, format, segments, output, outputFormat, trace, steps (metadata only), notRun, error and tunnel. notRun lists the workflow's steps a failed or filtered run never reached ([{ nodeId, nodeName }], downstream of the failed step or of the routers that filtered it, at most 100; empty otherwise), read from the version a run that waited ran on, else the workflow's current deployed version, else its live save (a run records no version otherwise, so after a redeploy an older run reads the current graph), for the Trace tab's not run rows. output is what the workflow produced: its FHIR (outputFormat: fhir), else the last completed transform step's output (json, hl7v2, x12, xml or text), else null. It contains the full message body (PHI), so every read is audited as message.viewed with the control id, type and workflow, and for a masked view the keyed hash of the patient's MRN (never the MRN) so the PHI access tab finds the view (a reveal's phi.revealed row carries it instead). context=ack_queue_replay (the ACK queue's Edit & replay) is kept on those records as the reason the message was opened; any other context is a 400. calls lists the runs its Call workflow steps started (childExecutionId, workflowId, workflowName, nodeName, mode; ids and names only). With part=step&step={id} it returns one step of the Steps tab as { step }: its input, output, error, console logs, mapping warnings, a JS step's channel map (vars) and global map writes (globalOps) when it made any, and for a step that failed on an API call apiResponse (status, method, host, headers limited to content-type, retry-after and request ids, body up to 8 KB, bodyBytes, truncated; the body is masked while PHI is masked); a viewer gets the name, status, timing, warnings and apiResponse without its body (body: null, bodyWithheld: true) only. With part=attempts it returns only { attempts }: whether a retry or replay is running or scheduled. That form has no message body and is not audited. With part=outcome it returns only { outcome }: what the message's run came to, for the replay modal (status, done, filtered, failedStep as { stepId, nodeName } or null, and answer, the HTTP status or ACK code the destination answered the failed step with, or null). No body, path, header or error text, so it is not audited; the replay modal polls it until done. With part=meta it returns metadata only, the same for every role: message (with patient null), format, segments (segment codes, at most 200, never field values), segmentCount, outputFormat, error and tunnel; audited as message.viewed with part: meta. The assistant's get_message reads this form. With part=exists it returns only { exists: true } (404 when the message is not in this workspace): it reads nothing of the message, so it is not a view and is not audited; the assistant checks the side panel's selected message with it on every turn. PHI is masked by default (R38): an operator gets the patient label, raw, the segment cards, output, trace text and error masked (names keep their initials, ids their first two characters, dates become ••••-••-••, the sex (PID.8) •, other PHI •••) with phiMasked: true, audited with masked: true; phi=reveal&reason= returns them as stored and also writes phi.revealed. The same applies to part=step (console lines are withheld while masked: logs: [] and logsWithheld) and part=deliveries (path, bodies and errors masked). A viewer gets the message without content (G32): raw is empty, segments is empty, output and outputFormat are null, trace lines keep their tag but no text, message.patient is null and redacted is true; the read is audited with redacted: true. part=step and part=deliveries reads are audited the same way: an operator's masked read names the patient's keyed hash, a viewer's names none.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getMessage

Parameters

NameInTypeDescription
idrequiredpathstring

Message (execution) id.

partquerystring

attempts for the attempts only, outcome for what the run came to (status, failed step, the destination's answer; no content), meta for metadata without content, exists for whether the message is in this workspace, step (with step) for one step's input and output, deliveries for what each send step sent (each step with startedAt, completedAt and, for an object storage write such as GCS, S3 or SFTP, kind: storage; a storage write is listed even when nothing was recorded, and so is a send step that did not complete; a send step that failed and was skipped by onError: skip is listed with skippedFailure: true, never its error text). The detail's notRun lists the steps a failed or filtered run never reached (names only).

stepquerystring

With part=step: the step (node result) id.

contextquerystring

The screen opening the message, kept on its audit record as the reason: ack_queue_replay.

phiquerystring

reveal to get PHI unmasked. Operators and admins only (a viewer gets 403 PHI_REVEAL_FORBIDDEN); needs reason. The read is audited as phi.revealed with the reason and a keyed hash per patient, never a value.

reasonquerystring

Why PHI is shown, with phi=reveal. Anything else is a 400.

grantquerystring

With phi=reveal: the id of the caller's open reveal window (POST /api/phi/reveal-grant), used instead of asking for a reason on each view. Checked on every request: a window that ended, expired, or belongs to someone else or another workspace is 403 PHI_REVEAL_GRANT_ENDED and nothing is shown. The read is audited as phi.revealed with the window's reason and grantId.

Responses

  • 200The message.

    application/json · object

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages/<id>" \
  -H "Authorization: Bearer $TOKEN"

Reprocess a message search

post/api/messages/reprocess

Replays every message the search matches (query: the GET /api/messages filters), through its own workflow or through targetWorkflowId. First call with dryRun: true: it returns the count, the cap (max, BULK_REPROCESS_MAX, default 1000) and the search pinned in time (query: a relative since becomes from/to, an open search is closed at now). Then send that query back with confirmCount; a different count now is a 409 COUNT_CHANGED, more than the cap a 400 TOO_MANY. The replays are queued as work items and run at the engine's normal concurrency. A message that is still running, or whose stored content could not be decrypted, is skipped and listed in skipped (never sent). overwrite: true marks each original reprocessed and links it to its replacement; a later bulk reprocess leaves those originals out. Operators and admins only, one at a time per workspace, rate limited, audited once as message.bulk_reprocessed with counts and the query's field names, never the searched values.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: reprocessMessages

Request body (required)

application/json · object

  • queryobject
  • dryRunboolean
  • confirmCountinteger
  • targetWorkflowIdstring
  • overwriteboolean

Responses

  • 200The preview (`dryRun`) or the run.
    Response fields

    application/json · object

    • countinteger
    • maxinteger
    • overCapboolean
    • completeboolean
    • queryobject
    • matchedinteger
    • queuedinteger
    • overwritteninteger
    • undecryptableinteger
    • skippedarray of object
      2 fields
      • idstring
      • codestring
    • executionsarray of object
      2 fields
      • originalIdstring
      • executionIdstring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/messages/reprocess" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "query": {},
  "dryRun": true,
  "confirmCount": 0,
  "targetWorkflowId": "string",
  "overwrite": true
}'

Stream messages

get/api/messages/stream

Server-Sent Events of message summaries, with the same filters as GET /api/messages. It sends event: message for each message received or finished, event: watermark ({ at }) when the time it has read up to moves, and a comment heartbeat every 15 seconds (totals and the rate are GET /api/messages/stats). A message that was running is sent again when its ACK is known, so upsert by id. Opening streams is rate limited per client. Viewers get rows without the patient and cannot stream a search on message content (403 PHI_SEARCH_FORBIDDEN), as in GET /api/messages. PHI is masked by default (R38): operators get the masked patient label unless the stream opens with phi=reveal&reason=, audited once as phi.revealed when it opens. A query that can carry a patient (a field of PID, PD1, NK1, GT1, IN1 or IN2, such as PID.3, PID.5, PID.7 and PID.11, or mrn:, body:, json: or free text) is a 400 PATIENT_SEARCH_IN_URL ("Send patient searches in the request body"), whatever the role: send it to POST /api/messages/search, so it never reaches access logs, browser history or a Referer.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: streamMessages

Parameters

NameInTypeDescription
qquerystring

A query in the message query language. Top-level since:15m (m, h or d, at most 90 days; once, outside OR, NOT and parentheses), workflow:"<name>", type:, ack: and status:failed|queued|delivered|filtered terms narrow the search like the matching parameters (delivered is a completed run not filtered out; filtered a completed run whose every router destination filtered the message out, and its row status reads filtered; the stored status:completed matches both); since: wins over the since parameter and is a 400 with from/to. correlation:<id> (also corr:) finds a run by its correlation id: the inbound X-Request-Id, the Idempotency-Key (or X-Idempotency-Key, Webhook-Id) or the execution id, the id an outbound REST call carries in its correlation header; viewers may search it. json:$.a.b:<value or glob> matches a field of a JSON message body ($, then .name and [n] steps, at most 16; a name step over an array applies to each element); it reads message content, so it is PHI-gated like body: and goes in the body of POST /api/messages/search. peer:<name or address> matches the healthcare organization a message came from (#946): the name of the Cloud VPN or tracked FortiGate tunnel whose most specific subnet holds the sender address, or that address itself (a glob); a message two tunnels hold equally matches either name. It is evaluated in memory, like source:, and viewers may search it.

workflowIdquerystring

Only this workflow.

typequerystring

Message type.

fromquerystring (date-time)

Start of an absolute range on the received time (ISO-8601 date-time with an offset or Z). Not with since. No length cap: retention is the bound.

toquerystring (date-time)

End of the range (ISO-8601 date-time). Must not be before from or more than 5 minutes in the future.

triggerTypequerystring

Comma list of source trigger types: mllp, webhook, x12, fhir-subscription, polling, cron, schedule, manual, replay. Unknown types are a 400.

phiquerystring

reveal to get PHI unmasked. Operators and admins only (a viewer gets 403 PHI_REVEAL_FORBIDDEN); needs reason. The read is audited as phi.revealed with the reason and a keyed hash per patient, never a value.

reasonquerystring

Why PHI is shown, with phi=reveal. Anything else is a 400.

grantquerystring

With phi=reveal: the id of the caller's open reveal window (POST /api/phi/reveal-grant), used instead of asking for a reason on each view. Checked on every request: a window that ended, expired, or belongs to someone else or another workspace is 403 PHI_REVEAL_GRANT_ENDED and nothing is shown. The read is audited as phi.revealed with the window's reason and grantId.

samplequeryinteger

Send about 1 message in N, picked by a hash of the message id (the same messages each time, so an ACK update follows its message). 1 to 1000, default 1 (every message). The Messages page asks for 50 once traffic reaches 2 messages a second. Search always reads every message.

messagequerystring

A message id that is always sent, inside the sample or not (a deep link to one message).

afterquerystring (date-time)

Start the stream here instead of now (ISO-8601 date-time): the readAt of the GET /api/messages page, or the last event: watermark of a stream being reopened. At most 5 minutes back; a later time starts now. Rows already shown may be sent again: upsert by id.

Responses

  • 200An event stream.

    text/event-stream · string

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages/stream" \
  -H "Authorization: Bearer $TOKEN"

Message totals and rate

get/api/messages/stats

The caller's workspace: inbound messages (retries included) received since 00:00 UTC, the rate over the last minute in messages a second, what needs action (the Messages nav badge's count, from the same list as GET /api/attention, reused for 10 seconds per workspace; null when it can't be read), and 40 buckets over the window with the failed runs in each. SQL aggregates over an index range; today's count is kept per engine replica and extended by the minutes since. Counts only, no message content. Rate limited to 120 requests per minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getMessageStats

Parameters

NameInTypeDescription
windowquerystring

The rate graph's window: 15m (default, 22.5 s buckets) or 1h (90 s buckets).

Responses

  • 200The totals and the buckets.
    Response fields

    application/json · object

    • windowstring

      One of: "15m", "1h"

    • bucketMsinteger

      Length of one bucket in milliseconds.

    • todayinteger

      Messages received since 00:00 UTC.

    • perSecondnumber

      Messages a second over the last minute, one decimal.

    • needActioninteger | null

      What needs action (GET /api/attention badges.messages, the Needs action groups' messages), or null.

    • bucketsarray of object
      3 fields
      • atstring (date-time)

        Bucket start.

      • totalinteger
      • failedinteger
    • generatedAtstring (date-time)
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages/stats" \
  -H "Authorization: Bearer $TOKEN"

Search messages

post/api/messages/search

Searches every message with the query in the body: the same search, rows, count and CSV export as GET /api/messages, which refuses a patient search in its URL (PATIENT_SEARCH_IN_URL). The Messages page sends every Enter here. phi=reveal&reason= stays a query parameter (a reason, never a value). Viewers may search but not message content (403 PHI_SEARCH_FORBIDDEN: they may search control, correlation, type, workflow, status, ack and source). A read: audited as message.searched with the field names used and, for a patient search, patientSearch and a keyed hash of an exact MRN (PID.3:483920, mrn:483920), never a value; an export as message.export. Rate limited at 120 requests a minute; an export shares the 10 a minute export limit.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: searchMessages

Parameters

NameInTypeDescription
phiquerystring

reveal to get the patient label unmasked. Operators and admins only (a viewer gets 403 PHI_REVEAL_FORBIDDEN); needs reason. Audited as phi.revealed with the reason and a keyed hash per patient.

reasonquerystring

Why PHI is shown, with phi=reveal.

Request body (required)

application/json · object

  • qstring

    A query in the message query language (at most 500 characters), as q on GET /api/messages: PID.5:DOE*, since:24h PID.3:483920, correlation:req-7f3a, json:$.patient.id:TP-0001.

  • cursorstring

    From nextCursor of the previous page.

  • limitinteger

    Rows per page, 1 to 200.

  • countboolean

    The match count over the window only.

  • formatstring

    csv to download the search as POST /api/messages/export does, with no patient column.

    One of: "csv"

Responses

  • 200A page of messages, `{ total }` with `count`, or the CSV with `format`.
    Response fields

    application/json · object

    • messagesarray of object
    • nextCursorstring | null
    • scannedinteger

      Rows read in memory for this page.

    • scanCappedboolean

      The search stopped at its 2,000-row scan cap before filling the page; continue with cursor.

    • jsonParseBudgetExhaustedboolean

      A json: term read as much JSON text as one request may (32 MiB). The page stopped before the row it could not read; continue with cursor, or narrow the search. An export that runs out answers 413 EXPORT_TOO_LARGE.

    • remediationstring

      With jsonParseBudgetExhausted: how to narrow the search.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/messages/search" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "q": "string",
  "cursor": "string",
  "limit": 50,
  "count": true,
  "format": "csv"
}'

List your saved searches

get/api/messages/saved-searches

The caller's own saved searches on Messages, oldest first, shown under the built-in presets of Saved searches. Saved searches belong to the caller and the workspace the request is verified for: nobody lists or deletes another person's, and each workspace has its own. The name and the query are encrypted at rest and never written to logs or the audit log. Not audited.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: listMessageSavedSearches

Responses

  • 200Your saved searches.
    Response fields

    application/json · object

    • searchesarray of object
      5 fields
      • idstring
      • namestring

        The label shown under the built-in presets.

      • querystring

        The message query it runs, as q on POST /api/messages/search.

      • phiboolean

        It searches message content (free text or an HL7 field): disabled for viewers.

      • createdAtstring (date-time)
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages/saved-searches" \
  -H "Authorization: Bearer $TOKEN"

Save a search

post/api/messages/saved-searches

Saves a search for the caller in the workspace. query must be a valid message search (at most 500 characters). Every role may save their own; a viewer can't save a search on message content (403 PHI_SEARCH_FORBIDDEN). Up to 25 per person per workspace (409 SAVED_SEARCH_LIMIT). Saved searches belong to the caller and the workspace the request is verified for: nobody lists or deletes another person's, and each workspace has its own. The name and the query are encrypted at rest and never written to logs or the audit log. Audited as saved_search.created with the field names the query uses and whether it reads content, never the name or the query. Rate limited at 30 requests a minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: createMessageSavedSearch

Request body (required)

application/json · object

  • namestringrequired

    1 to 60 characters.

  • querystringrequired

    A query in the message query language: type:ADT^* status:failed since:24h.

Responses

  • 201The saved search.
    Response fields

    application/json · object

    • searchobject
      5 fields
      • idstring
      • namestring

        The label shown under the built-in presets.

      • querystring

        The message query it runs, as q on POST /api/messages/search.

      • phiboolean

        It searches message content (free text or an HL7 field): disabled for viewers.

      • createdAtstring (date-time)
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/messages/saved-searches" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "query": "string"
}'

Delete a saved search

delete/api/messages/saved-searches

Deletes one of the caller's saved searches in the workspace; anyone else's is a 404. Saved searches belong to the caller and the workspace the request is verified for: nobody lists or deletes another person's, and each workspace has its own. The name and the query are encrypted at rest and never written to logs or the audit log. Audited as saved_search.deleted. Rate limited at 30 requests a minute.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: deleteMessageSavedSearch

Parameters

NameInTypeDescription
idrequiredquerystring

The saved search id.

Responses

  • 200Deleted.
    Response fields

    application/json · object

    • deletedboolean
    • idstring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X DELETE "$ENGINE_URL/api/messages/saved-searches?id=string" \
  -H "Authorization: Bearer $TOKEN"

Your PHI reveal window

get/api/phi/reveal-grant

The longest window the engine allows (maxMinutes, 0 = off), whether the caller may open one (canGrant: false for viewers and API clients) and their open window, or null. A window belongs to the signed-in person and the workspace the request is verified for; API clients name a reason on each request instead. Windows are off unless the engine sets PHI_REVEAL_WINDOW_MAX_MINUTES (Helm phi.revealWindowMaxMinutes) above 0. Reads no PHI; not audited.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getPhiRevealGrant

Responses

  • 200The caller's window state.
    Response fields

    application/json · object

    • maxMinutesinteger
    • canGrantboolean
    • grantobject
      5 fields
      • idstring

        Send it as grant with phi=reveal on a read.

      • reasonstring

        One of: "troubleshooting", "patient-request", "audit"

      • minutesinteger
      • startedAtstring (date-time)
      • expiresAtstring (date-time)
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/phi/reveal-grant" \
  -H "Authorization: Bearer $TOKEN"

Show PHI for the next few minutes

post/api/phi/reveal-grant

Opens a reveal window for minutes (1 to maxMinutes) with a reason, ending any window the caller already has. Reads that send phi=reveal&grant=<id> then show PHI until it expires or is ended, each checked on the server and audited as phi.revealed with grantId. Audited as phi.reveal_window_started (reason, minutes, expiry); if that record can't be written the window doesn't open (500 PHI_REVEAL_NOT_RECORDED). 409 PHI_REVEAL_WINDOW_OFF while windows are off; a viewer gets 403 PHI_REVEAL_FORBIDDEN. A window belongs to the signed-in person and the workspace the request is verified for; API clients name a reason on each request instead. Windows are off unless the engine sets PHI_REVEAL_WINDOW_MAX_MINUTES (Helm phi.revealWindowMaxMinutes) above 0.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: openPhiRevealGrant

Request body (required)

application/json · object

  • reasonstringrequired

    One of: "troubleshooting", "patient-request", "audit"

  • minutesintegerrequired

    1 to the engine's maxMinutes.

Responses

  • 201The open window.
    Response fields

    application/json · object

    • grantobject
      5 fields
      • idstring

        Send it as grant with phi=reveal on a read.

      • reasonstring

        One of: "troubleshooting", "patient-request", "audit"

      • minutesinteger
      • startedAtstring (date-time)
      • expiresAtstring (date-time)
    • maxMinutesinteger
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/phi/reveal-grant" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "troubleshooting",
  "minutes": 0
}'

Hide PHI now

delete/api/phi/reveal-grant

Ends the caller's open reveal window in this workspace (Hide now). Audited as phi.reveal_window_ended. ended is false when none was open. A window belongs to the signed-in person and the workspace the request is verified for; API clients name a reason on each request instead. Windows are off unless the engine sets PHI_REVEAL_WINDOW_MAX_MINUTES (Helm phi.revealWindowMaxMinutes) above 0.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: endPhiRevealGrant

Responses

  • 200Ended.
    Response fields

    application/json · object

    • endedboolean
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X DELETE "$ENGINE_URL/api/phi/reveal-grant" \
  -H "Authorization: Bearer $TOKEN"

Export messages as CSV

post/api/messages/export

Downloads a search as CSV (Messages › Export), with the query in the body so a patient term never sits in a URL. Columns time,id,type,workflow,status,ack,result (operational only: no patient, MRN or message content for any role, and phi=reveal adds none; result is the Stream's Result sentence, PHI-masked). Read from the newest message in pages of 1,000; above 50,000 matches (or 250,000 rows read) it is a 413 EXPORT_TOO_LARGE, "Exports stop at 50,000 messages. Narrow the search." X-Export-Rows is the row count. Audited as message.export with the count, the field names used and a keyed hash of the query, never the query. Its own rate limit, 10 requests a minute, shared by every CSV export. Viewers may export, but not search message content (403 PHI_SEARCH_FORBIDDEN).

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: exportMessages

Request body (required)

application/json · object

  • qstring

    A query in the message query language (at most 500 characters), as q on GET /api/messages: type:ADT^* status:failed since:15m. No other key.

Responses

  • 200The CSV, as an attachment (`messages-YYYYMMDD-HHmm.csv`).

    text/csv · string

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 413The body is larger than the limit.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/messages/export" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "q": "string"
}'

Versions a replay can run on

get/api/messages/replay

The workflow's live version (the deployed one, or the newest save when nothing was ever deployed) and the newest save when it is newer (draft, else null). Version numbers only.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getMessageReplayVersions

Parameters

NameInTypeDescription
workflowIdrequiredquerystring

The messages' workflow.

Responses

  • 200The versions.
    Response fields

    application/json · object

    • workflowIdstring
    • workflowNamestring
    • liveinteger
    • draftinteger | null
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages/replay?workflowId=string" \
  -H "Authorization: Bearer $TOKEN"

Dry-run or replay messages

post/api/messages/replay

Replays messages of one workflow. A dry run (dryRun: true) runs each message (at most 200, within a 20 s budget; checked says how many) through target.version without delivering or storing anything and answers how many would reach a destination (a run that does not fail and whose write-side adapter step produces its send), the change lines against the original run (PHI masked) and a token. A replay must send the token of a dry run of the same ids, version and edit, by the same person, within 15 minutes (409 DRY_RUN_REQUIRED), runs only on the live version (409 VERSION_NOT_LIVE) and is paced at rate messages a second. Over 1,000 messages a replay needs a second admin's approval: approvalId of an approved request (POST /api/messages/replay-approvals) for the same ids, version and rate, asked for by the caller, spent once after the intent is audited (403 APPROVAL_REQUIRED without one, 403 APPROVAL_MISMATCH for another selection, 404 for another workspace's); if the enqueue then fails with nothing queued the approval is put back, and if it fails part-way the queued replays are audited and the answer is 500 REPLAY_PARTIAL. edit (one message) replays an edited copy, linked to the original through replayOfExecutionId; an HL7 v2 edit (raw, fields) applies only to a message received as HL7 (400 EDIT_NOT_HL7 otherwise), a JSON edit (jsonFields, json) only to a message with a JSON body: a webhook's JSON body, a polled item or a FHIR subscription's resource (400 EDIT_NOT_JSON otherwise), and an edit holding more masked values (•••) than the stored message is 400 MASKED_INPUT. A field patch (edit.fields, G-messages-8) is applied to the stored message, so fields the operator didn't change, masked patient fields included, stay as received; a value still holding • keeps the stored value; a field the message lacks, MSH.1 or MSH.2 (the separators), a value with a segment or field separator, or a patch that changes nothing (every value still holding • or equal to the stored one) is 400 INVALID_EDIT. A JSON path patch (edit.jsonFields) works the same way on the stored body: a path it lacks, or one naming an object or list, or a patch that changes nothing, is 400 INVALID_EDIT; a whole-JSON edit (edit.json, made from the revealed message) may add or remove keys, and text that is not a JSON object or array is 400 INVALID_EDIT. The edited body replaces the one the run's input held, whole; the rest of the input (the trigger, a poll's polledAt, a webhook's headers) stays as stored, and a polled item's replay never moves the poll's cursor. Audited as message.replay_started (before anything is queued; 503 AUDIT_UNAVAILABLE if it cannot be written) and message.replayed, with the actor, the count, the version and the rate (and the changedFields of a field patch or any JSON edit: field names or paths only, the first 500, with changedFieldCount when there were more), never message content or a field's value.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: replayMessages

Request body (required)

application/json · object

  • idsarray of stringrequired
  • targetobjectrequired
    1 field
    • versionintegerrequired
  • rateinteger

    Messages a second.

    One of: 10, 50, 200

  • dryRunboolean

    Only run the dry run.

  • tokenstring

    The dry run's token (a replay).

  • approvalIdstring

    A second admin's approval (a replay of more than 1,000 messages).

  • editobject | object | object | object

    One message's edit. HL7 v2: the whole edited text (raw, made from the revealed message), or only the changed fields (fields, G-messages-8). JSON: only the changed values by path (jsonFields), or the whole edited body (json, made from the revealed message).

    4 fields
    • option 1object
      1 field
      • rawstringrequired

        The edited message.

    • option 2object
      1 field
      • fieldsobjectrequired

        Changed HL7 v2 fields by key (RXE.2, a repeated segment OBX[2].5, MSH shifted by one), 1 to 500, applied to the stored message; a value still holding • keeps the stored value.

    • option 3object
      1 field
      • jsonFieldsobjectrequired

        Changed JSON values by path (data.status, lines[1].qty, [0].id for an array body), 1 to 500, applied to the stored body; each path must name a string, number, true/false or null the body has. A value still holding • keeps the stored value.

    • option 4object
      1 field
      • jsonstringrequired

        The whole edited body as JSON text (an object or array); it may add or remove keys.

Responses

  • 200The dry run (`dryRun: true`). A replay answers 202 with `{ queued, executions: [{ originalId, executionId }], skipped: [{ id, code, error }], version, rate, loggedBy }`; `loggedBy` is the signed-in person's initials, from their name, else their email; an API client's from its name. A change line reads `Same failure at step N on vX` when the dry run fails at the step the original run failed on with the same error (ids and numbers aside); another error there is shown as it is.
    Response fields

    application/json · object

    • totalinteger
    • checkedinteger

      Messages the dry run ran (at most 200).

    • wouldDeliverinteger
    • changesarray of object
      2 fields
      • signstring

        + added, ~ changed, = unchanged or why it would not send.

        One of: "+", "~", "="

      • textstring

        One line; PHI values read •••.

    • tokenstring
    • approvalstring

      One of: "not-needed", "required"

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

  • 503A dependency is not available.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/messages/replay" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "ids": [
    "string"
  ],
  "target": {
    "version": 1
  },
  "rate": 10,
  "dryRun": true,
  "token": "string",
  "approvalId": "string",
  "edit": {
    "raw": "string"
  }
}'

Ask a second admin to approve a replay

post/api/messages/replay-approvals

A replay of more than 1,000 messages needs a second admin's approval. Ask for it after the dry run: token is that dry run's, for the same ids and version, by the same person (409 DRY_RUN_REQUIRED). 1,000 or fewer need none (400 APPROVAL_NOT_NEEDED); approvals need named, signed-in people (403 APPROVAL_NEEDS_NAMES). The request expires after 24 h and shows in Needs you (GET /api/attention, kind approval): a waiting one for the admins who may approve it, an approved one for its requester. One open request per replay: when the caller already has a waiting or approved, unexpired request for the same ids, version and rate, the answer is 200 with that request and nothing is created. Audited as message.replay.approval_requested with the actor, the count, the version and the rate, never the ids or message content.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: requestMessageReplayApproval

Request body (required)

application/json · object

  • idsarray of stringrequired

    Over 1,000 ids. The validator accepts 1 to 10,000 and answers 400 APPROVAL_NOT_NEEDED for 1,000 or fewer.

  • versionIdintegerrequired

    The version the replay runs on.

  • rateintegerrequired

    Messages a second.

    One of: 10, 50, 200

  • tokenstringrequired

    The dry run's token.

Responses

  • 201The new request (200: the caller's open request for the same replay).
    Response fields

    application/json · object

    • idstring
    • statusstring

      requested waits for a second admin; approved lets the requester replay once; used after that replay; expired 24 h after the request.

      One of: "requested", "approved", "used", "expired"

    • workflowIdstring
    • countinteger

      Messages the replay covers (over 1,000).

    • versioninteger

      The version the replay runs on.

    • rateinteger

      Messages a second.

      One of: 10, 50, 200

    • idsarray of string

      The message (execution) ids.

    • requestedBystring | null

      Who asked, by name when the engine has one.

    • approvedBystring | null

      Who approved, by name when the engine has one.

    • requestedAtstring (date-time)
    • approvedAtstring (date-time) | null
    • expiresAtstring (date-time)
    • mineboolean

      The caller asked for it (and replays once it is approved).

    • canApproveboolean

      The caller may approve it: a signed-in admin other than the requester, while it waits.

    • approveBlockedstring | null

      Why the caller can't approve, while it waits.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/messages/replay-approvals" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "ids": [
    "string"
  ],
  "versionId": 1,
  "rate": 10,
  "token": "string"
}'

A replay approval request

get/api/messages/replay-approvals/{id}

One request for a second admin's approval, in the caller's workspace (404 otherwise): its state, the selection, who asked and approved, and what the caller may do. Ids and counts only. fields=status (the requester's poll while it waits) answers without ids and requestedBy.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getMessageReplayApproval

Parameters

NameInTypeDescription
idrequiredpathstring

The approval request id.

fieldsquerystring

status: the state only, without the ids.

Responses

  • 200The request.
    Response fields

    application/json · object

    • idstring
    • statusstring

      requested waits for a second admin; approved lets the requester replay once; used after that replay; expired 24 h after the request.

      One of: "requested", "approved", "used", "expired"

    • workflowIdstring
    • countinteger

      Messages the replay covers (over 1,000).

    • versioninteger

      The version the replay runs on.

    • rateinteger

      Messages a second.

      One of: 10, 50, 200

    • idsarray of string

      The message (execution) ids.

    • requestedBystring | null

      Who asked, by name when the engine has one.

    • approvedBystring | null

      Who approved, by name when the engine has one.

    • requestedAtstring (date-time)
    • approvedAtstring (date-time) | null
    • expiresAtstring (date-time)
    • mineboolean

      The caller asked for it (and replays once it is approved).

    • canApproveboolean

      The caller may approve it: a signed-in admin other than the requester, while it waits.

    • approveBlockedstring | null

      Why the caller can't approve, while it waits.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages/replay-approvals/<id>" \
  -H "Authorization: Bearer $TOKEN"

Approve a replay over 1,000 messages

post/api/messages/replay-approvals/{id}/approve

A signed-in admin other than the requester approves the replay; it replays nothing (the requester replays, once, with approvalId). The requester is 403 SELF_APPROVAL; another workspace's request 404; one that is approved, used or expired 409 APPROVAL_NOT_PENDING. Audited as message.replay.approved with the approver, the requester, the count, the version and the rate.

Minimum role: admin.

Auth: Bearer token (how to get one) · Operation: approveMessageReplay

Parameters

NameInTypeDescription
idrequiredpathstring

The approval request id.

Responses

  • 200The approved request.
    Response fields

    application/json · object

    • idstring
    • statusstring

      requested waits for a second admin; approved lets the requester replay once; used after that replay; expired 24 h after the request.

      One of: "requested", "approved", "used", "expired"

    • workflowIdstring
    • countinteger

      Messages the replay covers (over 1,000).

    • versioninteger

      The version the replay runs on.

    • rateinteger

      Messages a second.

      One of: 10, 50, 200

    • idsarray of string

      The message (execution) ids.

    • requestedBystring | null

      Who asked, by name when the engine has one.

    • approvedBystring | null

      Who approved, by name when the engine has one.

    • requestedAtstring (date-time)
    • approvedAtstring (date-time) | null
    • expiresAtstring (date-time)
    • mineboolean

      The caller asked for it (and replays once it is approved).

    • canApproveboolean

      The caller may approve it: a signed-in admin other than the requester, while it waits.

    • approveBlockedstring | null

      Why the caller can't approve, while it waits.

  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 409The request conflicts with the current state.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl -X POST "$ENGINE_URL/api/messages/replay-approvals/<id>/approve" \
  -H "Authorization: Bearer $TOKEN"

Needs action, grouped by cause

get/api/messages/groups

The workspace's failed messages of the last 7 days (the ACK queue's, discarded ones left out), grouped by workflow and error signature (digits, ids and host:port stripped), plus each open or probing destination queue with messages waiting as one queued-retrying group of its depth. A credential refusal (401/403) is error-auth, with the workflow's paused queue in lane when there is one; any other paused queue with messages waiting is a queued-paused group. Largest first, at most 50 groups, each listing at most 50 messages (a queue: its first 5, in lane order). Each group carries what the Agent · cause and fix card needs, so the client builds its deterministic text and actions with no other request: fixVersion, adapterProfileId/adapterProfileName, a queue's target and tunnel, and the lane's pausedAt. Titles, details and fixes have the messages' patient values masked; no message content. Not audited (read-only, no content).

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: listMessageGroups

Responses

  • 200The groups.
    Response fields

    application/json · object

    • groupsarray of object
      22 fields
      • keystring

        Stable: lane:<lane> or sig:<workflow>:<kind>:<hash>.

      • kindstring

        One of: "queued-retrying", "queued-paused", "ae-rejected", "ar-rejected", "error-auth"

      • kindLabelstring

        Queued · retrying, Queued · paused, AE · rejected, AR · rejected, Error · auth.

      • tonestring

        One of: "warn", "err"

      • titlestring

        The newest error, patient values masked •••.

      • workflowIdstring
      • workflowNamestring
      • countinteger
      • firstAtstring (date-time) | null
      • lastAtstring (date-time) | null
      • messagesarray of object
        6 fields
        • idstring

          The ACK queue id (first delivery), or the queued row.

        • executionIdstring

          The newest attempt (what a replay acts on).

        • controlIdstring
        • typestring
        • atstring (date-time)
        • detailstring

          Type, state and tries; no values.

      • moreinteger

        How many more the group holds than it lists.

      • fixstring | null

        The suggested fix, patient values masked.

      • diagnoseIdstring | null

        The message /diagnosis explains the group by.

      • laneobject | null
        5 fields
        • lanestring
        • labelstring

          The destination's name.

        • statestring

          One of: "open", "half-open", "paused"

        • nextProbeAtstring (date-time) | null
        • pausedAtstring (date-time) | null

          When a person paused the queue.

      • replayableboolean

        False for a queue group: it delivers on its own.

      • stepstring | null

        The failing step's name; null for a queue.

      • fixVersioninteger | null

        AE: the workflow's draft (newest save, newer than the deployed version) whose content was saved after the first failure (dated by its newest version snapshot), the version Dry run {n} on v{n} opens the replay modal on; else null.

      • adapterProfileIdstring | null

        Auth: the failing step's adapter profile in this workspace; else null.

      • adapterProfileNamestring | null
      • targetstring | null

        A queue: the host:port its errors name; else null.

      • tunnelobject | null
        2 fields
        • namestring
        • upboolean

          The tunnel is healthy.

    • needActioninteger

      What needs action: every group's messages, not only the 50 listed. The same count as GET /api/attention badges.messages and the Messages header (G-messages-11).

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages/groups" \
  -H "Authorization: Bearer $TOKEN"

Why a message failed (Agent · cause and fix)

get/api/messages/{id}/diagnosis

The troubleshooting autopilot's deterministic diagnosis of one failed message (no model, so it works with AI off): its class, the cause, the kind of fix and the profile or tunnel it names. Message content is withheld: no error text or values. Read-only and not audited; another workspace's message is 404.

Minimum role: viewer.

Auth: Bearer token (how to get one) · Operation: getMessageDiagnosis

Parameters

NameInTypeDescription
idrequiredpathstring

The message (execution) id.

Responses

  • 200The diagnosis.
    Response fields

    application/json · object

    • classstring

      One of: "data", "mapping", "destination", "auth", "tunnel", "config", "unknown"

    • causestring
    • fixstring | null

      One of: "mapping", "code-table", "profile", "wait"

    • profileobject | null
      2 fields
      • idstring
      • namestring
    • tunnelobject | null
      2 fields
      • idstring
      • namestring
  • 400The request is malformed or fails validation.

    application/json · ApiError

  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 404Not found in the caller's workspace.

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/messages/<id>/diagnosis" \
  -H "Authorization: Bearer $TOKEN"

Live MLLP connections

get/api/mllp/connections

Who is connected right now. For each MLLP listener a workflow of this workspace listens on: every connected peer across the listener pods (address, the tunnel whose remote subnets hold it, connected since, last frame received and sent, frames and bytes in the last 5 and 15 minutes, last ACK code, idle time) and the last 10 closed connections. For each MLLP destination (adapter profile) of this workspace: its pooled connections (open, in use, idle, waiting) summed over engine processes, traffic and the last connect error's class. Built from snapshots each process writes every 5 s; source is local (with a note) when Redis is unreachable and only this engine process's view is shown. Addresses, times, counts and ACK codes only, never message content. Rate limited: 120 req / 60 s.

Minimum role: operator.

Auth: Bearer token (how to get one) · Operation: listMllpConnections

Responses

  • 200The connections.
    Response fields

    application/json · object

    • generatedAtinteger

      Epoch milliseconds.

    • sourcestring

      One of: "redis", "local"

    • notestring | null
    • listenersarray of object
      10 fields
      • namestring

        The listener's name (Helm mllp.listeners).

      • portinteger
      • tlsboolean
      • framingstring

        mllp, frame or eos.

      • workflowsarray of object
        2 fields
        • idstring
        • namestring
      • processesinteger

        Listener pods reporting it; 0 when none is.

      • connectionsinteger

        Open connections over every pod.

      • connectionsRefusedinteger

        Connections refused at maxConnections.

      • peersarray of object
        15 fields
        • addressstring

          The peer's IP address.

        • portinteger | null

          The peer's source port.

        • instancestring

          The listener pod holding the connection.

        • tunnelobject | null
          2 fields
          • idstring
          • namestring
        • connectedAtinteger

          Epoch milliseconds.

        • closedAtinteger

          Recently closed connections only. Epoch milliseconds.

        • idleMsinteger

          Since the last frame either way, or the connect.

        • lastReceivedAtinteger | null

          The last frame received. Epoch milliseconds.

        • lastSentAtinteger | null

          The last frame sent. Epoch milliseconds.

        • lastAckstring | null

          The last ACK code (MSA-1, or the raw TCP code), e.g. AA.

        • lastAckAtinteger | null

          When that ACK was sent or read. Epoch milliseconds.

        • received5mobject
          2 fields
          • framesinteger
          • bytesinteger
        • received15mobject
          2 fields
          • framesinteger
          • bytesinteger
        • sent5mobject
          2 fields
          • framesinteger
          • bytesinteger
        • sent15mobject
          2 fields
          • framesinteger
          • bytesinteger
      • recentlyClosedarray of object

        Up to 10 per listener, newest first.

        15 fields
        • addressstring

          The peer's IP address.

        • portinteger | null

          The peer's source port.

        • instancestring

          The listener pod holding the connection.

        • tunnelobject | null
          2 fields
          • idstring
          • namestring
        • connectedAtinteger

          Epoch milliseconds.

        • closedAtinteger

          Recently closed connections only. Epoch milliseconds.

        • idleMsinteger

          Since the last frame either way, or the connect.

        • lastReceivedAtinteger | null

          The last frame received. Epoch milliseconds.

        • lastSentAtinteger | null

          The last frame sent. Epoch milliseconds.

        • lastAckstring | null

          The last ACK code (MSA-1, or the raw TCP code), e.g. AA.

        • lastAckAtinteger | null

          When that ACK was sent or read. Epoch milliseconds.

        • received5mobject
          2 fields
          • framesinteger
          • bytesinteger
        • received15mobject
          2 fields
          • framesinteger
          • bytesinteger
        • sent5mobject
          2 fields
          • framesinteger
          • bytesinteger
        • sent15mobject
          2 fields
          • framesinteger
          • bytesinteger
    • destinationsarray of object
      19 fields
      • profileIdstring
      • namestring

        The adapter profile's name.

      • hoststring
      • portinteger
      • tlsboolean
      • framingstring
      • tunnelobject | null
        2 fields
        • idstring
        • namestring
      • processesinteger

        Engine processes holding state for it.

      • poolobject
        4 fields
        • openinteger
        • inUseinteger
        • idleinteger
        • waitinginteger

          Sends waiting for a connection.

      • lastConnectErrorobject | null
        2 fields
        • kindstring

          One of: "refused", "timeout", "unreachable", "dns", "reset", "tls", "blocked", "pool-busy", "other"

        • atinteger

          Epoch milliseconds.

      • idleMsinteger | null
      • lastReceivedAtinteger | null

        The last frame received. Epoch milliseconds.

      • lastSentAtinteger | null

        The last frame sent. Epoch milliseconds.

      • lastAckstring | null

        The last ACK code (MSA-1, or the raw TCP code), e.g. AA.

      • lastAckAtinteger | null

        When that ACK was sent or read. Epoch milliseconds.

      • received5mobject
        2 fields
        • framesinteger
        • bytesinteger
      • received15mobject
        2 fields
        • framesinteger
        • bytesinteger
      • sent5mobject
        2 fields
        • framesinteger
        • bytesinteger
      • sent15mobject
        2 fields
        • framesinteger
        • bytesinteger
  • 401No credential, or the token is invalid or expired.

    application/json · ApiError

  • 403The caller's role, license or network address does not allow this. A signed-in person who is not a member of the requested workspace gets code `WORKSPACE_FORBIDDEN`; a viewer asking for message content gets `PHI_FORBIDDEN` (or `PHI_SEARCH_FORBIDDEN` for a search on message content).

    application/json · ApiError

  • 429Rate limit exceeded (see the `Retry-After` header), or on the AI routes the daily AI budget is used up.

    application/json · ApiError

  • 500Unexpected server error.

    application/json · ApiError

Example request

curl
curl "$ENGINE_URL/api/mllp/connections" \
  -H "Authorization: Bearer $TOKEN"

Schemas

Named objects the operations above link to.

ApiError

The error body. error is always present. code is present on most errors and is the field to branch on; a few routes and the sign-in and role checks return only error (and sometimes detail).

  • errorstringrequired

    Human-readable error message.

  • codestring

    Machine-readable error code.

    One of: "BAD_REQUEST", "INVALID_REQUEST", "UNAUTHORIZED", "UNAUTHENTICATED", "FORBIDDEN", "NOT_FOUND", "CONFLICT", "UNPROCESSABLE_ENTITY", "RATE_LIMITED", "INTERNAL_ERROR", "SERVICE_UNAVAILABLE", "NOT_CONFIGURED", "SIGNATURE_REQUIRED", "INVALID_SIGNATURE", "TIMESTAMP_REQUIRED", "TIMESTAMP_INVALID", "TIMESTAMP_OUT_OF_TOLERANCE", "INVALID_CREDENTIALS", "INVALID_TOKEN", "PAYLOAD_TOO_LARGE", "INVALID_NDJSON", "PHI_NOT_AUTHORIZED", "PHI_IN_SANDBOX", "IN_PROGRESS", "RETRY_SCHEDULED", "WORKFLOW_DISABLED", "CONFLICTING_SCOPE", "ALREADY_DELIVERED", "CHAIN_TOO_DEEP", "NO_FAILED_DESTINATION", "STALE_SCOPE", "UNKNOWN_DESTINATION", "NO_DESTINATIONS", "NOT_A_MESSAGE", "AI_FEATURES_DISABLED"

  • detailsany

    Optional structured context about the error.