POST
/workflows/{wflId}/runs/{wfrId}/cancelCancel Workflow Run
Cancels a workflow run that is in pending or running status, halting execution at the current step.
Requires the PROJECT_AUTHOR role.
Returns K9O_WORKFLOW_RUN_NOT_CANCELLABLE (409) if the run has already reached a terminal status (succeeded, failed, or cancelled).
Parameters
| wflId * | path | The workflow id ( |
| wfrId * | path | The run id ( |
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
Responses
| HTTP | K9O Code | Description |
|---|---|---|
| 200 | Success | |
| 401 | K9O_INVALID_CREDENTIALS | The request was made without a valid session or bearer token. |
| 401 | K9O_SESSION_EXPIRED | Your session has expired; re-authenticate and retry. |
| 403 | K9O_ACCESS_DENIED | Cancelling a workflow run requires the PROJECT_AUTHOR role; your current role does not grant it. |
| 404 | K9O_WORKFLOW_NOT_FOUND | No workflow with the supplied workflow ID exists in this project. |
| 404 | K9O_WORKFLOW_RUN_NOT_FOUND | No run with the supplied run ID exists for this workflow, or it is not within your project scope. |
| 409 | K9O_WORKFLOW_RUN_NOT_CANCELLABLE | The run has already completed — only runs in a pending or running state can be cancelled. |
Response body (200)
| data * | object | The run that was cancelled. |
| id * | string | The cancelled run ( |
| status * | "cancelled" | Always A step already in flight finishes, but no further step starts. |
| meta * | any |
TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.studio.workflows.runs.cancel('wfl_demo00000001', 'wfr_demo00000001')Showing example in TypeScript
Response example (200)
{
"data": {
"id": "string",
"status": "cancelled"
}
}