Cancel flow run
POST /v1/organisations/{organisation_id}/spaces/{space_id}/flow-runs/{run_id}/cancel
Cancels a run: people who can run the flow and space admins; a test run only its tester.
Authentication
Send an API key, or an access token from your organisation’s identity provider, in the Authorization header. How API keys work
Any API key can call this operation; it needs no scope.
Security schemes in the OpenAPI document: session_cookie (cookie __Host-ivy_session)bearer (bearer)api_key (bearer)
Parameters
-
organisation_idpathstringrequired -
space_idpathstringrequired -
run_idpathstringrequired
Responses
-
The run, cancelled: its current step was stopped; a run that has finished is returned as it is
-
unauthenticated -
workspace_content_restricted,insufficient_scope,forbidden -
No such run, or flows are off
-
workspace_archived -
rate_limited: the API key's requests per minute are used up; retry afterRetry-Afterseconds -
internal -
workflow_unavailable: runs can't be changed right now; orunavailable: the database is briefly unavailable; retry afterRetry-Afterseconds
Error codes
Errors come back as an ErrorBody whose code is one of these.
- 401
unauthenticated - 403
workspace_content_restrictedinsufficient_scopeforbidden - 404
not_foundgeneric code for this status - 409
workspace_archived - 429
rate_limited - 500
internal - 503
workflow_unavailableunavailable
Examples
curl -X POST "$IVY_API_URL/v1/organisations/$ORGANISATION_ID/spaces/$SPACE_ID/flow-runs/$RUN_ID/cancel" \
-H "Authorization: Bearer $IVY_API_KEY" import { client, cancelFlowRun } from "@spacivapp/ivy-sdk";
client.setConfig({
baseUrl: process.env.IVY_API_URL,
headers: { Authorization: `Bearer ${process.env.IVY_API_KEY}` },
});
const { data, error, response } = await cancelFlowRun({
path: { organisation_id: organisationId, space_id: spaceId, run_id: runId },
}); {
"acted_as_person": false,
"can_run_again": false,
"content_visible": false,
"conversation_id": "conversation_123",
"created_at": "2026-01-15T09:30:00Z",
"credits_ucr": 1,
"erased": false,
"failure_code": "string",
"finished_at": "2026-01-15T09:30:00Z",
"flow_id": "flow_123",
"graph": false,
"id": "id_123",
"input": {},
"reused_from": "string",
"space_id": "space_123",
"started_by": "string",
"status": "queued",
"steps": [
{
"after": [
"string"
],
"attempt": 1,
"details": {},
"finished_at": "2026-01-15T09:30:00Z",
"item": 0,
"path": "string",
"reused": false,
"reused_from": "string",
"reused_from_started_at": "2026-01-15T09:30:00Z",
"skip_reason": "condition",
"started_at": "2026-01-15T09:30:00Z",
"status": "queued",
"step_id": "step_123"
}
],
"test": false,
"trigger_id": "trigger_123",
"trigger_kind": "string",
"version_id": "version_123",
"waiting_for": [
{
"ask_id": "ask_123",
"people": [
"string"
],
"reminded_at": "2026-01-15T09:30:00Z",
"since": "2026-01-15T09:30:00Z",
"status": "draft",
"step_id": "step_123"
}
],
"waiting_on": [
"string"
],
"workflow_id": "workflow_123",
"workspace_id": "workspace_123"
}