> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sluice.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /api/jobs/:id/revoke

> Revoke (cancel) a single active, queued, or scheduled job.

Cancels a job that is currently active, queued, scheduled, retrying, or in the unknown state. The job's state changes to `cancelled`.

## Authentication

Session cookie (dashboard).

## Path parameters

| Parameter | Type     | Description      |
| --------- | -------- | ---------------- |
| `id`      | `string` | Sluice job UUID. |

## Allowed states

A job can only be revoked if its current state is one of: `active`, `queued`, `scheduled`, `retrying`, `unknown`.

Attempting to revoke a `completed`, `failed`, or `cancelled` job returns `400`.

## How it works

Sluice sends a revoke command to Celery via `control.revoke()`, which broadcasts the revocation to all workers. For `queued` or `scheduled` jobs, the worker discards the task before execution begins. For `active` tasks, the worker receives the revoke signal but the task may not terminate immediately unless `terminate=True` is used internally — the task runs to completion and is marked `cancelled` afterward.

<Note>
  If the task uses `acks_late=True`, the message remains on the broker until the worker acknowledges it. A revoked task with `acks_late` is acknowledged without execution, but if the worker crashes before acknowledging, the broker may redeliver the task to another worker that hasn't seen the revoke command.
</Note>

## Response

<CodeGroup>
  ```json 200 — Success theme={null}
  {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "state": "cancelled",
    "message": "Job revoked."
  }
  ```

  ```json 400 — Invalid state theme={null}
  {
    "error": {
      "code": "INVALID_STATE",
      "message": "Job cannot be revoked from state 'completed'. Revokable states: active, queued, scheduled, retrying, unknown.",
      "docs_url": "https://docs.sluice.sh/troubleshooting/api-errors"
    }
  }
  ```

  ```json 404 — Not found theme={null}
  {
    "error": {
      "code": "NOT_FOUND",
      "message": "Job not found.",
      "docs_url": "https://docs.sluice.sh/troubleshooting/api-errors"
    }
  }
  ```
</CodeGroup>
