Skip to main content
POST
/
sandboxes
/
{sandbox_id}
/
exec
/
stream
Execute a command and stream output via SSE
curl --request POST \
  --url https://api-staging.superserve.ai/sandboxes/{sandbox_id}/exec/stream \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "command": "<string>",
  "args": [
    "<string>"
  ],
  "env": {},
  "working_dir": "<string>",
  "timeout_s": 30
}
'
{
  "timestamp": "2023-11-07T05:31:56Z",
  "stdout": "<string>",
  "stderr": "<string>",
  "exit_code": 123,
  "finished": true,
  "error": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.superserve.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

X-API-Key
string
header
required

Path Parameters

sandbox_id
string<uuid>
required

The unique identifier of the sandbox.

Body

application/json
command
string
required

Command to execute. Wrapped in /bin/sh -c unless args is provided.

Minimum string length: 1
args
string[]

If provided, command is used as the binary and args as arguments (no shell wrapping).

env
object

Environment variables for the command.

working_dir
string

Working directory (default /home/user).

timeout_s
integer
default:30

Timeout in seconds.

Response

SSE stream. Each line starting with data: contains a JSON ExecStreamEvent. The final event has finished: true.

A single SSE event payload emitted by the exec/stream endpoint.

timestamp
string<date-time>
stdout
string

Stdout chunk (present when the process wrote to stdout).

stderr
string

Stderr chunk (present when the process wrote to stderr).

exit_code
integer

Process exit code (present on the final event).

finished
boolean

True on the final event.

error
string

Error message if the exec itself failed (present on the final event on error).