Documentation
Compute plans and streams
View .mdOpenAPI

Cancel a compute plan

POSThttps://weights.fyi/run/v1/compute/plans/{plan_id}/cancelscope: submit
text
POST https://weights.fyi/run/v1/compute/plans/{plan_id}/cancel
Authorization: Bearer <token>                    scope: submit
Content-Type: application/json
Available since
2026-10-29: included in this build; see What is live for deployment status.
Answer time
synchronous cancellation commit; does not wait for running work to stop.

Cancels your plan. Every unfinished stage becomes cancelled, its unfinished packs are cancelled, its leases are fenced and its scoped stage tokens are revoked. Completed stages stay completed. The plan settles as cancelled and its capacity demand is released, so no new capacity is requested for it; when no other plan still needs capacity, the pool is marked ready to scale down.

A worker still holding a lease on the plan is refused with 409 stale_compute_lease on its next heartbeat or completion and settles no further work. Accrued cost stays on the receipt.

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer token with submit.
plan_idpathyesIdentifier of your plan.
reasonbodynoNon-empty string of at most 4,096 bytes, recorded on each cancelled stage and in the events. Omitted, it is cancelled_by_owner.

An empty body or {} is accepted. Otherwise send a JSON object of at most 1 MiB containing only reason.

Return value

200 OK with the current plan receipt: state is cancelled, the cancelled stages show cancelled, and readiness.capacity.state is released.

Cancellation is idempotent: cancelling an already cancelled plan returns its receipt unchanged and records no new events. A plan that already completed or failed is not cancelled; the call returns 409.

Each cancelled stage records stage.cancelled with error set to the reason and exit_code null; the plan records plan.cancelled with reason and cancelled_stages.

Errors

StatusCodeMeaning
400invalid_json, invalid_compute_planInvalid JSON, identifier, reason, non-object body or extra fields.
401unauthorized, invalid_token, token_revoked, token_expiredSupply a valid token.
403scope_required, account_suspendedToken lacks submit, or the account is suspended.
404compute_plan_not_foundPlan is absent or belongs to another account.
409compute_plan_conflictPlan already completed or failed. Read its receipt.
413body_too_largeBody exceeds 1 MiB.
429rate_limitedWait for Retry-After before retrying.

Examples

sh
curl -s https://weights.fyi/run/v1/compute/plans/PLAN_ID/cancel \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
  -d '{"reason":"superseded by a new plan"}'

Selected response fields:

json
{"plan_id":"example-plan","state":"cancelled","stages":[{"stage_id":"pages","state":"cancelled","packs_completed":3}],"readiness":{"ready":false,"active_workers":0,"capacity":{"state":"released"}},"last_event_seq":44}

History

  • 2026-10-29: documented owner cancellation with demand release and fenced leases.

See also