---
title: "Cancel an AI job"
method: POST
path: "/api/v1/ai/jobs/{jobId}/cancel"
tags: ["AI"]
---

# Cancel an AI job

`POST /api/v1/ai/jobs/{jobId}/cancel`

Request cancellation of an AI job. This endpoint is idempotent — calling it on an already-cancelled or completed job returns success with the current state. For QUEUED jobs, cancellation is immediate. For EXECUTING jobs, the worker will stop after completing its current iteration. Jobs in DELIVERING state cannot be cancelled as they are already finalizing results. Only the job owner or organization admins can cancel jobs.

## Path parameters

- `jobId` string, uuid, required — The unique identifier of the AI job

## Response `200`

Cancellation request processed. The state field indicates the job's state after the attempt — CANCELLED if successful, or the current terminal state if the job had already completed.

- AiJobCancelResponse
  - `jobId` string, uuid, required — The job ID that was requested to cancel.
  - `state` 'CANCELLED' | 'COMPLETE' | 'DELIVERING' | 'EXECUTING' | 'FAILED' | 'QUEUED', required — The job state after the cancellation attempt. CANCELLED if the cancellation was successful. If the job was already in a terminal state (COMPLETE, FAILED, CANCELLED), the current state is returned unchanged — the endpoint is idempotent.

## Other responses

- `400` — Invalid job ID format. Must be a valid UUID.
- `401` — Missing or invalid API key.
- `403` — Permission denied. Only the job owner or organization admins can cancel jobs.
- `404` — Job not found. The job may not exist or may belong to a different organization.
- `409` — Concurrent modification conflict. The job state was changed by another request. Retry the cancellation.

---

[API](https://skmtc.net/omniapp/apis/omni-api.md) · [All operations](https://skmtc.net/omniapp/apis/omni-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/omniapp/omni-api/revisions/cddcef5fd216/schema)
