curl --request POST \
--url 'https://api.sandbox.stateset.app/api/v1/sandbox/{id}/execute' \
--header "Authorization: Bearer $STATESET_SANDBOX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"command": "string",
"working_dir": "string",
"env": {},
"stream": true,
"timeout": 250,
"sandbox_epoch": 1
}'
{
"execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"exit_code": 1,
"stdout": "string",
"stderr": "string",
"output_truncated": true
}
Execute a command in a sandbox
Command result. With stream: true the response is a text/event-stream instead: SSE events with JSON payloads {type: 'stdout'|'stderr', data}, {type:…
POST
/
api
/
v1
/
sandbox
/
{id}
/
execute
curl --request POST \
--url 'https://api.sandbox.stateset.app/api/v1/sandbox/{id}/execute' \
--header "Authorization: Bearer $STATESET_SANDBOX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"command": "string",
"working_dir": "string",
"env": {},
"stream": true,
"timeout": 250,
"sandbox_epoch": 1
}'
{
"execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"exit_code": 1,
"stdout": "string",
"stderr": "string",
"output_truncated": true
}
Path parameters
string (uuid)
required
Sandbox identifier
Request body
ExecuteCommandRequest
string
required
string
object
boolean
integer
integer
Response
object
string
required
Identifier for this execution record
integer
required
string
required
string
required
boolean
Present (true) only when captured output was truncated
Status codes
| Code | Meaning | |
|---|---|---|
200 | Command result. With stream: true the response is a text/event-stream instead: SSE events with JSON payloads `{type: ‘stdout' | 'stderr’, data}, {type: ‘truncated’, output_truncated, message}(output capped at 8MB),{type: ‘error’, error, code?}, {type: ‘exit’, code, output_truncated?}and{type: ‘done’}, each with an SSE idusable asLast-Event-IDto resume, plus: heartbeat` comments every 20s. |
202 | Execution queued because the org’s concurrent execute limit is reached and queue mode is enabled. Retry-After and X-Stateset-Queue-Position headers are set. | |
404 | Sandbox not found |
curl --request POST \
--url 'https://api.sandbox.stateset.app/api/v1/sandbox/{id}/execute' \
--header "Authorization: Bearer $STATESET_SANDBOX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"command": "string",
"working_dir": "string",
"env": {},
"stream": true,
"timeout": 250,
"sandbox_epoch": 1
}'
{
"execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"exit_code": 1,
"stdout": "string",
"stderr": "string",
"output_truncated": true
}
Last modified on August 31, 2026