Skip to main content
POST
Python (Connect framing)

Authorizations

X-Access-Token
string
header
required

Sandbox access token (envdAccessToken) for authenticating requests to a running sandbox. Returned by: POST /sandboxes (on create), POST /sandboxes/{sandboxID}/connect (on connect), POST /sandboxes/{sandboxID}/resume (on resume), and GET /sandboxes/{sandboxID} (for running or paused sandboxes).

Headers

Connect-Protocol-Version
enum<string>
required
Available options:
1
Connect-Timeout-Ms
number

Define the timeout, in ms

E2b-Sandbox-Id
string
required

Identifier of the target sandbox. Routes the request to that sandbox's envd over the shared sandbox host.

E2b-Sandbox-Port
integer
default:49983
required

Port envd listens on inside the sandbox (default 49983).

Body

application/connect+json

Send Connect-framed bytes with Content-Type application/connect+json. Each uncompressed request frame begins with flags byte 0, then the JSON payload length as four big-endian bytes, then the UTF-8 JSON payload. The decoded payload follows #/components/schemas/filesystem.WatchDirRequest (x-connect-message-schema). Sending a bare JSON document does not encode a valid Connect request frame.

The body is of type file.

Response

Stream of WatchDirResponse events Decoded terminal error example (the wire also includes the five-byte frame prefix): {"error":{"code":"not_found","message":"path /tmp/missing not found: stat /tmp/missing: no such file or directory"}}. Connect-framed bytes, not an ordinary JSON document. Each frame has a one-byte flags field and a four-byte big-endian payload length. The decoded data payload follows x-connect-message-schema. The final frame has flags=2 and follows x-connect-end-stream-schema. RPC failures appear in its error object while the HTTP status remains 200. Authentication or routing failures before the stream can use the separate HTTP responses below.

The response is of type file.