Skip to main content

Bulk Cancel Workflow Runs

Cancel all matching workflow runs.
2 min read
delete/v2/workflows/runs
Request example
Response
delete/v2/workflows/runs
Warning
If you provide a list of workflow run IDs, only those specific workflow runs will be canceled. If you include filter parameters, only the workflow runs matching the filters will be canceled. If no filter or workflow run IDs are sent, all workflow runs will be canceled.

Cancelling by workflowRunIds is synchronous, and cancelled is the exact number of workflow runs cancelled.

A filter-based cancel (including cancelling all workflow runs) is tracked as a bulk action and runs in the background:

  • By default, the request waits up to one minute for the bulk action to finish. If it does not finish in time, a 429 is returned, and the bulk action keeps running in the background.
  • With async=true, the request returns right after the bulk action is created, together with its actionId. You can follow its progress with Get a Bulk Action.
  • cancelled is the number of in-progress workflow runs that matched the filters when the request was accepted, not the number of workflow runs actually cancelled.
  • Sending the same filters again while an identical bulk action is still in progress does not start a new one. The in-progress bulk action is returned instead.
  • Up to 1000 bulk actions can be in progress at the same time. Beyond that, a 412 is returned.

For multi-value filters, a workflow run matches if its value equals any of the given values (OR logic), and multiple filters are combined with AND logic. Multiple values can be passed either by repeating the query parameter (label=label_1&label=label_2) or as a single comma-separated value (label=label_1,label_2).

Authorization

Authorizationstringheaderrequired#
QStash authentication token

1 alternative authorization method available — see the spec for details.

Query parameters

workflowRunIdsstring[]#
Optional list of specific workflow run IDs to cancel. If provided, the other filters are ignored.
workflowUrlstring[]#
The URL of the workflow whose runs to cancel. Supports multiple values.
workflowUrlExactMatchboolean#
workflow url is searched as a prefix by default. To make it exact match, workflowUrlExactMatch can be set to true.

Default: false

fromDatenumber#
Optional start date to filter workflow runs to cancel. Unix timestamp in milliseconds.
toDatenumber#
Optional end date to filter workflow runs to cancel. Unix timestamp in milliseconds.
callerIpstring[]#
Optional caller IP address to filter workflow runs to cancel. Supports multiple values.
flowControlKeystring[]#
Optional flow control key to filter workflow runs to cancel. Supports multiple values.
labelstring[]#

Optional label to filter workflow runs to cancel. Supports multiple values. You can pass multiple values to match workflow runs with any of the given labels (OR logic).

Examples:

  • label=my_label
  • label=label_1&label=label_2
  • label=label_1,label_2
hoststring[]#
Optional host of the workflow URL to filter workflow runs to cancel. Supports multiple values.
pathstring[]#
Optional path of the workflow URL to filter workflow runs to cancel. Supports multiple values.
asyncboolean#
Only applies to filter-based cancels. If true, the request returns as soon as the bulk action is created, without waiting for it to finish. The response includes the actionId of the bulk action.

Default: false

countintegerdeprecated#
Deprecated. This parameter is ignored, and all workflow runs matching the filters are cancelled.

Responses

application/json
Workflow runs cancelled, or the bulk action is created when async=true.
cancelledinteger#

When cancelling by workflowRunIds, the number of workflow runs cancelled.

For filter-based cancels, the number of in-progress workflow runs that matched the filters when the request was accepted.

actionIdstring#
The ID of the bulk action. Only returned for filter-based cancels with async=true.