curl -XDELETE https://qstash.upstash.io/v2/workflows/runs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <QSTASH_TOKEN>" \
-d '{"workflowUrl": "https://example.com"}'
import { Client } from "@upstash/workflow";
// cancel a set of workflow runs
await client.cancel({ ids: [
"<WORKFLOW_RUN_ID_1>",
"<WORKFLOW_RUN_ID_2>",
]})
// cancel workflows starting with a url
await client.cancel({ urlStartingWith: "https://your-endpoint.com" })
// cancel all workflows
await client.cancel({ all: true })
const response = await fetch('https://qstash.upstash.io/v2/workflows/runs', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
body: {
workflowRunIds: [
"run_id_1",
"run_id_2",
"run_id_3",
],
},
}
});
import requests
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
}
data = {
"workflowRunIds": [
"run_id_1",
"run_id_2",
"run_id_3"
]
}
response = requests.delete(
'https://qstash.upstash.io/v2/workflows/runs',
headers=headers,
data=data
)
var data = strings.NewReader(`{
"workflowRunIds": [
"run_id_1",
"run_id_2",
"run_id_3"
]
}`)
req, err := http.NewRequest("DELETE", "https://qstash.upstash.io/v2/workflows/runs", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
{
"cancelled": 10
}
Runs
Bulk Cancel Workflows
Cancel multiple workflow runs
DELETE
/
v2
/
workflows
/
runs
curl -XDELETE https://qstash.upstash.io/v2/workflows/runs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <QSTASH_TOKEN>" \
-d '{"workflowUrl": "https://example.com"}'
import { Client } from "@upstash/workflow";
// cancel a set of workflow runs
await client.cancel({ ids: [
"<WORKFLOW_RUN_ID_1>",
"<WORKFLOW_RUN_ID_2>",
]})
// cancel workflows starting with a url
await client.cancel({ urlStartingWith: "https://your-endpoint.com" })
// cancel all workflows
await client.cancel({ all: true })
const response = await fetch('https://qstash.upstash.io/v2/workflows/runs', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
body: {
workflowRunIds: [
"run_id_1",
"run_id_2",
"run_id_3",
],
},
}
});
import requests
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
}
data = {
"workflowRunIds": [
"run_id_1",
"run_id_2",
"run_id_3"
]
}
response = requests.delete(
'https://qstash.upstash.io/v2/workflows/runs',
headers=headers,
data=data
)
var data = strings.NewReader(`{
"workflowRunIds": [
"run_id_1",
"run_id_2",
"run_id_3"
]
}`)
req, err := http.NewRequest("DELETE", "https://qstash.upstash.io/v2/workflows/runs", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
{
"cancelled": 10
}
Bulk cancel allows you to cancel multiple workflow runs at once.
This operation scans all your workflow runs and attempts to cancel them.
If a specific workflow run cannot be canceled, it will return an error message.
Therefore, some workflow runs may not be cancelled at the end.
In such cases, you can run the bulk cancel operation multiple times.
If you provide a list of workflow run IDs in the request body, only those specific workflow runs will be canceled.If you include the workflow URL parameter, all workflow runs matching the URL filter will be canceled.If the request body is empty, all workflow runs will be canceled.
Request
The list of workflow run IDs to cancel.
The prefix filter to match workflow run URLs. Workflow runs with URLs starting with this prefix will be canceled.
Response
A cancelled object with the number of cancelled workflow runs.{
"cancelled": number
}
curl -XDELETE https://qstash.upstash.io/v2/workflows/runs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <QSTASH_TOKEN>" \
-d '{"workflowUrl": "https://example.com"}'
import { Client } from "@upstash/workflow";
// cancel a set of workflow runs
await client.cancel({ ids: [
"<WORKFLOW_RUN_ID_1>",
"<WORKFLOW_RUN_ID_2>",
]})
// cancel workflows starting with a url
await client.cancel({ urlStartingWith: "https://your-endpoint.com" })
// cancel all workflows
await client.cancel({ all: true })
const response = await fetch('https://qstash.upstash.io/v2/workflows/runs', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
body: {
workflowRunIds: [
"run_id_1",
"run_id_2",
"run_id_3",
],
},
}
});
import requests
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
}
data = {
"workflowRunIds": [
"run_id_1",
"run_id_2",
"run_id_3"
]
}
response = requests.delete(
'https://qstash.upstash.io/v2/workflows/runs',
headers=headers,
data=data
)
var data = strings.NewReader(`{
"workflowRunIds": [
"run_id_1",
"run_id_2",
"run_id_3"
]
}`)
req, err := http.NewRequest("DELETE", "https://qstash.upstash.io/v2/workflows/runs", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
{
"cancelled": 10
}
Was this page helpful?
⌘I