SandboxREST APIE2B-compatible routes

E2B-compatible routes

These routes accept E2B’s REST request and response shapes. Send your Tangle API key in X-API-Key, as E2B’s API expects, or as a bearer token.

Every route is on https://sandbox.tangle.tools and takes your account API key as Authorization: Bearer <key> unless it says otherwise. Errors use the shape in Error codes. This page is generated from the OpenAPI document, which also has every response schema.

E2B compatibility

RouteDoes
POST /e2b/sandboxesCreate a sandbox
GET /e2b/sandboxesList sandboxes
GET /e2b/sandboxes/{sandboxID}Get a sandbox
DELETE /e2b/sandboxes/{sandboxID}Kill a sandbox
GET /e2b/sandboxes/{sandboxID}/filesRead a file
POST /e2b/sandboxes/{sandboxID}/filesWrite a file
DELETE /e2b/sandboxes/{sandboxID}/filesDelete a file
GET /e2b/sandboxes/{sandboxID}/files/listList a directory
POST /e2b/sandboxes/{sandboxID}/processesRun a command
GET /e2b/sandboxes/{sandboxID}/processes/{pid}Get a process
DELETE /e2b/sandboxes/{sandboxID}/processes/{pid}Kill a process
POST /e2b/sandboxes/{sandboxID}/timeoutSet a sandbox timeout
GET /e2b/templatesList templates

Create a sandbox

POST /e2b/sandboxes

E2B’s POST /sandboxes. templateID is an id from GET /e2b/templates; timeout is the lifetime in seconds (default 15). Answers once the sandbox runs.

Authentication: an API key in X-API-Key or an API key as a bearer token.

Request body (application/json):

FieldTypeRequiredDescription
templateIDstringYes
metadataobjectNo
envVarsobjectNo
timeoutnumberNo
securebooleanNo
allow_internet_accessbooleanNo
autoPausebooleanNo
autoResumeobjectNo
StatusMeaning
201Running sandbox
400Invalid request
401Missing or invalid API key
defaultAny other Sandbox API refusal, with its status and Retry-After header

List sandboxes

GET /e2b/sandboxes

E2B’s GET /sandboxes.

Authentication: an API key in X-API-Key or an API key as a bearer token.

StatusMeaning
200Sandboxes
400Invalid request
401Missing or invalid API key
defaultAny other Sandbox API refusal, with its status and Retry-After header

Get a sandbox

GET /e2b/sandboxes/{sandboxID}

E2B’s GET /sandboxes/{sandboxID}.

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring
StatusMeaning
200Sandbox
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
defaultAny other Sandbox API refusal, with its status and Retry-After header

Kill a sandbox

DELETE /e2b/sandboxes/{sandboxID}

E2B’s DELETE /sandboxes/{sandboxID}. Answers after the sandbox is removed.

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring
StatusMeaning
204Removed
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
defaultAny other Sandbox API refusal, with its status and Retry-After header

Read a file

GET /e2b/sandboxes/{sandboxID}/files

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring
pathqueryYesstringAbsolute path in the sandbox.
StatusMeaning
200File content
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
defaultAny other Sandbox API refusal, with its status and Retry-After header

Write a file

POST /e2b/sandboxes/{sandboxID}/files

Send multipart fields path and file, or the raw bytes with ?path=. Files above 5242880 bytes answer 413.

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring
pathqueryNostringAbsolute path in the sandbox.

Request body (multipart/form-data):

FieldTypeRequiredDescription
pathstringYes
filestringYes
StatusMeaning
200File written
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
413File too large
defaultAny other Sandbox API refusal, with its status and Retry-After header

Delete a file

DELETE /e2b/sandboxes/{sandboxID}/files

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring
pathqueryYesstringAbsolute path in the sandbox.
StatusMeaning
204Deleted
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
defaultAny other Sandbox API refusal, with its status and Retry-After header

List a directory

GET /e2b/sandboxes/{sandboxID}/files/list

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring
pathqueryYesstringAbsolute path in the sandbox.
StatusMeaning
200Directory entries
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
defaultAny other Sandbox API refusal, with its status and Retry-After header

Run a command

POST /e2b/sandboxes/{sandboxID}/processes

Runs the command to completion and answers with its exit code and output. The E2B SDK’s commands.run talks to the sandbox directly instead; this route is for plain HTTP callers.

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring

Request body (application/json):

FieldTypeRequiredDescription
cmdstringYesRuns as /bin/sh -c <cmd>.
cwdstringNo
envsobjectNo
timeoutnumberNoMilliseconds.
StatusMeaning
200Finished process
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
defaultAny other Sandbox API refusal, with its status and Retry-After header

Get a process

GET /e2b/sandboxes/{sandboxID}/processes/{pid}

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring
pidpathYesstring
StatusMeaning
200Process
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
defaultAny other Sandbox API refusal, with its status and Retry-After header

Kill a process

DELETE /e2b/sandboxes/{sandboxID}/processes/{pid}

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring
pidpathYesstring
StatusMeaning
204Killed
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
defaultAny other Sandbox API refusal, with its status and Retry-After header

Set a sandbox timeout

POST /e2b/sandboxes/{sandboxID}/timeout

E2B’s POST /sandboxes/{sandboxID}/timeout. Timeout updates are not supported: a valid request answers 501.

Authentication: an API key in X-API-Key or an API key as a bearer token.

ParameterInRequiredTypeDescription
sandboxIDpathYesstring

Request body (application/json):

FieldTypeRequiredDescription
timeoutnumberYesSeconds.
StatusMeaning
204Timeout set
400Invalid request
401Missing or invalid API key
403The key may not use this sandbox
404Sandbox or path not found
501Timeout updates are not supported
defaultAny other Sandbox API refusal, with its status and Retry-After header

List templates

GET /e2b/templates

One template per coding agent backend; pass its templateID to POST /e2b/sandboxes.

Authentication: an API key in X-API-Key or an API key as a bearer token.

StatusMeaning
200Templates
400Invalid request
401Missing or invalid API key
defaultAny other Sandbox API refusal, with its status and Retry-After header

Next steps