curl --request POST \
--url https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}/run/cancel \
--header 'Content-Type: application/json' \
--header 'x-service-key: {YOUR_SERVICE_KEY}' \
--data '{
"runId": "{YOUR_RUN_ID}"
}'
import requests
workflow_id = "{YOUR_WORKFLOW_ID}"
url = f"https://operator.opus.com/api/v1/workflow/{workflow_id}/run/cancel"
headers = {
"Content-Type": "application/json",
"x-service-key": "{YOUR_SERVICE_KEY}"
}
payload = {"runId": "{YOUR_RUN_ID}"} # optional — defaults to the active run
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const workflowId = "{YOUR_WORKFLOW_ID}";
const response = await fetch(
`https://operator.opus.com/api/v1/workflow/${workflowId}/run/cancel`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-service-key": "{YOUR_SERVICE_KEY}",
},
body: JSON.stringify({
runId: "{YOUR_RUN_ID}",
}),
}
);
const data = await response.json();
console.log(data);
{
"cancelled": true,
"run_id": "{RUN_ID}",
"workflow_id": "{WORKFLOW_ID}"
}
Workflows
Cancel a Run
Stop an in-progress generation run
POST
/
api
/
v1
/
workflow
/
{workflowId}
/
run
/
cancel
curl --request POST \
--url https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}/run/cancel \
--header 'Content-Type: application/json' \
--header 'x-service-key: {YOUR_SERVICE_KEY}' \
--data '{
"runId": "{YOUR_RUN_ID}"
}'
import requests
workflow_id = "{YOUR_WORKFLOW_ID}"
url = f"https://operator.opus.com/api/v1/workflow/{workflow_id}/run/cancel"
headers = {
"Content-Type": "application/json",
"x-service-key": "{YOUR_SERVICE_KEY}"
}
payload = {"runId": "{YOUR_RUN_ID}"} # optional — defaults to the active run
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const workflowId = "{YOUR_WORKFLOW_ID}";
const response = await fetch(
`https://operator.opus.com/api/v1/workflow/${workflowId}/run/cancel`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-service-key": "{YOUR_SERVICE_KEY}",
},
body: JSON.stringify({
runId: "{YOUR_RUN_ID}",
}),
}
);
const data = await response.json();
console.log(data);
{
"cancelled": true,
"run_id": "{RUN_ID}",
"workflow_id": "{WORKFLOW_ID}"
}
Stop an in-progress generation run. This stops the AI agents from doing any further work on the run.
Requires the Workflow: Full permission in the workflow’s workspace.
Work already applied to the workflow is kept. Cancelling stops future work — it doesn’t roll anything back.
Path Parameters
The ID of the workflow whose run you want to cancel. This is the
workflowId returned from Generate a Workflow.Headers
Body Parameters
Response
Errors
Missing, invalid, or expired API key, or the key’s user is no longer a member of the organization.
The user does not have access to this workflow, or lacks the Workflow: Full permission in its workspace.
curl --request POST \
--url https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}/run/cancel \
--header 'Content-Type: application/json' \
--header 'x-service-key: {YOUR_SERVICE_KEY}' \
--data '{
"runId": "{YOUR_RUN_ID}"
}'
import requests
workflow_id = "{YOUR_WORKFLOW_ID}"
url = f"https://operator.opus.com/api/v1/workflow/{workflow_id}/run/cancel"
headers = {
"Content-Type": "application/json",
"x-service-key": "{YOUR_SERVICE_KEY}"
}
payload = {"runId": "{YOUR_RUN_ID}"} # optional — defaults to the active run
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const workflowId = "{YOUR_WORKFLOW_ID}";
const response = await fetch(
`https://operator.opus.com/api/v1/workflow/${workflowId}/run/cancel`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-service-key": "{YOUR_SERVICE_KEY}",
},
body: JSON.stringify({
runId: "{YOUR_RUN_ID}",
}),
}
);
const data = await response.json();
console.log(data);
{
"cancelled": true,
"run_id": "{RUN_ID}",
"workflow_id": "{WORKFLOW_ID}"
}
Was this page helpful?