Run a command
Run a shell command in the sandbox, in /home/user unless cwd says otherwise.
Synchronous by default: the response carries the exit code and output, waiting up to timeoutSeconds (max 120). Set background for anything longer: the response is 202 with a command id to poll.
A command is never retried: if the call fails mid-way, the command may still be running. Not available with test-mode keys.
Authorization
AuthorizationheaderrequiredBearer YOUR_API_KEY. Create a key in the dashboard.
Path parameters
sandboxIdstringrequiredSandbox ID.
Body
application/json
commandstringrequiredRun with a shell, so pipes and
&&work.Limitsmax length 65536cwdstringWorking directory, relative to
/home/user.timeoutSecondsintegerFor a synchronous command: how long to wait before it is killed and
timedOutis true. Usebackgroundfor anything longer.Default30Limitsmin 1 · max 120backgroundbooleanStart it and return a command
idat once. Read its status and output withGET /v1/sandboxes/{sandboxId}/commands/{commandId}.Defaultfalse
Responses
200The command finished, or was killed at its timeout. `result` is set.
resultobject8 properties
exitCodeintegerrequiredNull when the command was killed.
stdoutstringrequiredstderrstringrequiredstdoutTruncatedbooleanrequiredstderrTruncatedbooleanrequiredtimedOutbooleanrequiredstartedAtstring<date-time>finishedAtstring<date-time>
commandobject2 properties
idstringrequiredPass it to
GET /v1/sandboxes/{sandboxId}/commands/{commandId}.statusstringrequiredOne ofrunning
202Started in the background. `command` is set.
resultobject8 properties
exitCodeintegerrequiredNull when the command was killed.
stdoutstringrequiredstderrstringrequiredstdoutTruncatedbooleanrequiredstderrTruncatedbooleanrequiredtimedOutbooleanrequiredstartedAtstring<date-time>finishedAtstring<date-time>
commandobject2 properties
idstringrequiredPass it to
GET /v1/sandboxes/{sandboxId}/commands/{commandId}.statusstringrequiredOne ofrunning
400Invalid body, or a test-mode key.
codestringrequiredmessagestringrequireddetailsobject
401Unauthorized.
codestringrequiredmessagestringrequireddetailsobject
404Sandbox not found, or it belongs to another project.
codestringrequiredmessagestringrequireddetailsobject
409`sandbox_not_running`: the sandbox is stopped, stopping, failed or deleted; resume it first. `sandbox_not_ready`: it is still starting and did not become ready in time; retry.
codestringrequiredmessagestringrequireddetailsobject
503`sandbox_unavailable`: no machine capacity right now. Nothing was charged for machine time; retry shortly.
codestringrequiredmessagestringrequireddetailsobject