---
title: "Soft-cancel a running analysis (status → cancelled)"
method: DELETE
path: "/api/v1/contexts/{context_id}/analyses/{run_id}"
tags: ["analyses"]
---

# Soft-cancel a running analysis (status → cancelled)

`DELETE /api/v1/contexts/{context_id}/analyses/{run_id}`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/contexts/{context_id}/analyses/{run_id}`
- Auth: none declared

Mark a running run as ``cancelled``.

No-op (idempotent 200) when the run is already in a terminal
state — not all clients will ship a "stop polling" hook to detect
that the run finished between their last poll and the cancel
click. 409 only for the genuinely contradictory case (status not
in {running, succeeded, failed, cancelled}).

Cancellation does NOT decrement the daily quota — the run row
has already been INSERTed by orchestrator.start, and BYOK /
partial LLM cost may have been incurred (#496 quota AC).

## Path parameters

- `context_id` string, uuid, required
- `run_id` string, uuid, required

## Headers

- `authorization` string, nullable

## Response `200`

Successful Response

- AnalysisCancelResponse: DELETE /{run_id} response — confirms the soft-cancel. Same ``model_validate(row)`` pattern as AnalysisStartResponse so SQLAlchemy column types are bridged via Pydantic ``from_attributes``.
  - `run_id` unknown, required
  - `status` unknown, required
  - `cancellation_reason` unknown, required
  - `finished_at` unknown, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/09f17f5ada29?raw)
