---
title: "Cancel a run"
description: "Stops a run that is queued, running or waiting, and cancels the approval requests it left open."
url: "https://openemail.uk/docs/api/tasks/cancel-run"
area: "API"
category: "Mailbox"
---

# Cancel a run

Stops a run that is queued, running or waiting, and cancels the approval requests it left open.

`POST /task-runs/{id}/cancel`

## POST /task-runs/{id}/cancel

Stops a run that is queued, running or waiting, and cancels the approval requests it left open.

## Example

Needs `tasks:write`.

**curl**

```
curl -X POST "$OE/task-runs/run_9d3a7e1c5b2f48a60c7e1d3b/cancel" -H "$AUTH"
```

**Response**

```
{
  "object": "task_run",
  "id": "run_9d3a7e1c5b2f48a60c7e1d3b",
  "taskId": "tsk_4b9e2c7a1f3d86e05a9c2b7d",
  "taskName": "Morning summary",
  "trigger": "schedule",
  "threadId": null,
  "status": "waiting",
  "instruction": "Go through the mail that arrived since yesterday. Tell me which conversations need a reply from me, most urgent first, and draft a short reply for each.",
  "autonomy": "organize",
  "model": "standard",
  "steps": 4,
  "toolCalls": 6,
  "actions": 1,
  "result": null,
  "error": null,
  "errorDetail": null,
  "pendingApprovals": 1,
  "createdAt": "2026-10-13T07:00:04.112Z",
  "startedAt": "2026-10-13T07:00:05.870Z",
  "finishedAt": null,
  "transcript": [
    { "role": "user", "text": "Go through the mail that arrived since yesterday. …", "at": "2026-10-13T07:00:05.870Z", "calls": [] },
    {
      "role": "assistant",
      "text": "",
      "at": "2026-10-13T07:00:09.402Z",
      "calls": [
        { "id": "call_1", "tool": "listThreads", "args": { "folder": "inbox", "maxResults": 20 }, "done": true, "result": "…" }
      ]
    }
  ],
  "approvals": [{
      "object": "task_approval",
      "id": "apr_2f8c1a6e9b3d47c05e1a8f2c",
      "runId": "run_9d3a7e1c5b2f48a60c7e1d3b",
      "taskId": "tsk_4b9e2c7a1f3d86e05a9c2b7d",
      "taskName": "Morning summary",
      "tool": "replyToEmail",
      "summary": "Reply to ann@example.com: Re: Invoice 1042",
      "args": {
        "threadId": "thr_7c1e4a90",
        "to": ["ann@example.com"],
        "subject": "Re: Invoice 1042",
        "body": "Hi Ann, the invoice went out again this morning."
      },
      "status": "pending",
      "createdAt": "2026-10-13T07:00:41.220Z",
      "expiresAt": "2026-10-20T07:00:41.220Z",
      "decidedAt": null
    }]
}
```

> What the run already did stays done. Nothing is undone.

> A step that is being carried out finishes, and the run stops before the next one.

> A run that has already ended answers 409 `task_run_finished`.

## Reference

- [`POST /task-runs/{id}/cancel`](https://openemail.uk/docs/api/reference/tasks#post-task-runs-id-cancel): full reference
