---
title: "Request cancellation of an in-flight run."
method: POST
path: "/v1/agent/runs/{runId}/cancel"
tags: ["agent"]
---

# Request cancellation of an in-flight run.

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

## Request

- Base URL: `http://localhost:8080`
- URL: `http://localhost:8080/v1/agent/runs/{runId}/cancel`
- Auth: one of:
  - API key in cookie `dvt_session`
  - HTTP bearer

DVT-4436: flags the run for cancellation (`agent_turns.cancel_requested_at`); the detached engine call notices on its next poll (`~1s`), stops reading from Cortex, and records the run's terminal `dvt.done` frame with `status: "canceled"`. Idempotent — a second call, or a call against a run that has already ended, still returns 204. Ownership is checked against `agent_turns` (`org_id` + `actor_id`) BEFORE the flag is written — another user's run (even in the same org) 404s.

## Response `204`

Cancellation requested (or the run was already terminal/already flagged) — always

## Other responses

- `401`: Missing, invalid, or expired session.
- `404`: Resource does not exist.
- `503`: The service or a required dependency is temporarily unavailable.

---

[API](https://skmtc.dev/dvt/apis/dvt-rest-api.md) · [All operations](https://skmtc.dev/dvt/apis/dvt-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dvt/apis/dvt-rest-api/revisions/00016f504165?raw)
