---
title: "Cancel a single in-flight backup."
method: POST
path: "/backups/{id}/cancel"
tags: ["Backups"]
---

# Cancel a single in-flight backup.

`POST /backups/{id}/cancel`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/backups/{id}/cancel`
- Auth: HTTP bearer

Flips the parent `backups` row + its latest `backup_jobs` row to
`failed` with reason `"cancelled by user <uid>"`. The in-process
`CancellationToken` is observed on the next heartbeat tick (≤5s), so the
engine exits cleanly and rollback reaps the sidecar. Idempotent: cancelling
an already-terminal backup is a 200 with `cancelled = 0`.

## Path parameters

- `id` integer, required

## Response `200`

Cancel processed (idempotent)

- CancelBackupResponse: Response body for cancel endpoints.
  - `cancelled` integer, required: Number of rows that were actually flipped to `failed`. `0` is a valid success and means the backup was already terminal — the call is idempotent.

## Other responses

- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Backup not found
- `500`: Internal server error

## Changes

- **2026-11-09** `12896146b193`: 4 breaking
  - removed the required property `extensions` from the response with the `401` status
  - removed the required property `extensions` from the response with the `403` status
  - removed the required property `extensions` from the response with the `404` status
  - removed the required property `extensions` from the response with the `500` status
- **2026-10-05** `4b228ebed583`: 4 info
  - added the optional property `status` to the response with the `401` status
  - added the optional property `status` to the response with the `403` status
  - added the optional property `status` to the response with the `404` status
  - added the optional property `status` to the response with the `500` status
- **2026-10-05** `63a80791dc58`: 4 warning
  - removed the optional property `status` from the response with the `401` status
  - removed the optional property `status` from the response with the `403` status
  - removed the optional property `status` from the response with the `404` status
  - removed the optional property `status` from the response with the `500` status
- **2026-09-23** `f4efc4d5c7b7`: 4 info
  - added the optional property `status` to the response with the `401` status
  - added the optional property `status` to the response with the `403` status
  - added the optional property `status` to the response with the `404` status
  - added the optional property `status` to the response with the `500` status
- …earlier changes not shown

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/backups/:id/cancel/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
