Skip to content

Run a command in a running sandbox

POST
/sandboxes/{id}/exec
curl --request POST \
--url https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/exec \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "command": [ "example" ], "env": { "additionalProperty": "example" }, "cwd": "example", "user": "example", "stdin": "example" }'

With Accept: text/event-stream, output streams as server-sent events while the command runs: stdout and stderr events carry base64 data, and a final exit event carries the exit_code (or error if the command could not run). Otherwise the call waits for the command to finish and returns its output as text. Output is limited to 16 MB per stream without streaming.

id
required
string
Media typeapplication/json
object
command
required
Array<string>
>= 1 items
env
object
key
additional properties
string
cwd
string
user

User name or uid[:gid] inside the sandbox. Defaults to the image’s user.

string
stdin

Text passed to the command’s standard input (up to 1 MB).

string

Example generated

{
"command": [
"example"
],
"env": {
"additionalProperty": "example"
},
"cwd": "example",
"user": "example",
"stdin": "example"
}

The command’s output

object
exit_code
required
integer
stdout
required
string
stderr
required
string

Example generated

{
"exit_code": 1,
"stdout": "example",
"stderr": "example"
}

The request is invalid

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

The API key is missing or invalid

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

No such sandbox in your organization (or no such file)

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

The sandbox isn’t running, or its server is unreachable right now

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}