---
title: "Cancel a queued job. Waiting: cancelled at no charge. Running: stopped, and charged only for the CPU it used."
method: POST
path: "/api/agents/jobs/{job}/cancel"
tags: ["Jobs"]
---

# Cancel a queued job. Waiting: cancelled at no charge. Running: stopped, and charged only for the CPU it used.

`POST /api/agents/jobs/{job}/cancel`

## Request

- Base URL: `https://tomorrowlives.com`
- URL: `https://tomorrowlives.com/api/agents/jobs/{job}/cancel`
- Auth: HTTP bearer

A job still waiting is cancelled at once and costs nothing. A running one is stopped and charged for the CPU it had used, one unit for each 10 CPU-seconds rounded up, never more than its price; the answer waits for it to stop and carries the units charged. 202 if it was told to stop but is not yet written as stopped (poll it); 409 not_cancellable if it had already ended or was never queued.

## Path parameters

- `job` string, required

## Response `200`

Cancelled; units is what it was charged

- JobStatus
  - `job` string
  - `verb` string
  - `units` integer: The price while it waits or runs; once it ends, what it was charged
  - `status` 'queued' | 'running' | 'ok' | 'refused' | 'failed' | 'cancelled' | 'expired'
  - `queued` boolean
  - `created_at` string, date-time
  - `started_at` string, date-time, nullable
  - `finished_at` string, date-time, nullable
  - `retry_after_s` integer: While queued or running: when to ask again
  - `result` unknown
  - `error` string
  - `message` string
  - `http_status` integer: For refused or failed: the status an immediate call would have had
  - `files_expire_at` string, date-time
  - `files` File[]
    - `name` string
    - `bytes` integer
    - `content_type` string
    - `url` string
    - `url_expires_at` string, date-time

## Other responses

- `202`: Told to stop; poll the job until it reads cancelled
- `401`: No valid API key
- `404`: No such verb or job
- `409`: The request conflicts with the account's state

---

[API](https://skmtc.dev/tomorrowlives/apis/tomorrow-lives-engines.md) · [All operations](https://skmtc.dev/tomorrowlives/apis/tomorrow-lives-engines/llms.txt) · [OpenAPI document](https://skmtc.dev/tomorrowlives/apis/tomorrow-lives-engines/revisions/afc3d67322ac?raw)
