curl --silent --show-error --fail-with-body --no-buffer --request POST \
--url 'https://api.sandbox.stateset.app/api/v1/sandbox/{id}/execute' \
--header 'Authorization: ApiKey YOUR_API_KEY' \
--header "Idempotency-Key: ${IDEMPOTENCY_KEY:?Set a unique key for this operation; preserve it on retries}" \
--header 'Content-Type: application/json' \
--data '{
"command": "string",
"working_dir": "string",
"env": {},
"stream": true,
"timeout": 1000,
"sandbox_epoch": 1
}'
{
"execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"exit_code": 0,
"stdout": "sandbox-ok",
"stderr": ""
}
Execute a command in a sandbox
Command result; inspect confirmed exit and system_error/outcome…
POST
/
api
/
v1
/
sandbox
/
{id}
/
execute
curl --silent --show-error --fail-with-body --no-buffer --request POST \
--url 'https://api.sandbox.stateset.app/api/v1/sandbox/{id}/execute' \
--header 'Authorization: ApiKey YOUR_API_KEY' \
--header "Idempotency-Key: ${IDEMPOTENCY_KEY:?Set a unique key for this operation; preserve it on retries}" \
--header 'Content-Type: application/json' \
--data '{
"command": "string",
"working_dir": "string",
"env": {},
"stream": true,
"timeout": 1000,
"sandbox_epoch": 1
}'
{
"execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"exit_code": 0,
"stdout": "sandbox-ok",
"stderr": ""
}
Confirm your deployment before running this request. This page describes an API contract;
a published reference does not establish hosted availability. Check the dated
host report and obtain your deployment URL and credentials.
Replace the example host if your provisioned service uses a different URL.
Path parameters
string (uuid)
required
Sandbox identifier
Headers
string
Persist before first dispatch; exact retries retain principal, route, body and original result. Do not change keys to escape an uncertain mutation.
Request body
ExecuteCommandRequest
string | string[] | object
required
Minimum length:
1. Maximum length: 100000.string
Minimum length:
1. Maximum length: 4096.object
Additional keys map to values of type
string.boolean
integer
Minimum:
1000. Maximum: 600000.integer
Minimum:
0. Maximum: 9007199254740991.Response
object
string
required
Identifier for this execution record.
integer
required
string
required
string
required
boolean
Present (true) only when captured output was truncated.
string
exec_stream_lost means command outcome is unknown.
string
When present, do not interpret exit_code or HTTP 200 as success. Allowed values:
'unknown'.boolean
Observed result retained, receipt summary pending recovery; do not resubmit.
Status codes
| Code | Meaning |
|---|---|
200 | Command result; inspect confirmed exit and system_error/outcome. A lost post-start stream can return 200 with exec_stream_lost/outcome unknown and must not be replayed. record_pending retains an observed result whose receipt summary awaits recovery. With stream true, response is SSE with original execution/event identities. |
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 |
409 | CONFLICT with details.reason execution_result_unconfirmed: the command returned but result storage could not be confirmed within the persistence deadline. Inspect details.execution_id; retryable is false and the same idempotency key stays reserved. |
503 | Sandbox starting, recovering or unreachable (SERVICE_UNAVAILABLE, details.reason): the command did not start; retry after Retry-After. A connection lost after it may have started is a 200 with system_error exec_stream_lost, outcome unknown (not retried). |
Using this contract
Read the source OpenAPI document for declared schemas and alternatives. This page also includes documented corrections from the spec overlays. Example IDs and values are illustrative; replace them with records from your workspace.curl --silent --show-error --fail-with-body --no-buffer --request POST \
--url 'https://api.sandbox.stateset.app/api/v1/sandbox/{id}/execute' \
--header 'Authorization: ApiKey YOUR_API_KEY' \
--header "Idempotency-Key: ${IDEMPOTENCY_KEY:?Set a unique key for this operation; preserve it on retries}" \
--header 'Content-Type: application/json' \
--data '{
"command": "string",
"working_dir": "string",
"env": {},
"stream": true,
"timeout": 1000,
"sandbox_epoch": 1
}'
{
"execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"exit_code": 0,
"stdout": "sandbox-ok",
"stderr": ""
}
Last modified on October 20, 2026