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

# Cancel Run

> Cancel a running or pending run

## Path Parameters

<ParamField path="id" type="string" required>
  Run ID (e.g., `run_xyz789abc`)
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the cancellation was successful
</ResponseField>

<ResponseField name="status" type="string">
  The updated run status (`canceled`)
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.crewship.dev/v1/runs/run_xyz789abc/cancel \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true,
    "status": "canceled"
  }
  ```

  ```json Error - Invalid status theme={null}
  {
    "error": {
      "code": "bad_request",
      "message": "Cannot cancel run with status: succeeded"
    }
  }
  ```
</ResponseExample>

## Notes

* Only runs with status `pending` or `running` can be canceled
* Canceling a run stops execution and destroys the underlying machine
* The run status will be set to `canceled` with a `completed_at` timestamp
