创建快照
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
POST
/e2b/sandboxes/{sandboxID}/snapshots● 支持请求参数
sandboxIDstring必填path:
namestring可选可选别名。同一主体重复使用该别名会更新既有快照,保留本平台快照 ID。
返回
201
错误按 E2B 格式返回,参见 错误码
请求示例
curl
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
curl https://api.deepraxis.com/e2b/sandboxes/sbx_123/snapshots \
-H "X-API-Key: $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"docs-snapshot"}'Python
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
from e2b import Sandbox
opts = dict(
api_key="$PRAXIS_API_KEY",
api_url="https://api.deepraxis.com/e2b",
domain="sandbox.praxisusercontent.com",
)
snapshot = Sandbox.create_snapshot("sbx_123", name="docs-snapshot", **opts)
print(snapshot.snapshot_id)TypeScript
// 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
import { Sandbox } from "e2b";
const opts = {
apiKey: "$PRAXIS_API_KEY",
apiUrl: "https://api.deepraxis.com/e2b",
domain: "sandbox.praxisusercontent.com",
};
const snapshot = await Sandbox.createSnapshot("sbx_123", { ...opts, name: "docs-snapshot" });
console.log(snapshot.snapshotId);响应示例 201
{
"snapshotID": "snap_735727a527a84804976adbdb",
"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) |