Skip to main content
POST
/
api
/
sandboxes
/
{id}
/
exec
Create Exec Session
curl --request POST \
  --url https://app.opencomputer.dev/api/sandboxes/{id}/exec \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "cmd": "<string>",
  "args": [
    "<string>"
  ],
  "envs": {},
  "cwd": "<string>",
  "timeout": 123,
  "maxRunAfterDisconnect": 123
}
'
{
  "sessionID": "es-abc123",
  "sandboxID": "sb-abc123",
  "command": "node",
  "args": ["server.js"],
  "running": true,
  "exitCode": null,
  "startedAt": "2025-01-15T10:30:00Z",
  "attachedClients": 0
}
Start a long-running command as a session. Attach via WebSocket to stream I/O.
id
string
required
Sandbox ID
cmd
string
required
Command to execute
args
string[]
Command arguments
envs
object
Environment variables
cwd
string
Working directory
timeout
integer
Timeout in seconds
maxRunAfterDisconnect
integer
Seconds to keep running after all clients disconnect
{
  "sessionID": "es-abc123",
  "sandboxID": "sb-abc123",
  "command": "node",
  "args": ["server.js"],
  "running": true,
  "exitCode": null,
  "startedAt": "2025-01-15T10:30:00Z",
  "attachedClients": 0
}