Why there’s no public cancel
Almost every Runflow model completes in under 60 seconds. By the time a caller decides to cancel, the run is usually already finishing or about to bill anyway. Adding a public cancel surfaces race conditions (cancel-after-success) and partial-charge ambiguity without saving meaningful time or money. So the API ships without one. The admin endpoint exists for operational override: shutting down a stuck run, responding to an abuse report, or honoring a customer ticket that asks for one specific run to be killed.When to use it
- A run is stuck in
queuedorrunninglonger than the model’s typical envelope and the customer needs the slot freed for retries. - You are an org admin processing a support ticket asking to cancel a specific run.
- You are responding to an abuse pattern and want to terminate the offending run while you investigate the key.
Behavior
POST /v1/admin/runs/{run_id}/cancellation atomically transitions a non-terminal run to cancelled and queues a run.cancelled audit side effect.
- Idempotent on terminal runs. Hitting it on an already-
succeeded/failed/cancelledrun returns the run unchanged with200 OK. No audit log entry, no callback re-fire. 201 Createdon a real cancellation transition. The status-code difference lets audit-tailers distinguish “I caused this” from “someone got there first.”- Does not abort the in-flight inference. The compute job keeps running on the provider side. Late callbacks land on the now-cancelled run and are silently dropped by the terminal-state guard.
- Billing follows the underlying job. Cancellation does not auto-refund; the run bills whatever the provider charged for the work performed up to the cancel.
Request
reason:
Response
Both200 and 201 return the post-cancel Run object (same shape as GET /v1/runs/{id}). Inspect status_code to confirm:
canceled; webhook event names use UK cancelled. Both literals are stable.
Errors
Related
Runs
Lifecycle, statuses, polling.
Callbacks
Note: late callbacks on cancelled runs are dropped.
Authentication
Service vs inference keys.
Errors
Status codes and error envelope.