EndpointsCancel a command

Sandboxes

Cancel a command

Stops a running command (SIGTERM, then SIGKILL after 5 seconds) and returns it. A finished command is returned unchanged. Requires run_commands. Commands and file operations need an ACTIVE sandbox; on any other state they answer 409.

POST/sandboxes/{id}/commands/{command_id}:cancel
Authorizationstringheaderrequired

Bearer token for the authenticated caller.

Optional workspace/scope context for the request. Carries a single workspace wire id (ws_…) today. Only needed for broad tokens - a workspace-owned token implies its workspace.

Required string length: 1 - 53

Example: "ws_j572abc123def4"

idstringrequired

Sandbox id (sbx_...).

Pattern: ^sbx_[A-Za-z0-9]{1,64}$

Example: "sbx_j572abc123def456"

command_idstringrequired

Sandbox command id (cmd_...).

Pattern: ^cmd_[A-Za-z0-9]{1,64}$

Example: "cmd_j572abc123def456"

Response

application/json

SandboxCommand

idstringrequired

Sandbox command id (cmd_...).

Pattern: ^cmd_[A-Za-z0-9]{1,64}$

Example: "cmd_j572abc123def456"

sandbox_idstringrequired

Sandbox id (sbx_...).

Pattern: ^sbx_[A-Za-z0-9]{1,64}$

Example: "sbx_j572abc123def456"

argvstring[] | nullrequired
shellstring | nullrequired
cwdstringrequired
timeout_secondsintegerrequired
stateenum<string>required

SUCCEEDED: exited with code 0. FAILED: exited with another code, was killed, or hit its timeout (exit code 124).

Available options: RUNNING, SUCCEEDED, FAILED, CANCELLED

exit_codeinteger | nullrequired

Set once the command finished.

created_byobjectrequired
child attributes
created_by.typeenum<string>required

user: a workspace member. opencode: an OpenCode Server (oc_...).

Available options: user, opencode

created_by.idstringrequired

Required string length: 1 - 100

created_atintegerrequired

Start time (Unix seconds).

Required range: x >= 0

finished_atinteger | nullrequired

Finish time (Unix seconds).

Required range: x >= 0

outputobject | nullrequired

Captured output, only on the response to a wait: true request that finished in time; null elsewhere.

child attributes
output.stdoutstringrequired
output.stderrstringrequired
output.truncatedbooleanrequired

True when the output is longer than the 64 KiB returned here; read it all with logs:stream.