设置超时
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
POST
/sandbox/v1/sandboxes/{sandboxID}/timeout● 支持请求参数
sandboxIDstring必填path: 沙箱 ID。
timeoutinteger必填New lifetime in seconds from now, replacing the current expiry rather than adding to it. May shorten the remaining lifetime.
返回
204
错误按 E2B 格式返回,参见 错误码
请求示例
curl
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
curl https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/timeout \
-H "X-API-Key: $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"timeout":300}'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/timeout",
headers={"X-API-Key": api_key},
json={"timeout": 300},
)
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/timeout`, {
method: "POST",
headers: { "X-API-Key": apiKey, "Content-Type": "application/json" },
body: JSON.stringify({ timeout: 300 }),
});
console.log(resp.status, await resp.text());响应示例 204
(204 No Content:成功,无响应体)响应
HTTP 204
Successfully set the sandbox timeout
未声明响应体。