Run a command (streams frames)
POST/sandboxes/{id}/exec
Runs a command in the guest and streams the result as length-prefixed frames ([type:1][reserved:3][size:4 BE][payload]) where type is stdout, stderr, or exit; the exit payload is a JSON ExecResult. Set ?stdin=1 for a hijacked, full-duplex interactive exec.
path parameters
object
idstringrequiredSandbox ID, e.g. sbx_ab12cd34.
query parameters
object
stdinstringSet to "1" for an interactive, full-duplex exec (hijacked stream).
Request bodyapplication/json
ExecReq
cmdarray | null
items
string
cwdstringenvobject
additional properties
string
timeout_sintegerResponses
200 OKOK
stringbase64
400 Bad requestBad Request
ErrorResponse
errorstring404 Not foundNot Found
ErrorResponse
errorstringAuthentication
bearerAuthHTTP bearer. Daemon API key. Omit on a keyless loopback daemon.Request
▍POST/sandboxes/{id}/exec
curl '/sandboxes/{id}/exec?stdin=' \
-X POST \
-H 'Content-Type: application/json' \
-d '{}'const response = await fetch("/sandboxes/{id}/exec?stdin=", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: "{}",
});
const data = await response.json();import requests
response = requests.post(
"/sandboxes/{id}/exec?stdin=",
headers={
"Content-Type": "application/json",
},
data="{}",
)
data = response.json()Response
200 OK
No response body.