设置超时
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
POST
/e2b/sandboxes/{sandboxID}/timeout● 支持请求参数
sandboxIDstring必填path:
timeoutinteger必填Timeout in seconds from the current time after which the sandbox should expire
返回
204
错误按 E2B 格式返回,参见 错误码
请求示例
curl
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
curl https://api.deepraxis.com/e2b/sandboxes/sbx_123/timeout \
-H "X-API-Key: $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"timeout":300}'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",
)
Sandbox.set_timeout("sbx_123", 300, **opts)TypeScript
// 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
import { Sandbox } from "e2b";
const opts = {
apiKey: "$PRAXIS_API_KEY",
apiUrl: "https://api.deepraxis.com/e2b",
domain: "sandbox.praxisusercontent.com",
};
await Sandbox.setTimeout("sbx_123", 300_000, opts);响应示例 204
(204 No Content:成功,无响应体)响应
HTTP 204
Successfully set the sandbox timeout
未声明响应体。