---
title: Cancel a job
description: Stop a job before generation starts.
---
`POST` `/v1/jobs/{id}/cancel`

**Host** `https://api.open.sume.com` · **Auth** API key

Cancels a job that has not started generating. The reserved price is refunded. Once the model has started, the job can no longer be canceled: the status response says whether it still can (`cancelable`, `cancel_url`).

## Request

### Headers

| Header | Type | Required | Description |
|---|---|---|---|
| `Authorization` | string | Yes | `Bearer <key>`. Or send `x-api-key`. |

### Path

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | Yes | The job id (`job_...`). |

## Example

<!-- api-call-example:v2-job-cancel -->

## Response

`200 OK`

The canceled job, with `status: "canceled"`. A job that has already started answers `409 job_not_cancelable`:

```json
{
  "error": {
    "code": "job_not_cancelable",
    "message": "API job can only be canceled before generation starts.",
    "request_id": "req_e3d2e8cd141a4d12873323ac4a87ab90",
    "category": "job_state",
    "stage": "job_state",
    "retryable": false,
    "retry_after_seconds": null,
    "public_reason": "job_not_cancelable",
    "next_action": "inspect_events",
    "details": {
      "status": "completed",
      "cancelable_before": "generation_started"
    }
  }
}
```

## Errors

| Status | `code` | When |
|---|---|---|
| 401 | `unauthorized` | No key, or the key is wrong or revoked. |
| 404 | `not_found` | No job with that id in your workspace. |
| 409 | `job_not_cancelable` | Generation has started, or the job has already ended. |
| 429 | `rate_limited` | Too many requests for your key in this window. |

[All error codes](/docs/errors)

## Related

- [Jobs and lifecycle](/docs/jobs)
