---
title: "Cancel a run"
method: POST
path: "/v1/runs/{runId}/cancel"
tags: ["Runs"]
---

# Cancel a run

`POST /v1/runs/{runId}/cancel`

## Request

- Base URL: `https://api.ironfang.com/rig`
- URL: `https://api.ironfang.com/rig/v1/runs/{runId}/cancel`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Ends an active run without an outcome and writes run.cancelled. A run that has already ended answers 409. Needs rig.run.

## Request body

- object
  - `reason` string

## Response `200`

The cancelled run

- object
  - `run` Run, required
    - `created_at` string, date-time, required
    - `created_by` string
    - `expires_at` string, date-time, required
    - `external_id` string
    - `finished_at` string, date-time
    - `id` string, uuid, required
    - `organisation_id` string, uuid, required
    - `outcome` 'pass' | 'fail' | 'none': Present once finished.
    - `project_id` string, uuid, required
    - `reason` string
    - `started_at` string, date-time, required
    - `status` 'active' | 'finished' | 'cancelled' | 'expired', required
    - `suite_id` string, uuid, required
    - `suite_version_id` string, uuid, required
    - `ttl_seconds` integer, required

## Other responses

- `400`: The body is not one strict JSON value of the documented shape (`invalid_json`).
- `401`: No credential, an invalid one, or a delegated token where none is accepted (`unauthorized`, `invalid_api_key`, `delegated_not_allowed`).
- `403`: The credential lacks the permission or scope, or names another organisation (`forbidden`, `insufficient_scope`).
- `404`: No such object in this organisation (`not_found`).
- `409`: The run has already ended (`run_not_active`).
- `422`: A field is invalid; the message names it (`invalid_request`).

---

[API](https://skmtc.dev/ironfang/apis/ironfang-rig-api.md) · [All operations](https://skmtc.dev/ironfang/apis/ironfang-rig-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ironfang/apis/ironfang-rig-api/revisions/3e86a312dad1?raw)
