跳转到内容
EN

暂停沙箱

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

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

E2B 官方文档 ↗

请求参数

  • sandboxIDstring必填

    path: 沙箱 ID。

  • memoryboolean可选
    默认 true

    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 格式返回,参见 错误码

请求示例

curl
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
curl -X POST https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/pause \
  -H "X-API-Key: $PRAXIS_API_KEY"
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/pause",
    headers={"X-API-Key": api_key},
)
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/pause`, {
  method: "POST",
  headers: { "X-API-Key": apiKey },
});
console.log(resp.status, await resp.text());

响应示例 204

(204 No Content:成功,无响应体)

响应

HTTP 204

The sandbox was paused successfully and can be resumed

未声明响应体。