> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/workflow-execution/cancellation-and-run-status.md).

# Cancellation and Run Status

Cancellation requests that work stop. It is not the same as successful completion, and it does not reverse external actions already performed.

![Cancellation is a request, not a rollback](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FlmS20gD1NOcYQf8W7Wkc%2Fcancellation-and-run-status.png?alt=media)

Read the actual final state. Cancellation does not undo provider actions already completed, and a different credential can represent a different actor.

<details>

<summary>Copy the example</summary>

```http
# Request cancellation using the run-owning credential.
POST /v2/runs/{run_id}/cancel

# A 202 response means accepted, not finished.
GET /v2/runs/{run_id}

# Keep following the same run until a terminal state:
# succeeded | failed | cancelled
```

</details>

## Before you begin

A run ID and the credential that owns the run for the v2 cancellation path.

## Run states and cancellation

| Term                 | Definition                                                                                                                                                |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Cancellation request | A request to stop an execution. Acceptance is not confirmation that all work has stopped.                                                                 |
| Terminal state       | A state indicating that a run has ended, such as succeeded, failed, or cancelled. Stop normal completion polling only after a final state is known.       |
| Run                  | One execution of a project. Use its run ID to retrieve that execution’s state, input, output, and errors.                                                 |
| Side effect          | A change outside the returned answer, such as creating a record or sending email. Cancellation or release rollback does not undo a completed side effect. |

## Cancel a run and check its status

1. Read the current run state.
2. Request cancellation through the supported run control.
3. Continue reading the run until its terminal state is known.

The client displays the actual final state instead of treating request acceptance as completion.

## Behavior and limitations

A v2 cancellation response of 202 means the request was accepted. A personal API key and a session are distinct actors even when associated with the same person. The batch UI cancellation path is different and can leave in-flight work running.

| v2 state            | Interpretation                              |
| ------------------- | ------------------------------------------- |
| `queued`, `running` | Execution is not complete.                  |
| `paused`            | A response is required before continuation. |
| `succeeded`         | The run completed successfully.             |
| `failed`            | Inspect the recorded error.                 |
| `cancelled`         | The run ended as canceled.                  |

## Related resources

[Execution Order and Node Dependencies](https://docs.stackai.com/technical-reference/workflow-execution/execution-order-and-node-dependencies.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/technical-reference/workflow-execution/cancellation-and-run-status.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
