Skip to main content
POST
/
journeys
/
cancel
JavaScript
import Courier from '@trycourier/courier';

const client = new Courier({
  apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});

const cancelJourneyResponse = await client.journeys.cancel({ cancelation_token: 'order-1234' });

console.log(cancelJourneyResponse);
{ "cancelation_token": "order-1234" }

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request body for POST /journeys/cancel. Provide EXACTLY ONE of cancelation_token (cancels every run associated with the token) or run_id (cancels a single tenant-scoped run).

cancelation_token
string
required
Minimum string length: 1

Response

Cancelation accepted

202 Accepted body for POST /journeys/cancel, returning the submitted identifier. When called with cancelation_token, returns { cancelation_token }; when called with run_id, returns { run_id, status }.

cancelation_token
string
required