Start typing to search.

API Reference

Report run completion

View Markdown

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

  • idinteger, required Resource 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. null indicates an abort without a numeric status.
      • Description: Subprocess exit code. null indicates an abort without a numeric status.
      • Nullable: yes
    • completedAt (string) — Optional ISO timestamp of when the task actually finished (journaled by the executor at exit). Preferred over the server's now so a late redelivery after control-plane downtime doesn't inflate duration_ms or stamp a wrong completed_at.
      • Description: Optional ISO timestamp of when the task actually finished (journaled by the executor at exit). Preferred over the server's now so a late redelivery after control-plane downtime doesn't inflate duration_ms or stamp a wrong completed_at.
      • Format: date-time
    • reason (string) — Optional completion reason. executor_shutdown marks an infra-initiated interruption (deploy/restart) and is recorded as a failure, not a user cancellation.
      • Description: Optional completion reason. executor_shutdown marks an infra-initiated interruption (deploy/restart) and is recorded as a failure, not a user cancellation.
      • Allowed values: executor_shutdown

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
      • message (string)
        • Example: Resource not found

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);