跳转到内容
EN

创建快照

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

POST/sandbox/v1/sandboxes/{sandboxID}/snapshots● 支持

E2B 官方文档 ↗

请求参数

  • sandboxIDstring必填

    path: 沙箱 ID。

  • namestring可选

    可选别名。同一主体重复使用该别名会更新既有快照,保留本平台快照 ID。

返回

201

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

请求示例

curl
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
curl https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/snapshots \
  -H "X-API-Key: $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"docs-snapshot"}'
Python
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
import requests

api_key = "$PRAXIS_API_KEY"

# Call /sandbox/v1 directly over HTTP.
resp = requests.post(
    "https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/snapshots",
    headers={"X-API-Key": api_key},
    json={"name": "docs-snapshot"},
)
print(resp.status_code, resp.text)
TypeScript
// 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
const apiKey = "$PRAXIS_API_KEY";

// Call /sandbox/v1 directly over HTTP.
const resp = await fetch(`https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/snapshots`, {
  method: "POST",
  headers: { "X-API-Key": apiKey, "Content-Type": "application/json" },
  body: JSON.stringify({ name: "docs-snapshot" }),
});
console.log(resp.status, await resp.text());

响应示例 201

{
  "snapshotID": "snap_2fe37d98fa394c04bfbc670d",
  "names": [
    "docs-snapshot"
  ]
}

响应

HTTP 201

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)

自有入口在响应对象(列表为每行)追加 createdAt:创建时间,ISO 8601 UTC 字符串。

快照还包括 sourceSandboxID(string,来源沙箱公开 ID)与 sourceSandboxName(string 或 null)。名称无法取得时返回 null,界面可回退显示 ID。

网关自动设置 X-Praxis-Face: own-v1,客户端无需传入;/e2b 兼容入口会剥除该头,保留厂商响应形状。

向 POST /sandbox/v1/sandboxes/{sandboxID}/snapshots 发送 JSON body {"name":"my-snapshot"} 即可命名;名称会持久保存,并通过 names 返回。