Skip to main content
POST

Authorizations

X-Access-Token
string
header
required

Sandbox data-plane token — the sandbox_access_token returned by the create/connect endpoints. Used for /files, Sandbox-Exec, and other data-plane endpoints; the control plane (/api/v2) does not accept it, and conversely the control plane's Authorization: Bearer is invalid on the data plane.

The token is bound to its sandbox: using sandbox A's token against sandbox B's host fails. It stays valid until the sandbox's lifetime ends; there is no separate rotation endpoint (rotate_traffic_token rotates the port traffic token traffic_access_token and does not affect this one).

Headers

X-Request-ID
string

Ignored. The server generates its own request ID (req-<uuid>) for every request and returns it in the X-Request-ID response header and the body's request_id.

Required string length: 1 - 128

Body

application/json

Exactly one control command:

  • action=resize requires cols and rows (each 1..1000) and an active WebSocket attach.
  • action=close takes no other fields and does not require an active connection. Unknown action values or extra fields are rejected with 400 Shell.InvalidRequest.
action
enum<string>
required

resize applies a new terminal size to the live PTY; close irrevocably terminates the shell (PTY killed, state deleted, any existing WebSocket severed within about one second).

Available options:
resize,
close
cols
integer

Terminal width in columns. Required when action=resize; must be omitted for close.

Required range: 1 <= x <= 1000
rows
integer

Terminal height in rows. Required when action=resize; must be omitted for close.

Required range: 1 <= x <= 1000

Response

Control applied. status=attached after a successful resize; status=closed after a successful close.

request_id
string
required

Server-generated request ID (req-<uuid>), identical to the X-Request-ID response header.

sandbox_key
string
required

Echo of the data-plane addressing key (i.e. sandbox_key, the leftmost label of the request host).

status
enum<string>
required

Public status of the sandbox shell session.

  • creating: a launch is in progress (only appears with 202).
  • ready: the PTY exists and can be attached.
  • attached: the shell exists and currently has an active WebSocket connection (a second attach would get 409).
  • closed: the shell has been terminated by action=close and can never be re-attached.
Available options:
creating,
ready,
attached,
closed