Cancel Workflow Run

Stored runs and access

Use the database-backed example workflow server and retain the returned workflow, run and session IDs. Configured authorization requires access to run the target workflow.

JWT user isolation is opt-in; non-admin service-account PAT callers always self-scope. Scoped callers can read only their own matching workflow sessions and runs. A wrong owner, missing record or cross-component ID returns 404. Authentication alone does not enable user isolation.

Request cancellation

Using IDs from the linked workflow server:

RUN_ID="returned-run-id"
SESSION_ID="returned-session-id"
curl --fail-with-body -X POST --get \
  "http://127.0.0.1:7777/workflows/echo/runs/$RUN_ID/cancel" \
  -H "Authorization: Bearer $OS_SECURITY_KEY" \
  --data-urlencode "session_id=$SESSION_ID"

Scoped callers require the session ID. 200 with {} acknowledges cancellation intent. Poll Get Workflow Run until a terminal state; the response does not prove the workflow stopped or undo external effects. An unscoped caller can receive this acknowledgement for an unknown run.

POST/workflows/{workflow_id}/runs/{run_id}/cancel

Cancel a currently executing workflow run, stopping all active steps and cleanup. Note: Complex workflows with multiple parallel steps may take time to fully cancel.

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

workflow_id*Workflow Id
run_id*Run Id

Query Parameters

session_id?|

Session ID the run belongs to. Required for non-admin JWT users.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl --request POST 'https://example.com/workflows/string/runs/string/cancel'
null