Upstash Documentation

client.cancel

2 min read

Cancel one or more workflow runs. You can pass IDs directly, use filters, or cancel all at once.

Arguments#

The cancel method accepts one of the following:

By ID#

Pass a single workflow run ID or an array of IDs directly:

By filters#

Pass an object with a filter field containing one or more filter criteria:

filterobject#
Show properties
workflowUrlstring#

Cancel workflows matching this exact URL. Cannot be combined with workflowUrlStartingWith.

workflowUrlStartingWithstring#

Cancel workflows whose URL starts with this prefix. Cannot be combined with workflowUrl.

labelstring | string[]#

Cancel workflows with this label. Pass an array to match runs that have any of the given labels (OR semantics).

fromDateDate | number#

Cancel workflows created after this date. Accepts Date objects or Unix timestamps (ms).

toDateDate | number#

Cancel workflows created before this date. Accepts Date objects or Unix timestamps (ms).

callerIpstring#

Cancel workflows triggered by this IP address.

flowControlKeystring#

Cancel workflows with this flow control key.

countnumber#

Maximum number of workflow runs to cancel per call. Defaults to 100.

Cancel all#

allboolean#

Set to true to cancel all pending and active workflow runs.

Response#

cancellednumber#

The number of workflow runs that were cancelled.

Usage#

Cancel by ID#

Cancel with URL filter#

Cancel all workflow runs on a specific endpoint using a URL prefix:

For an exact URL match:

Cancel with filters#

You can combine multiple filter parameters:

Cancel all workflows#