Skip to content
中文

Connect to a sandbox (v2)

Call Create sandbox first and replace sbx_123 with its returned sandboxID.

POST/e2b/v2/sandboxes/{sandboxID}/connect● Supported

Official E2B docs ↗

Request parameters

  • sandboxIDstringrequired

    path:

  • timeoutintegeroptional
    default 300

    Timeout in seconds from the current time after which the sandbox should expire

  • memorybooleanoptional

    Defaults to true. When false and the sandbox is paused, resume from disk state only: the sandbox cold-boots fresh and any memory in the snapshot is ignored, never modified or deleted. Disk state has crash-recovery semantics — writes not flushed before the pause may be lost. A no-op for snapshots that contain no memory. Rejected with an error in environments where this capability is not enabled, never silently downgraded to a memory restore.

Returns

200

Errors follow the E2B format — see error codes

Request

curl
# Call Create sandbox first and replace sbx_123 with its returned sandboxID.
curl https://api.deepraxis.com/e2b/v2/sandboxes/sbx_123/connect \
  -H "X-API-Key: $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"timeout":300}'
Python
# Call Create sandbox first and replace sbx_123 with its returned sandboxID.
import requests

opts = dict(
    api_key="$PRAXIS_API_KEY",
    api_url="https://api.deepraxis.com/e2b",
    domain="sandbox.praxisusercontent.com",
)

# 官方 SDK 的 Sandbox.connect 调用 v1;这个 v2 端点直接用 HTTP 调用
resp = requests.post(
    f"{opts['api_url']}/v2/sandboxes/sbx_123/connect",
    headers={"X-API-Key": opts["api_key"]},
    json={"timeout": 300},
)
print(resp.json())
TypeScript
// Call Create sandbox first and replace sbx_123 with its returned sandboxID.
const opts = {
  apiKey: "$PRAXIS_API_KEY",
  apiUrl: "https://api.deepraxis.com/e2b",
  domain: "sandbox.praxisusercontent.com",
};

// 官方 SDK 的 Sandbox.connect 调用 v1;这个 v2 端点直接用 HTTP 调用
const resp = await fetch(`${opts.apiUrl}/v2/sandboxes/sbx_123/connect`, {
  method: "POST",
  headers: { "X-API-Key": opts.apiKey, "Content-Type": "application/json" },
  body: JSON.stringify({ timeout: 300 }),
});
console.log(await resp.json());

Response 200

{
  "templateID": "node22",
  "sandboxID": "sbib185b70d57718fd1f3df06d4",
  "clientID": "iuf9ho516lcexp7svm6td",
  "envdVersion": "0.9.0",
  "envdAccessToken": "<access-token>",
  "domain": "sandbox.praxisusercontent.com"
}

Response

HTTP 200

The sandbox was already running

application/json

Name Type Description
templateID string Identifier of the template from which is the sandbox created
sandboxID string Identifier of the sandbox
alias string Alias of the template
clientID string Identifier of the client
envdVersion string Version of the envd running in the sandbox
envdAccessToken string Access token used for envd communication
trafficAccessToken string Token required for accessing sandbox via proxy.
domain string Base domain where the sandbox traffic is accessible

HTTP 201

The sandbox was resumed successfully

application/json

Name Type Description
templateID string Identifier of the template from which is the sandbox created
sandboxID string Identifier of the sandbox
alias string Alias of the template
clientID string Identifier of the client
envdVersion string Version of the envd running in the sandbox
envdAccessToken string Access token used for envd communication
trafficAccessToken string Token required for accessing sandbox via proxy.
domain string Base domain where the sandbox traffic is accessible