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

# Cancel Node

> Stop in-flight journey runs from a Cancel node or the API. Cancel one run by its ID, or cancel a group by a shared cancellation token.

The Cancel node stops in-flight journey runs from inside a flow. You can also cancel from your own code with the cancel API, so you don't need a Cancel node in the journey to stop a run.

Either way, you target runs one of two ways: a single run by its `run_id`, or a group of runs by a shared **cancellation token**. Courier only cancels **active** runs, and canceling is idempotent, so a run that has already finished or errored is left untouched.

## Cancel a Single Run

The simplest case. Use the `runId` returned when you [invoke a journey](/platform/journeys/invocation) and call `POST /journeys/cancel` with a `run_id`:

<CodeGroup>
  ```bash cURL icon="terminal" wrap theme={null}
  curl -X POST https://api.courier.com/journeys/cancel \
    -H "Authorization: Bearer $COURIER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "run_id": "1-67ab1234-a1b2c3d4e5f6" }'
  ```

  ```javascript Node.js icon="node-js" theme={null}
  import Courier from "@trycourier/courier";

  const client = new Courier({ apiKey: "your_api_key" });

  await client.journeys.cancel({ runId: "1-67ab1234-a1b2c3d4e5f6" });
  ```

  ```python Python icon="python" theme={null}
  from courier import Courier

  client = Courier(api_key="your_api_key")

  client.journeys.cancel(run_id="1-67ab1234-a1b2c3d4e5f6")
  ```
</CodeGroup>

It returns `202` with the `run_id` and its resulting `status`:

| Status      | Meaning                                                    |
| ----------- | ---------------------------------------------------------- |
| `CANCELED`  | The run was active (or already canceled), and is canceled. |
| `PROCESSED` | The run had already finished; nothing changed.             |
| `ERROR`     | The run had already ended in an error; nothing changed.    |

A `run_id` Courier can't find for your workspace returns `404`.

## Cancel a Group with a Cancellation Token

A cancellation token is an addressing key you attach to runs, so you can cancel a whole set by a business identifier without tracking individual run IDs. How you build the token decides what it covers:

* `order-{{data.order_id}}` cancels the runs for one order
* `user-{{profile.id}}` cancels every run for a user, even across different journeys
* `black-friday-2026` cancels an entire campaign

Set the token in the journey's **settings**. It's templated, so you build it from run data with `{{data.…}}`, `{{profile.…}}`, or `{{recipient}}`. Use a dynamic value so the token maps to the runs you mean, not every run of the journey.

<Note>
  If a token references a variable that isn't present when a run starts, the run is created without a token. It won't be cancelable by token, but you can still cancel it by run ID.
</Note>

Once runs are tagged, cancel the token two ways:

* **From your code** — call `POST /journeys/cancel` with a `cancelation_token` (spelled with one L), or `client.journeys.cancel({ cancelationToken: "order-1234" })`. It returns `202` with the token.
* **From a Cancel node** — add a **Cancel** node and set its **Cancelation Token**. When a run reaches the node, Courier cancels every active run sharing that token. This is how one path cancels another: an "invoice paid" branch routes to a Cancel node set to `invoice-{{data.invoice_id}}`, stopping that invoice's remaining reminders.

<Note>
  `POST /journeys/cancel` takes **exactly one** of `run_id` or `cancelation_token`; sending both or neither returns `400`. See the [cancel journey runs](/api-reference/journeys/cancel-journey-runs) reference for the full schema.
</Note>

## What's Next

<CardGroup cols={2}>
  <Card title="Send Node" href="/platform/journeys/nodes/send" icon="paper-plane">
    Deliver messages on a channel, or run an experiment
  </Card>

  <Card title="Building Your Journey" href="/platform/journeys/building-journeys" icon="arrow-progress">
    Add branching, delays, and enrichment between sends
  </Card>

  <Card title="Starting a Journey" href="/platform/journeys/invocation" icon="bolt">
    Trigger runs by API or Segment event
  </Card>
</CardGroup>
