Skip to main content
POST
Run a command in a sandbox

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string

Optional client-chosen key (e.g. a UUID, at most 255 characters) that makes the call safe to retry. Within 24 h, the same key with the same request returns the stored response instead of acting twice; the same key with a different request fails with idempotency_key_reused; a request with a key that's still being processed fails with request_in_progress.

Required string length: 1 - 255

Path Parameters

sandbox_id
string
required

Sandbox ID (sb-…).

Required string length: 1 - 64

Body

application/json

A command to run in a running sandbox.

command
string[]
required

Argv to run, e.g. ["python", "train.py"]: at most 4096 arguments, each at most 131071 bytes in UTF-8, at most 1 MiB in total, with no NUL byte (else invalid_command).

Required array length: 1 - 4096 elements
env
object

Extra environment variables on top of the sandbox's environment. Same rules as on create: POSIX names, no TELNYX_SANDBOX_ prefix, size limits (else invalid_env).

timeout
integer | null

Stop the process after this many seconds (status terminated, reason timeout). Default: no limit. At most 2147483647 (about 68 years); it never outlives the sandbox.

Required range: 1 <= x <= 2147483647
workdir
string | null

Absolute working directory (else invalid_workdir). Defaults to the sandbox's working directory.

Maximum string length: 4096
Pattern: ^/

Response

The exec.

data
object
required

A process started in a sandbox. It keeps running when clients disconnect. Execs live as long as their sandbox.