读取沙箱事件
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
/sandbox/v1/events/sandboxes/{sandboxID}● 支持请求参数
sandboxIDstring必填path: 沙箱 ID。
offsetinteger可选query: Number of the newest events to skip before collecting the page; omit to start at the first one. Use it with limit to walk pages: the next page is offset + limit.
limitinteger可选query: Page size from 1 to 100; defaults to 10. A larger value returns INVALID_PARAMS rather than being clipped.
orderAscboolean可选query: true returns the oldest event first, false or omitted returns the newest first. Only the literal spellings true and false are accepted.
typesarray可选query: Filter events to the provided event types
返回
200
按账本顺序读取一个沙箱的一生事件,默认最新在前。与其他读接口不同,它在沙箱已结束(killed / failed)之后仍然回答——机器没了,死因还能查。killed 事件的 eventData.terminationReason 是平台的原因(requested、lease_expired、max_running、provider_lost、start_failed、retention、admin、unknown),kill_reason 是 E2B 口径的分类(request、timeout、admin、orphaned、unknown);updated 事件带 expiresAt。分页用 offset、limit(1–100,默认 10)、orderAsc 与可重复的 types。判定不会回来的沙箱,文件和命令接口访问时返回 SANDBOX_EXPIRED(410)并带 terminationReason。
错误按 E2B 格式返回,参见 错误码
请求示例
curl
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
curl https://api.deepraxis.com/sandbox/v1/events/sandboxes/sbx_123 \
-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.get(
"https://api.deepraxis.com/sandbox/v1/events/sandboxes/sbx_123",
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/events/sandboxes/sbx_123`, {
headers: { "X-API-Key": apiKey },
});
console.log(resp.status, await resp.text());响应示例 200
[
{
"id": "f3cb8244-e8f2-4bc7-ab7b-705a11f64323",
"version": "v1",
"type": "sandbox.lifecycle.created",
"eventData": null,
"timestamp": "2026-11-07T23:53:48.086Z",
"sandboxId": "sbi85f585bba9afeab3c04374cd",
"sandboxExecutionId": "i1nz6xi2lcu8uy0mjlufs",
"sandboxTemplateId": "base",
"sandboxBuildId": "sbr_base-base_node22@8892a414498c920e4e5fc8ed54891651ffe25e7458384b4ec998ea44a1fd72a2",
"sandboxTeamId": "org_p2kym2xej30tszztrfwbk718t"
}
]响应
HTTP 200
Successfully returned the sandbox events
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].id | string | Event unique identifier |
| [].version | string | Event structure version |
| [].type | string | Event name |
| [].eventCategory | string | Category of the event (e.g., 'lifecycle', 'process', etc.) |
| [].eventLabel | string | Label for the specific event type (e.g., 'sandbox_started', 'process_oom', etc.) |
| [].eventData | object | Optional JSON data associated with the event |
| [].timestamp | string | Timestamp of the event |
| [].sandboxId | string | Unique identifier for the sandbox |
| [].sandboxExecutionId | string | Unique identifier for the sandbox execution |
| [].sandboxTemplateId | string | Unique identifier for the sandbox template |
| [].sandboxBuildId | string | Unique identifier for the sandbox build |
| [].sandboxTeamId | string | Team identifier associated with the sandbox |