Docs menu

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_id path string required
  • space_id path string required
  • run_id path string required

Responses

  • 200 application/json FlowRunView

    The run, cancelled: its current step was stopped; a run that has finished is returned as it is

  • 401 application/json ErrorBody

    unauthenticated

  • 403 application/json ErrorBody

    workspace_content_restricted, insufficient_scope, forbidden

  • 404 application/json ErrorBody

    No such run, or flows are off

  • 409 application/json ErrorBody

    workspace_archived

  • 429 application/json ErrorBody

    rate_limited: the API key's requests per minute are used up; retry after Retry-After seconds

  • 500 application/json ErrorBody

    internal

  • 503 application/json ErrorBody

    workflow_unavailable: runs can't be changed right now; or unavailable: the database is briefly unavailable; retry after Retry-After seconds

Error codes

Errors come back as an ErrorBody whose code is one of these.

  • 401 unauthenticated
  • 403 workspace_content_restrictedinsufficient_scopeforbidden
  • 404 not_found generic code for this status
  • 409 workspace_archived
  • 429 rate_limited
  • 500 internal
  • 503 workflow_unavailableunavailable

Examples

curl
curl -X POST "$IVY_API_URL/v1/organisations/$ORGANISATION_ID/spaces/$SPACE_ID/flow-runs/$RUN_ID/cancel" \
  -H "Authorization: Bearer $IVY_API_KEY"
JavaScript SDK
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 },
});
Example response (200)
{
  "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"
}