Skip to main content
POST/workflows/{wflId}/runs/{wfrId}/cancel

Cancel 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 (wfl_...).

wfrId *path

The run id (wfr_...), from the runs list or the response that started the run.

projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Responses
HTTPK9O CodeDescription
200Success
401K9O_INVALID_CREDENTIALSThe request was made without a valid session or bearer token.
401K9O_SESSION_EXPIREDYour session has expired; re-authenticate and retry.
403K9O_ACCESS_DENIEDCancelling a workflow run requires the PROJECT_AUTHOR role; your current role does not grant it.
404K9O_WORKFLOW_NOT_FOUNDNo workflow with the supplied workflow ID exists in this project.
404K9O_WORKFLOW_RUN_NOT_FOUNDNo run with the supplied run ID exists for this workflow, or it is not within your project scope.
409K9O_WORKFLOW_RUN_NOT_CANCELLABLEThe 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 (wfr_...).

status *"cancelled"

Always cancelled.

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"
  }
}

More in Compute & Automation