jobs

Request cancellation

Changed on

Requests cancellation and returns the current job object — canceling (interruption takes effect at node/step boundaries) or already-terminal. Idempotent: canceling a finished job is a no-op returning the terminal state. On serverless, GPU seconds consumed before the interrupt takes effect are still billed.

post/api/v2/jobs/{id}/cancel

Request

  • Base URL: http://127.0.0.1:8189
  • URL: http://127.0.0.1:8189/api/v2/jobs/{id}/cancel
  • Auth: one of:
    • HTTP bearer
    • none

Path parameters

idstring required

Response

Current job state.

idstring required
status'queued' | 'running' | 'succeeded' | 'canceling' | 'canceled' | 'failed' | 'expired' required

Lifecycle: queued → running → succeeded | failed | expired; a cancel request moves running → canceling → canceled. Terminal states: succeeded, canceled, failed, expired.

created_atstring date-time required
started_atstring date-time nullable required
completed_atstring date-time nullable required
expires_atstring date-time required

Retention deadline — a platform property, not an API constant.

queue_positioninteger nullable required
metricsobject

Values are nullable (a metric not yet available — e.g. execution_ms before a job starts running — is null, not omitted); the example below is deliberately all-non-null purely to work around a Spectral/nimma lint-tooling crash on a literal null inside a schema example combined with additionalProperties.nullable: true — the schema itself is unchanged and still allows null values at runtime.

Example response

{
  "id": "7f3d2c1b-9a8e-4d6f-b012-3c4d5e6f7a8b",
  "progress": {
    "value": 0.42,
    "nodes_done": 11,
    "nodes_total": 31,
    "current_node": "12",
    "current_node_class": "KSampler",
    "step": 21,
    "steps": 50,
    "message": "KSampler 21/50"
  },
  "outputs": [
    {
      "node_id": "9",
      "name": "ComfyUI_00001_.png",
      "content_type": "image/png",
      "size_bytes": 1848320,
      "id": "9f8a1c0d-2b3e-4f56-..."
    }
  ],
  "error": {
    "code": "node_execution_error"
  },
  "metrics": {
    "queue_ms": 9000,
    "execution_ms": 42000
  }
}

Changes