Executions and replay
Execution statuses, how replay chooses destinations, the codes a replay can be refused with, and how credential headers are masked.
On this page
An execution is one run of a workflow. Every message a trigger accepts, and every manual run, creates one. You can list executions, read one, stream its progress, cancel it while it runs, and replay it after it finishes.
In the engine UI, a workflow's executions are its runs: open the workflow and choose Runs. A run opens in a side panel with its trace, its failure and the message as received, masked until you choose Show PHI with a reason. Reprocess in the panel replays it. Across workflows, search Messages. An old /executions/{id} link opens the run's panel in its workflow's Runs tab, and /executions opens Messages. See The workflow page.
Statuses
| Status | Means |
|---|---|
pending | Written down, not started yet. Inbound messages (MLLP, webhook, X12, FHIR subscription, SFTP and file pickup), cron ticks, scheduled workflow retries, replays and Run workflow children wait here. |
running | The workflow is running. |
waiting | Reserved. No step sets it now: the wait step was removed. |
completed | Every step finished. |
partial | A router sent to some destinations and failed on others. The run is finished. |
failed | The run stopped on an error. |
cancelled | Someone cancelled it while it was pending or running. |
partial is a failure wherever failures are counted: alert rules, the Messages list and the dashboard. In metrics and analytics, which know only three outcomes, a partial run counts as failed.
A failure the engine knows it must not retry on its own carries a reason. uncertain means the destination may already have the message, for example a timeout after the send. rejected means the destination refused it for good, for example an HL7 AR. You can still replay these by hand.
A running execution whose engine instance died is failed by a recovery sweep, so a stuck running row does not stay for ever. It shows on Messages › Needs action with an error that starts "Interrupted": a step may have run, so check the destination before you replay it.
An execution the engine had picked up but had not started a step of is not failed. When an engine stops (a deploy, a node upgrade, an autoscaler scale-down), it puts such executions back to pending before it exits, and the recovery sweep does the same for an engine that crashed. Another engine runs them, each in its old place: the same ordering lane and position, batch and due time.
Read and cancel
| Call | What it does |
|---|---|
GET /api/executions | Lists executions, newest first, 50 at a time (up to 100). Filter with status and triggerType (comma lists), from and to (ISO date-times), q (an id prefix, the workflow name or the error text, never message content; the last 90 days without from) and workflowId. Page with cursor. |
GET /api/executions/{id} | One execution with its trigger data and step results. Audited. |
GET /api/executions/{id}/logs | One line per step, with status and duration, and no payloads. |
GET /api/executions/{id}/stream | Server-Sent Events while it runs. |
POST /api/executions/{id}/cancel | pending, or a failed run waiting on a retry: 200 cancelled, with its scheduled retries. running: 202 cancelling, and the run stops before its next step on whichever replica runs it; a send in flight finishes. Anything else: 400. An earlier attempt's id acts on the newest attempt. |
An execution holds message data, which is PHI. Reads are limited to the caller's workspace and are audited. A viewer gets ids, statuses, timings and errors, but no trigger data, step output or patient name, and the read is audited with redacted: true. See Executions in the API.
Each step's output is stored once: an output of 1 KiB or more that equals the run's input or an earlier output points at it. An output over EXECUTION_NODE_RESULT_MAX_BYTES (10 MiB) is stored as a truncated marker. If the engine cannot write the history row a run needs, the run does not start: POST /api/workflows/{id}/execute answers 503 HISTORY_UNAVAILABLE, and a failed step-result write stops the run before its next step.
Retries
A step retries in the engine process: errorHandling.maxRetries (up to 10) with retryDelay (up to 60 seconds) and backoffMultiplier. A REST or FHIR destination that answers 429 or 503 with Retry-After makes the next attempt wait at least that long.
A workflow can also retry as a whole. Set Workflow retries (maxWorkflowRetries, up to 10) and Retry delay (s) (workflowRetryDelayMs, at least 1 second) in the builder. A retry is a durable pending execution, due after the backoff, capped at 30 minutes. It frees its slot while it waits, survives a restart, and resumes from the step that failed. A partial run retries only the destinations that failed without sending. A failure marked uncertain or rejected is never retried automatically.
These retries are bounded: after the last one the message is a dead letter on Messages › Needs action. For a destination that can be down for hours, turn on its queue instead.
Destination queues
Turn on Queue until delivered on a router destination's send step to keep its messages through a long outage, the way a Mirth or Rhapsody destination queue does. It is off by default.
How a queued destination works:
- Every message goes through the queue. The router runs the destination's filter and output steps, then writes the send to the destination's queue and moves on. The source run is complete once the message is queued. By default the queue sends one message at a time, in the order the source runs reached the router: strict arrival order when the source trigger is ordered, otherwise the order they were accepted in.
- Threads send in parallel. Set Threads (
queue.threads, 1 to 32) to have up to that many deliveries in flight, across every replica. Each thread is its own queue, so a failing message holds only its thread. Set Thread key (queue.threadKey, a path into the message the send step gets, or a channel map key) to keep every message with the same key, such as one patient or one facility, on one thread and in order; without a key, messages on different threads have no order between them. Changing the threads or key of a saved queue warns first: messages already queued keep their threads, so one key's messages can go out of order until they drain. The Queues tab lists each thread, and the depth gauges and alerts count a destination's threads together. - It retries until delivered. When a send fails without anything reaching the destination (connection refused, a timeout before connecting, HTTP 429 or 503), the message stays at the head of the queue and is tried again after the retry interval, doubling each time up to the longest wait. A
Retry-Afterlengthens the wait, never past the longest wait. The messages behind it wait. There is no retry count: the limit is age. - It gives up at the max age. A message older than the queue's max age is not sent. It becomes a dead letter on Needs action and the queue moves on to the next message.
- It never resends an uncertain delivery. A send that may have reached the destination (an MLLP ACK with no MSA, a control id that does not match, a commit ACK
CA, a timeout after the send) and a send the destination refused for good (AR, HTTP 4xx) are never retried. The queue stops at that message until you decide: replay it or skip it on Needs action (Decide on the Queues tab opens it).
| Setting | Default | Range |
|---|---|---|
| Max age | 7 days | 1 hour to 7 days |
| Retry every | 10 seconds | 1 second to 30 minutes |
| Longest wait | 5 minutes | the retry interval to 30 minutes |
The max age never passes the 7 days Needs action covers, so a queued message cannot outlive its record.
Queued messages do not count toward a workflow's backlog limit (WORKFLOW_MAX_PENDING), so a long outage of one destination does not make the source refuse new messages. Their number is bounded by the max age.
States
The Queues tab of Messages lists every queued destination with its workflow, its state, its depth, its oldest message and the last error.
| State | Means |
|---|---|
| Delivering | Messages are going out. |
| Delivering · catching up | Messages are going out, with more than 1,000 waiting: the queue is draining a backlog. |
| Retrying · breaker open | The head message failed and waits for its next try. Nothing else is sent to the destination meanwhile. |
| Probing · sending one message | The head message's next try is running: one call at a time. When it succeeds, the rest drain on their own. |
| Paused | Someone paused the queue. Messages keep queuing. |
| Blocked · needs decision | The head message may already be at the destination, or was refused. Decide opens it in Needs action to replay or skip it. |
Click a queue to open it: its depth over the last 3 hours, when the next try is, and the first messages waiting with their attempts. A queue catching up says how fast it drains (the depth drop over the last minute) and about how long it takes to clear. A paused queue says who paused it and when.
Pause stops sending until Resume; a send in flight finishes. Retry now makes the waiting try run at once instead of at its backoff. Each action asks for confirmation and is written to the audit log (destination.queue.paused, destination.queue.resumed, destination.queue.retried) with the queue and who acted, never message content.
A queued message's item on Needs action shows its attempts with no limit. If the destination is removed from the workflow, its queued messages fail without being sent and the queue moves on. If the workflow is disabled or deleted, the queue holds.
Metrics and alerts
medhook_destination_queue_depth and medhook_destination_queue_oldest_seconds report each queue's depth and its oldest message's age, labelled workflow_id and destination_id. A Queue size alert rule can watch one destination: choose the workflow, then the destination.
| Call | What it does |
|---|---|
GET /api/destination-queues | Lists this workspace's queued destinations: depth, oldest, state, next try and last error. |
POST /api/destination-queues/{lane}/pause | Pauses one queue. lane is the URL-encoded dq:<workflowId>:<destinationId> from the list. Audited. |
POST /api/destination-queues/{lane}/resume | Resumes it. Audited. |
POST /api/destination-queues/{lane}/retry | Retry now. Audited. |
Viewers can list the queues; operators and admins can act on them. A queue of another workspace answers 404.
A queue keeps strict order: a failing head message holds the messages behind it instead of rotating past them, and each retry sends the message as it was first built. For more than one delivery in flight, set queue.threads (1 to 32) on the send step. queue.threadKey keeps every message with the same key on one thread, in order, and a failing head holds only its own thread.
Replay
Replay runs a past execution again with the same input. Send POST /api/executions/{id}/replay. The new run uses the deployed version of the workflow, like live traffic, and the workflow must be enabled. The call needs a valid license and allows 10 requests a minute. The replay is written as a pending execution and runs through the work runner like live traffic, in the message's ordering lane, under the workflow timeout. Two replays of the same message at once cannot both be written: the second is refused with IN_PROGRESS.
curl -X POST "$ENGINE_URL/api/executions/$EXECUTION_ID/replay" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"destinationIds": ["dest-b"]}'The answer is 202:
{
"newExecutionId": "exec_example2",
"workflowId": "wf_example",
"originalExecutionId": "exec_example1",
"destinationIds": ["dest-b"]
}destinationIds in the answer lists the destinations that run again. null means every destination.
| Body field | What it does |
|---|---|
modifyInput | An object merged over the original input. Fields you give replace the originals. |
destinationIds | Run only these destinations, by router edge id. One to 50 ids. |
allDestinations | true resends to every destination. You cannot combine it with destinationIds. |
Which destinations run
A workflow with a router sends each message to several destinations, and each destination can succeed or fail on its own. Replay must not send twice to a destination that already has the message. With no scope in the body:
- A
partialexecution runs again only for the destinations that failed. - An execution that was itself a targeted replay runs again for the same destinations, narrowed to the ones that failed if it was partial.
- Anything else runs for every destination.
Then the engine removes any destination that another attempt of the same message already delivered. That covers the first delivery, an automatic retry and an earlier replay. If nothing is left, the replay is refused with ALREADY_DELIVERED.
destinationIds and allDestinations are your call. The engine does not narrow them. It still refuses an id the workflow does not have.
Refusals
A refused replay returns { "error": "...", "code": "..." }. Branch on the code, not the sentence.
| Code | Status | Why |
|---|---|---|
NOT_FOUND | 404 | No such execution in this workspace. |
WORKFLOW_DISABLED | 403 | The workflow is switched off. Enable it first. |
IN_PROGRESS | 409 | This message has an attempt that is still running. A replay now could send it twice. |
RETRY_SCHEDULED | 409 | An automatic retry is waiting on its backoff. Replay after it has run. |
ALREADY_DELIVERED | 409 | Every destination already received this message. Pass allDestinations to resend anyway. |
NO_FAILED_DESTINATION | 409 | A partial run recorded no failed destination. Pass destinationIds or allDestinations. |
CHAIN_TOO_DEEP | 409 | The message has been replayed too many times to work out who has it. Choose destinations or resend to all. |
CONFLICTING_SCOPE | 400 | You sent both destinationIds and allDestinations. |
INVALID_REQUEST | 400 | destinationIds is not a list of 1 to 50 ids, or allDestinations is not a boolean. |
UNKNOWN_DESTINATION | 400 | An id is not a destination of this workflow. |
NO_DESTINATIONS | 400 | You named destinations, but the workflow has none. |
NOT_A_MESSAGE | 400 | Targeting destinations needs a stored message, and this run's input is not one. |
STALE_SCOPE | 400 | The recorded scope names a destination that no longer exists. Pass allDestinations or destinationIds. |
A missing license is a 403 with no code.
Replay from Messages
The Messages page replays through POST /api/messages/replay, with a dry run first. The dry run runs each message, at most 200 within 20 seconds, through the chosen version with nothing sent or stored, and answers how many would deliver and what would change. The replay itself needs that dry run's token for the same messages, version and edit (DRY_RUN_REQUIRED, 409), runs only on the live version (VERSION_NOT_LIVE, 409), and is paced at 10, 50 or 200 a second. More than 1,000 messages need a second admin's approval (APPROVAL_REQUIRED, 403). An edited copy keeps a link to the original. See Replay and Edit & replay and Messages in the API.
Replay in bulk
POST /api/ack-queue/replay replays up to 50 failed items (the ones Needs action lists) in one call, with the same default scope per item. POST /api/workflows/{id}/replay-batch replays an HL7 export file as a dry run or to an MLLP target. See ACK queue and Replay an HL7 export or batch file.
Reprocess a search
Mirth's Reprocess results has two equivalents.
- On Messages. Type a query in the Stream and press Enter to search every message. Under the results, Replay {n} opens the Replay dialog for the results loaded on screen, 50 a page and more after Load more, and runs a dry run first. When the search matched more messages than are loaded, the button's tooltip says so. The results must come from one workflow, because a replay runs on that workflow's versions. Pick it in the Workflow chip. There is no target workflow or overwrite option here. Operators and admins can replay. Viewers cannot.
- Over the API.
POST /api/messages/reprocessreprocesses every message a search matches, up to the cap below, through the same or another workflow, with an optional overwrite. Use it to reprocess more than the loaded results.
Over the API it takes two calls to POST /api/messages/reprocess. The first one previews the count:
curl -X POST "$ENGINE_URL/api/messages/reprocess" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"query": {"workflowId": "wf_example", "ack": "AE", "since": "1440"}, "dryRun": true}'{
"count": 42,
"max": 1000,
"overCap": false,
"complete": true,
"query": {
"workflowId": "wf_example",
"ack": "AE",
"from": "2026-10-19T12:00:00.000Z",
"to": "2026-10-20T12:00:00.000Z"
}
}The preview pins the search in time. A relative window such as "last 24 h" becomes from and to, and a search with no end is closed at the time of the preview. Send that query back with the count you confirmed:
curl -X POST "$ENGINE_URL/api/messages/reprocess" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"query": {"workflowId": "wf_example", "ack": "AE", "from": "2026-10-19T12:00:00.000Z", "to": "2026-10-20T12:00:00.000Z"}, "confirmCount": 42, "overwrite": true}'{
"matched": 42,
"queued": 41,
"overwritten": 41,
"undecryptable": 1,
"skipped": [{ "id": "exec_example7", "code": "UNDECRYPTABLE" }],
"executions": [
{ "originalId": "exec_example1", "executionId": "exec_example43" }
]
}| Body field | What it does |
|---|---|
query | The Messages search: q, workflowId, type, since, ack, triggerType, from, to. |
dryRun | true only counts the matches and returns the pinned query. |
confirmCount | The count you confirmed. Required to run. If a different number of messages matches now, the call is refused with COUNT_CHANGED (409) and the current count. |
targetWorkflowId | Run the messages through this workflow instead of their own. The received message is the input. The workflow must be in the workspace and on. |
overwrite | Mark each original as reprocessed and link it to the execution that replaced it. |
How it behaves:
- Same workflow. Each message is replayed exactly as Replay does it, with the same default destination scope and the same refusals. A message that is still running, or whose retry is still waiting, is skipped and listed in
skippedwith its code. - Another workflow. The original received message goes to the other workflow as a new run, marked as a replay of the original. It does not join the original's ordering lane.
- Queued, not flooded. The replays are written as pending executions in batches of 100. The work runner runs them at the engine's normal concurrency, and ordered lanes keep their order. One request can reprocess at most 1,000 messages. Set
BULK_REPROCESS_MAX(up to 10,000) to change that. A larger match is refused withTOO_MANY, so narrow the search and reprocess it in parts. Only one bulk reprocess runs per workspace at a time (BUSY), and the call allows 6 requests a minute. - Overwrite. The original stays for the audit trail. The inspector shows Reprocessed → with a link to the replacement, and a later bulk reprocess leaves the original out.
- Encrypted messages. Stored messages are decrypted for the replay as usual. A message that cannot be decrypted is skipped and counted in
undecryptable. It is never sent. - Audit. Each run writes two entries that share a random
runId. Before anything is queued,message.bulk_reprocess_startedrecords the count, the workflow, type, source, ACK and time-range filters, whether a text query was used and its length range, the target workflow and the overwrite flag. If it cannot be written, nothing is queued and the call answers 503AUDIT_UNAVAILABLE. When the run ends, even if it fails part-way,message.bulk_reprocessedrecords the outcome (completed,partialorfailed), the counts and the original-to-replacement pairs of every replay that was queued. Neither entry holds the text query, a hash of it or the fields it named. - Roles. Operators and admins can call it; the API refuses viewers with 403.
Masking
An inbound request's headers are stored with the execution so you can see what arrived. The engine masks credential values first and keeps the names.
authorization,proxy-authorization,cookieandset-cookie.- Any header with
signaturein its name, such asx-hub-signature-256. - Any header whose name holds
secret,password,token,apikey,api-key,credential,authorizationorcookie. - Every header named in the webhook trigger's
expectedHeaders, whatever it is called.
A masked value reads ••••. The engine masks again when it reads an execution, so a row stored before masking existed does not leak a credential. Error text that echoes a request has credentials, URL passwords and upstream response bodies removed, and is cut to 160 characters.
A replay sends the stored message, so masked header values stay masked. The workflow gets the same body and trigger data, not the original credentials.