2026-10-20
加载中…X-API-Key 头,官方 SDK 自动带上)。<端口>-<沙箱 ID>.praxisusercontent.com,用创建沙箱时返回的访问凭证认证。所以 SDK 除了 api_url 还要把 domain 设为 praxisusercontent.com。也可以不改代码,只设环境变量:
加载中…| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /sandboxes | 创建沙箱 | ● 支持 |
| GET | /sandboxes | 列出沙箱 | ● 支持 |
| GET | /sandboxes/{sandboxID} | 读取沙箱 | ● 支持 |
| GET | /sandboxes/{sandboxID}/metrics | 沙箱指标 | ● 支持 |
| POST | /sandboxes/{sandboxID}/timeout | 设置超时 | ● 支持 |
| POST | /sandboxes/{sandboxID}/pause | 暂停沙箱 | ● 支持 |
| POST | /sandboxes/{sandboxID}/connect | 连接沙箱 | ● 支持 |
| DELETE | /sandboxes/{sandboxID} | 终止沙箱 | ● 支持 |
| POST | /v2/sandboxes | 创建沙箱(v2) | ● 支持 |
| GET | /v2/sandboxes | 列出沙箱(v2) | ● 支持 |
| POST | /v2/sandboxes/{sandboxID}/connect | 连接沙箱(v2) | ● 支持 |
| GET | /templates | 列出模板 | ● 支持 |
| GET | /v2/templates | 列出模板(v2) | ● 支持 |
| POST | /volumes | 创建卷 | ● 支持 |
| GET | /volumes | 列出卷 | ● 支持 |
| GET | /volumes/{volumeID} | 读取卷 | ● 支持 |
| DELETE | /volumes/{volumeID} | 删除卷 | ● 支持 |
| POST | /sandboxes/{sandboxID}/fork | 复制沙箱 | ● 支持 |
| POST | /sandboxes/{sandboxID}/snapshots | 创建快照 | ● 支持 |
| GET | /snapshots | 列出快照 | ● 支持 |
| DELETE | /templates/{templateID} | 删除快照 | ● 支持 |
| PUT | /sandboxes/{sandboxID}/network | 更新网络策略 | ● 支持 |
| GET | /v2/sandboxes/{sandboxID}/logs | 读取沙箱日志 | ● 支持 |
参数与字段的权威定义以 E2B 官方文档为准。
/e2b/sandboxes● 支持templateIDstring必填Template ID or alias from templates.list; resolves to your ready Environment first, then a public Base. Supply it explicitly.
timeoutinteger可选Time to live for the sandbox in seconds.
autoPauseboolean可选Automatically pauses the sandbox after the timeout
metadataany可选envVarsany可选secureboolean可选Secure all system communication with sandbox
allow_internet_accessboolean可选Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut to 0.0.0.0/0 in the network config.
autoPauseMemoryboolean可选Controls the snapshot kind taken when the sandbox auto-pauses on timeout (only relevant when autoPause is true). When false, the auto-pause drops the in-memory state and persists only the filesystem (a filesystem-only snapshot); resuming it cold-boots (reboots) the sandbox from disk. Such a snapshot cannot be auto-resumed by traffic and must be resumed explicitly, so it cannot be combined with autoResume. Defaults to true (full memory snapshot).
autoResumeobject可选Auto-resume configuration for paused sandboxes.
enabledboolean必填Auto-resume enabled flag for paused sandboxes. Default false.
networkobject可选allowPublicTrafficboolean可选Specify if the sandbox URLs should be accessible only with authentication.
allowOutarray可选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.
denyOutarray可选List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
egressProxyobject可选SOCKS5 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).
maskRequestHoststring可选Specify host mask which will be used for all sandbox requests
httpsPortsarray可选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.
rulesobject可选Per-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.
mcpobject可选MCP configuration for the sandbox
iamobject可选Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
tokensobject可选Named workload-token definitions, keyed by a caller-chosen token name.
volumeMountsarray可选namestring必填Name of the volume
pathstring必填Path of the volume
201
已弃用:最新官方 SDK 走 v2。平台暂未提供 E2B 默认的 base 模板:不带模板参数的 Sandbox.create() 会返回 404,请显式指定模板(可用模板见「列出模板」)。
错误按 E2B 格式返回,参见 错误码
The sandbox was created successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| 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 | Domain 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. |
/e2b/sandboxes● 支持metadatastring可选query: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded.
200
已弃用:最新官方 SDK 走 v2。
错误按 E2B 格式返回,参见 错误码
Successfully returned all running sandboxes
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template from which is the sandbox created |
| [].alias | string | Alias of the template |
| [].sandboxID | string | Identifier of the sandbox |
| [].clientID | string | Identifier of the client |
| [].startedAt | string | Time when the sandbox was started |
| [].endAt | string | Time when the sandbox will expire |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].metadata | any | |
| [].state | string | State of the sandbox |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].volumeMounts | array<object> | |
| [].volumeMounts[].name | string | Name of the volume |
| [].volumeMounts[].path | string | Path of the volume |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
Successfully returned the sandbox
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| alias | string | Alias of the template |
| sandboxID | string | Identifier of the sandbox |
| clientID | string | Identifier of the client |
| startedAt | string | Time when the sandbox was started |
| endAt | string | Time when the sandbox will expire |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| allowInternetAccess | boolean | Whether internet access was explicitly enabled or disabled for the sandbox. Null means it was not explicitly set. |
| domain | string | Domain 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. |
| cpuCount | integer | CPU cores for the sandbox |
| memoryMB | integer | Memory for the sandbox in MiB |
| diskSizeMB | integer | Disk size for the sandbox in MiB |
| metadata | any | |
| state | string | State of the sandbox |
| network | object | |
| network.allowPublicTraffic | boolean | Specify if the sandbox URLs should be accessible only with authentication. |
| network.allowOut | array<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.denyOut | array<string> | List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules. |
| network.egressProxy | object | SOCKS5 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.maskRequestHost | string | Specify host mask which will be used for all sandbox requests |
| network.httpsPorts | array<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.rules | object | Per-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. |
| lifecycle | object | Sandbox lifecycle policy returned by sandbox info. |
| lifecycle.autoResume | boolean | Whether the sandbox can auto-resume. |
| lifecycle.onTimeout | string | Action taken when the sandbox times out. |
| volumeMounts | array<object> | |
| volumeMounts[].name | string | Name of the volume |
| volumeMounts[].path | string | Path of the volume |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/metrics● 支持sandboxIDstring必填path:
startinteger可选query: Unix timestamp for the start of the interval, in seconds, for which the metrics
endinteger可选query: Unix timestamp for the end of the interval, in seconds, for which the metrics
200
错误按 E2B 格式返回,参见 错误码
Successfully returned the sandbox metrics
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].timestamp | string | Timestamp of the metric entry |
| [].timestampUnix | integer | Timestamp of the metric entry in Unix time (seconds since epoch) |
| [].cpuCount | integer | Number of CPU cores |
| [].cpuUsedPct | number | CPU usage percentage |
| [].memUsed | integer | Memory used in bytes |
| [].memTotal | integer | Total memory in bytes |
| [].memCache | integer | Cached memory (page cache) in bytes |
| [].diskUsed | integer | Disk used in bytes |
| [].diskTotal | integer | Total disk space in bytes |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/pause● 支持sandboxIDstring必填path:
memoryboolean可选Whether to capture a full memory snapshot. When false, only the filesystem is persisted and resuming the sandbox cold-boots (reboots) it from disk, losing in-memory state, running processes, and open connections. Resume it with an explicit request (connect or resume); auto-resume, which can be triggered by arbitrary traffic, refuses such a sandbox. Defaults to true.
204
错误按 E2B 格式返回,参见 错误码
The sandbox was paused successfully and can be resumed
未声明响应体。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/connect● 支持sandboxIDstring必填path:
timeoutinteger必填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.
201
已弃用:最新官方 SDK 走 v2。
错误按 E2B 格式返回,参见 错误码
The sandbox was already running
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| 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 | Domain 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. |
The sandbox was resumed successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| 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 | Domain 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. |
/e2b/v2/sandboxes● 支持templateIDstring必填Template ID or alias from templates.list; resolves to your ready Environment first, then a public Base. Supply it explicitly.
timeoutinteger可选Time to live for the sandbox in seconds.
autoPauseboolean可选Automatically pauses the sandbox after the timeout
metadataany可选envVarsany可选allow_internet_accessboolean可选Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut to 0.0.0.0/0 in the network config.
autoPauseMemoryboolean可选Controls the snapshot kind taken when the sandbox auto-pauses on timeout (only relevant when autoPause is true). When false, the auto-pause drops the in-memory state and persists only the filesystem (a filesystem-only snapshot); resuming it cold-boots (reboots) the sandbox from disk. Such a snapshot cannot be auto-resumed by traffic and must be resumed explicitly, so it cannot be combined with autoResume. Defaults to true (full memory snapshot).
autoResumeobject可选Auto-resume configuration for paused sandboxes.
enabledboolean必填Auto-resume enabled flag for paused sandboxes. Default false.
networkobject可选allowPublicTrafficboolean可选Specify if the sandbox URLs should be accessible only with authentication.
allowOutarray可选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.
denyOutarray可选List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
egressProxyobject可选SOCKS5 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).
maskRequestHoststring可选Specify host mask which will be used for all sandbox requests
httpsPortsarray可选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.
rulesobject可选Per-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.
mcpobject可选MCP configuration for the sandbox
iamobject可选Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
tokensobject可选Named workload-token definitions, keyed by a caller-chosen token name.
volumeMountsarray可选namestring必填Name of the volume
pathstring必填Path of the volume
201
错误按 E2B 格式返回,参见 错误码
The sandbox was created successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| 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 | Domain 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. |
/e2b/v2/sandboxes● 支持metadatastring可选query: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded.
statearray可选query: Filter sandboxes by one or more states
orderstring可选query: Sort direction by sandbox start time. Defaults to desc (newest first).
startedAfterstring可选query: Return sandboxes started at or after this timestamp.
templatestring可选query: Filter sandboxes by a template ID or alias.
nextTokenstring可选query: Cursor to start the list from
limitinteger可选query: Maximum number of items to return per page
200
错误按 E2B 格式返回,参见 错误码
Successfully returned all running sandboxes
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template from which is the sandbox created |
| [].alias | string | Alias of the template |
| [].sandboxID | string | Identifier of the sandbox |
| [].clientID | string | Identifier of the client |
| [].startedAt | string | Time when the sandbox was started |
| [].endAt | string | Time when the sandbox will expire |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].metadata | any | |
| [].state | string | State of the sandbox |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].volumeMounts | array<object> | |
| [].volumeMounts[].name | string | Name of the volume |
| [].volumeMounts[].path | string | Path of the volume |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/v2/sandboxes/{sandboxID}/connect● 支持sandboxIDstring必填path:
timeoutinteger可选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 格式返回,参见 错误码
The sandbox was already running
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| 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 | Domain 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. |
The sandbox was resumed successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| 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 | Domain 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. |
/e2b/templates● 支持teamIDstring可选query: Identifier of the team
200
已弃用:最新官方 SDK 走 v2。
错误按 E2B 格式返回,参见 错误码
Successfully returned all templates
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template |
| [].buildID | string | Identifier of the last successful build for given template |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].public | boolean | Whether the template is public or only accessible by the team |
| [].aliases | array<string> | Aliases of the template |
| [].names | array<string> | Names of the template (namespace/alias format when namespaced) |
| [].createdAt | string | Time when the template was created |
| [].updatedAt | string | Time when the template was last updated |
| [].createdBy | object | |
| [].createdBy.id | string | Identifier of the user |
| [].createdBy.email | string | Email of the user |
| [].lastSpawnedAt | string | Time when the template was last used |
| [].spawnCount | integer | Number of times the template was used |
| [].buildCount | integer | Number of times the template was built |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].buildStatus | string | Status of the template build |
/e2b/v2/templates● 支持teamIDstring可选query: Identifier of the team
nextTokenstring可选query: Cursor to start the list from
limitinteger可选query: Maximum number of items to return per page
200
错误按 E2B 格式返回,参见 错误码
Successfully returned all templates
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].templateID | string | Identifier of the template |
| [].buildID | string | Identifier of the last successful build for given template |
| [].cpuCount | integer | CPU cores for the sandbox |
| [].memoryMB | integer | Memory for the sandbox in MiB |
| [].diskSizeMB | integer | Disk size for the sandbox in MiB |
| [].public | boolean | Whether the template is public or only accessible by the team |
| [].aliases | array<string> | Aliases of the template |
| [].names | array<string> | Names of the template (namespace/alias format when namespaced) |
| [].createdAt | string | Time when the template was created |
| [].updatedAt | string | Time when the template was last updated |
| [].createdBy | object | |
| [].createdBy.id | string | Identifier of the user |
| [].createdBy.email | string | Email of the user |
| [].lastSpawnedAt | string | Time when the template was last used |
| [].spawnCount | integer | Number of times the template was used |
| [].buildCount | integer | Number of times the template was built |
| [].envdVersion | string | Version of the envd running in the sandbox |
| [].buildStatus | string | Status of the template build |
Successfully created a new team volume
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| volumeID | string | ID of the volume |
| name | string | Name of the volume |
| token | string | Auth token to use for interacting with volume content |
| domain | string | Domain to use as the destination for volume content requests, replacing the default `api.<E2B_DOMAIN>`. Only returned when the team is connected to a custom (BYOC) cluster; absent otherwise, in which case the default domain is used. |
Successfully retrieved a team volume
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| volumeID | string | ID of the volume |
| name | string | Name of the volume |
| token | string | Auth token to use for interacting with volume content |
| domain | string | Domain to use as the destination for volume content requests, replacing the default `api.<E2B_DOMAIN>`. Only returned when the team is connected to a custom (BYOC) cluster; absent otherwise, in which case the default domain is used. |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/fork● 支持sandboxIDstring必填path:
timeoutinteger可选新副本的存活时间,单位为秒。
countinteger可选要创建的独立副本数。所有副本来自同一次快照,每个副本分别返回成功结果或错误。
201
错误按 E2B 格式返回,参见 错误码
The sandbox was snapshotted and the forks were attempted; each entry reports one fork's outcome
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].sandbox | object | |
| [].sandbox.templateID | string | Identifier of the template from which is the sandbox created |
| [].sandbox.sandboxID | string | Identifier of the sandbox |
| [].sandbox.alias | string | Alias of the template |
| [].sandbox.clientID | string | Identifier of the client |
| [].sandbox.envdVersion | string | Version of the envd running in the sandbox |
| [].sandbox.envdAccessToken | string | Access token used for envd communication |
| [].sandbox.trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| [].sandbox.domain | string | Domain 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. |
| [].error | object | |
| [].error.code | integer | Error code |
| [].error.error_code | string | Machine-readable semantic error code. Not a closed set; initial values: sandbox_capacity_unavailable, sandbox_placement_timeout, sandbox_no_compatible_node, sandbox_create_failed, internal_server_error. |
| [].error.message | string | Error |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/snapshots● 支持sandboxIDstring必填path:
namestring可选可选别名。同一主体重复使用该别名会更新既有快照,保留本平台快照 ID。
201
错误按 E2B 格式返回,参见 错误码
Snapshot created successfully
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| snapshotID | string | Identifier of the snapshot template including the tag. Uses namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default), otherwise falls back to the raw template ID (e.g. abc123:default). |
| names | array<string> | Full names of the snapshot template including team namespace and tag (e.g. team-slug/my-snapshot:v2) |
/e2b/snapshots● 支持sandboxIDstring可选query: 按来源沙箱 ID 筛选。
namestring可选query: 按原始别名或本平台 snap_ 快照 ID 筛选。
limitinteger可选query: 每页返回的快照数量上限。
nextTokenstring可选query: 上一页响应头 X-Next-Token 返回的游标。
200
错误按 E2B 格式返回,参见 错误码
Successfully returned snapshots
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].snapshotID | string | Identifier of the snapshot template including the tag. Uses namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default), otherwise falls back to the raw template ID (e.g. abc123:default). |
| [].names | array<string> | Full names of the snapshot template including team namespace and tag (e.g. team-slug/my-snapshot:v2) |
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/sandboxes/{sandboxID}/network● 支持sandboxIDstring必填path:
allow_internet_accessboolean可选是否允许访问外网。false 等效于 denyOut 包含 0.0.0.0/0。
allowOutarray可选出站目标白名单,可用 CIDR、IP 或域名;白名单优先于拒绝规则。
denyOutarray可选出站目标黑名单,支持 CIDR 或 IP,不支持域名。
egressProxyobject可选上游代理配置字段,当前平台尚未应用。
addressstring必填SOCKS5 proxy address in host:port format (e.g. "proxy.example.com:1080").
usernamestring可选Optional SOCKS5 username (RFC 1929), max 255 bytes.
passwordstring可选Optional SOCKS5 password (RFC 1929), max 255 bytes.
rulesobject可选上游按域名转换规则字段,当前平台尚未应用。
204
错误按 E2B 格式返回,参见 错误码
Successfully updated the sandbox network configuration
未声明响应体。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/e2b/v2/sandboxes/{sandboxID}/logs● 支持sandboxIDstring必填path:
cursorinteger可选query: 起始时间戳,单位为 Unix 毫秒。
limitinteger可选query: 最多返回的日志条数。
directionstring可选query: forward 按时间向后读取;backward 按时间向前读取。
levelstring可选query: 最低日志级别,低于该级别的日志会被过滤。
searchstring可选query: 按日志正文的子串筛选,区分大小写。
200
错误按 E2B 格式返回,参见 错误码
Successfully returned the sandbox logs
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| logs | array<object> | Sandbox logs structured |
| logs[].timestamp | string | Timestamp of the log entry |
| logs[].message | string | Log message content |
| logs[].level | string | State of the sandbox |
| logs[].fields | object |