---
title: "Cancel run by ID"
method: POST
path: "/v1/runs/{id}/cancel"
tags: ["Runs"]
---

# Cancel run by ID

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

## Request

- Base URL: `https://agent.tinyfish.ai`
- URL: `https://agent.tinyfish.ai/v1/runs/{id}/cancel`
- Auth: API key in header `X-API-Key`

Cancel a run by ID. Only runs created via `/v1/automation/run-async` or `/v1/automation/run-sse` can be cancelled. Runs created via the synchronous `/v1/automation/run` endpoint cannot be cancelled.

## Path parameters

- `id` string, required: Run ID

## Response `200`

Run cancelled successfully, or already in terminal state (idempotent)

- object: Response from cancel run endpoint
  - `run_id` string, required: The unique identifier of the run
  - `status` 'CANCELLED' | 'COMPLETED' | 'FAILED', required: The current status of the run. Returns actual status for idempotent responses (e.g., COMPLETED if run already finished)
  - `cancelled_at` string, nullable, required: ISO 8601 timestamp when the run was cancelled, or null if not cancelled
  - `message` string, nullable, required: Additional context about the cancellation result (e.g., "Run already cancelled", "Run already finished")

## Other responses

- `401`: Unauthorized - Invalid or missing API key
- `404`: Run not found or not owned by this API key
- `500`: Internal server error

---

[API](https://skmtc.dev/tinyfish/apis/tinyfish-web-agent-automation-api-2.md) · [All operations](https://skmtc.dev/tinyfish/apis/tinyfish-web-agent-automation-api-2/llms.txt) · [OpenAPI document](https://skmtc.dev/tinyfish/apis/tinyfish-web-agent-automation-api-2/revisions/c48ef855099d?raw)
