E2B

连接沙箱(v2)

v2 路径的连接沙箱,请求与返回和 v1 相同。

先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。

POST /e2b/v2/sandboxes/{sandboxID}/connect● 支持

E2B 官方文档 ↗

请求参数

  • sandboxIDstring必填

    path:

  • timeoutinteger可选
    默认 300

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

  • memoryboolean可选

    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.

返回

200

错误按 E2B 格式返回,参见 错误码

响应

HTTP 200

The sandbox was already running

application/json

名称类型说明
templateIDstringIdentifier of the template from which is the sandbox created
sandboxIDstringIdentifier of the sandbox
aliasstringAlias of the template
clientIDstringIdentifier of the client
envdVersionstringVersion of the envd running in the sandbox
envdAccessTokenstringAccess token used for envd communication
trafficAccessTokenstringToken required for accessing sandbox via proxy.
domainstringBase domain where the sandbox traffic is accessible

HTTP 201

The sandbox was resumed successfully

application/json

名称类型说明
templateIDstringIdentifier of the template from which is the sandbox created
sandboxIDstringIdentifier of the sandbox
aliasstringAlias of the template
clientIDstringIdentifier of the client
envdVersionstringVersion of the envd running in the sandbox
envdAccessTokenstringAccess token used for envd communication
trafficAccessTokenstringToken required for accessing sandbox via proxy.
domainstringBase domain where the sandbox traffic is accessible