API Reference
Report run completion
Delivered by the executor (via its durable completion journal) when a task run finishes. Idempotent: a late duplicate for a run already terminal via a user stop or a prior compl…
POST /api/executor-callbacks/runs/{id}/complete
Delivered by the executor (via its durable completion journal) when a
task run finishes. Idempotent: a late duplicate for a run already
terminal via a user stop or a prior completion is skipped. A run
marked terminal by the run reaper (terminal_source='reaper') is
overwritten — the executor's journaled truth wins over the reaper's
guessed failed verdict.
Operation ID: executorCompleteRun
Authentication
- ExecutorKeyAuth (
http bearer) Shared executor secret (ENVOY_EXECUTOR_KEY). Used by internal executor-to-control-plane routes (registration, heartbeat, completion/log callbacks). Internal executor authentication: use the documented shared executor key. Do not replace it with a user API key.
Path parameters
id—integer,requiredResource ID
Request body
The request body is required.
application/json
- Type:
object - Properties:
executionId(string,required) — Executor-side execution correlation ID.exitCode(integer | null,required) — Subprocess exit code.nullindicates an abort without a numeric status.- Description: Subprocess exit code.
nullindicates an abort without a numeric status. - Nullable: yes
- Description: Subprocess exit code.
completedAt(string) — Optional ISO timestamp of when the task actually finished (journaled by the executor at exit). Preferred over the server'snowso a late redelivery after control-plane downtime doesn't inflateduration_msor stamp a wrongcompleted_at.- Description: Optional ISO timestamp of when the task actually finished (journaled by the executor at exit). Preferred over the server's
nowso a late redelivery after control-plane downtime doesn't inflateduration_msor stamp a wrongcompleted_at. - Format:
date-time
- Description: Optional ISO timestamp of when the task actually finished (journaled by the executor at exit). Preferred over the server's
reason(string) — Optional completion reason.executor_shutdownmarks an infra-initiated interruption (deploy/restart) and is recorded as a failure, not a user cancellation.- Description: Optional completion reason.
executor_shutdownmarks an infra-initiated interruption (deploy/restart) and is recorded as a failure, not a user cancellation. - Allowed values:
executor_shutdown
- Description: Optional completion reason.
Success responses
200
Completion recorded (or skipped as a duplicate).
Content type: application/json
- Type:
object - Properties:
ok(boolean)skipped(boolean) — True when the run was already terminal from a user stop or prior completion and the duplicate was ignored.
Error responses
404
Resource not found
Content type: application/json
- Reference:
Error- Type:
object - Properties:
error(string)- Example:
NOT_FOUND
- Example:
message(string)- Example:
Resource not found
- Example:
- Type:
Example:
{
"error": "NOT_FOUND",
"message": "Resource not found"
}Examples
cURL
curl --request POST \
--url 'https://your-envoy.example.com/api/executor-callbacks/runs/YOUR_ID/complete' \
--header 'Authorization: Bearer $EXECUTOR_KEY' \
--header 'Content-Type: application/json' \
--data '{
"executionId": "string",
"exitCode": 0
}'JavaScript (fetch)
const response = await fetch('https://your-envoy.example.com/api/executor-callbacks/runs/YOUR_ID/complete', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_EXECUTOR_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"executionId": "string",
"exitCode": 0
}),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);