E2B

读取沙箱

读取一个沙箱的状态、模板、资源与到期时间。

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

GET /e2b/sandboxes/{sandboxID}● 支持

E2B 官方文档 ↗

请求参数

  • sandboxIDstring必填

    path:

返回

200

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

响应

HTTP 200

Successfully returned the sandbox

application/json

名称类型说明
templateIDstringIdentifier of the template from which is the sandbox created
aliasstringAlias of the template
sandboxIDstringIdentifier of the sandbox
clientIDstringIdentifier of the client
startedAtstringTime when the sandbox was started
endAtstringTime when the sandbox will expire
envdVersionstringVersion of the envd running in the sandbox
envdAccessTokenstringAccess token used for envd communication
allowInternetAccessbooleanWhether internet access was explicitly enabled or disabled for the sandbox. Null means it was not explicitly set.
domainstringDomain returned for sandbox traffic. Build an HTTP service URL as https://<port>-<sandboxID>.<domain> using the returned values, without replacing or stripping the sandboxID suffix.
cpuCountintegerCPU cores for the sandbox
memoryMBintegerMemory for the sandbox in MiB
diskSizeMBintegerDisk size for the sandbox in MiB
metadataany
statestringState of the sandbox
networkobject
network.allowPublicTrafficbooleanSpecify if the sandbox URLs should be accessible only with authentication.
network.allowOutarray<string>List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries.
network.denyOutarray<string>List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
network.egressProxyobjectSOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain).
network.maskRequestHoststringSpecify host mask which will be used for all sandbox requests
network.httpsPortsarray<integer>Unlike E2B, network.httpsPorts is rejected; omit it and serve plaintext HTTP inside the sandbox. The public port URL still uses HTTPS. The upstream field denotes HTTPS-speaking internal ports, permits self-signed certificates and excludes envd port 49983.
network.rulesobjectPer-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, ".example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination.
lifecycleobjectSandbox lifecycle policy returned by sandbox info.
lifecycle.autoResumebooleanWhether the sandbox can auto-resume.
lifecycle.onTimeoutstringAction taken when the sandbox times out.
volumeMountsarray<object>
volumeMounts[].namestringName of the volume
volumeMounts[].pathstringPath of the volume