> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getmillwork.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop a run

> Cancel work you no longer need.

**Goal:** Stop a run that has not finished.

**You are done when:** the response status is `cancelled`, or a fresh status
check shows that the run already finished.

## Before you begin

Set `EXECUTION_ID` to a run created by [Run a model](/get-started/builder).

## Send the cancellation

```bash theme={null}
if ! curl --fail-with-body \
  --request POST \
  --header "Authorization: Bearer $MILLWORK_API_KEY" \
  --output cancellation.json \
  "$MILLWORK_API_URL/executions/$EXECUTION_ID/cancel"; then
  echo "The cancellation failed. Read cancellation.json before retrying." >&2
  exit 1
fi

jq '{execution_id, status, cancelled_by}' cancellation.json
```

**Expected result:** `status` is `cancelled`.

## If it fails

| What happened             | What to do                                                                              |
| ------------------------- | --------------------------------------------------------------------------------------- |
| `invalid_state`           | The run may have finished first. Fetch its status again and keep its result or receipt. |
| `not_found`               | Check the run ID and organization.                                                      |
| Network response was lost | Fetch the run status before sending another cancellation.                               |

Do not keep sending cancellation requests. A provider call already in progress
may finish and may still incur provider cost.

## What this confirms

Millwork records a cancelled final state and produces a receipt. It does not
reverse work or cost already completed by a provider.
