Request idempotent cancellation
const url = 'https://example.com/v1/sessions/9f2b7c14-59d3-4f7a-b8e1-2a6c05d4e731/runs/9f2b7c14-59d3-4f7a-b8e1-2a6c05d4e731/cancel';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/sessions/9f2b7c14-59d3-4f7a-b8e1-2a6c05d4e731/runs/9f2b7c14-59d3-4f7a-b8e1-2a6c05d4e731/cancel \ --header 'Authorization: Bearer <token>'Requires wamp.cloud.runs:cancel. Always returns the current Run plus cancellationAccepted, which says whether this call registered a new cancel command — false means the Run was already terminal or a cancellation was already recorded, and neither is an error, so calling twice is safe. What happens next depends on where the Run is: a queued or awaiting Run is cancelled synchronously and comes back with status: "cancelled" (and its unresolved Interactions expired), while a dispatching or running Run comes back still running with cancellationRequested: true and is stopped asynchronously — watch for wamp.run.cancelled in the event log to know it landed. Cancelling never archives the Session or rolls back files already written.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”A UUID identifying one Cloud resource; Session, Turn, Publication and Merge ids are minted by the caller so an ambiguous retry addresses the same durable command instead of creating a second one.
Example
9f2b7c14-59d3-4f7a-b8e1-2a6c05d4e731A UUID you mint and own; it is the idempotency key for creation and the address of every Turn, artifact and publication underneath
A UUID identifying one Cloud resource; Session, Turn, Publication and Merge ids are minted by the caller so an ambiguous retry addresses the same durable command instead of creating a second one.
Example
9f2b7c14-59d3-4f7a-b8e1-2a6c05d4e731The Run UUID, which is the same value as the id of the Turn that created it
Responses
Section titled “Responses”Current Run and whether a new cancellation command was accepted
object
One durable execution attempt-set for a Turn. Exactly one Run exists per Turn, it survives worker loss and sandbox replacement, and only one Run per Session may be active at a time.
object
Run id, always equal to the id of the Turn that created it
Session this Run belongs to
queued, dispatching and running are in flight, awaiting means the agent is blocked on human input, and completed, failed, cancelled and crashed are terminal
How many times a worker has claimed this Run; recovery after a lost worker increments it instead of creating a second Run
Whether cancellation was durably requested; it stays true after the Run terminates, and it never asserts that an external side effect was undone
Coarse machine code for the most recent failure, retained across retries; absent when nothing has failed
object
When admission committed this Run in queued
Last durable Run state change
When a worker actually began executing; absent while the Run is still queued
When the Run reached a terminal status; absent otherwise
Example
{ "run": { "id": "c47a1e08-3d6b-4a92-9f15-8b70d2e5c6a4", "sessionId": "9f2b7c14-59d3-4f7a-b8e1-2a6c05d4e731", "status": "running", "attempts": 1, "cancellationRequested": true, "createdAt": "2026-08-12T09:20:31Z", "updatedAt": "2026-08-12T09:38:55Z", "startedAt": "2026-08-12T09:21:07Z" }, "cancellationAccepted": true}The resource is missing or inaccessible
Failure body returned with every non-2xx JSON response; branch on the machine code, never on prose or on the HTTP status alone.
object
Stable machine code
The installation capability the presented credential lacks, returned with insufficient_scope so an integrator knows exactly which capability to request
Advisory seconds to wait before retrying; returned on rate-limit denials, where the Retry-After header carries the same value
Example
{ "error": "cloud_session_not_found"}A retryable workspace, runtime or provider condition
Failure body returned with every non-2xx JSON response; branch on the machine code, never on prose or on the HTTP status alone.
object
Stable machine code
The installation capability the presented credential lacks, returned with insufficient_scope so an integrator knows exactly which capability to request
Advisory seconds to wait before retrying; returned on rate-limit denials, where the Retry-After header carries the same value
Example
{ "error": "cloud_workspace_unavailable"}