Skip to content

Sandbox Runtime (envd)

Observe the in-sandbox runtime service: check health, read resource usage metrics, and list the sandbox's environment variables. These endpoints are E2B-compatible and are served by the SandBase API under the /sandboxes/:id prefix.

All endpoints require authentication and enforce org isolation: a sandbox that does not belong to your org returns 404 sandbox not found.

Health Check

GET/sandboxes/:id/health

Check whether the in-sandbox runtime is healthy.

Response

Returns 204 No Content when the sandbox runtime is healthy. No body is returned.

Request Example

bash
curl -i -X GET https://api.sandbase.ai/sandboxes/sbx_01.../health \
  -H "Authorization: Bearer sk-sb-YOUR_KEY"

Metrics

GET/sandboxes/:id/metrics

Get a point-in-time snapshot of the sandbox's resource usage.

Response

json
{
  "ts": 1748534400,
  "cpu_count": 2,
  "cpu_used_pct": 12.5,
  "mem_total": 2147483648,
  "mem_used": 536870912,
  "mem_cache": 134217728,
  "mem_total_mib": 2048,
  "mem_used_mib": 512,
  "disk_total": 10737418240,
  "disk_used": 2147483648
}
FieldTypeDescription
tsintegerUnix timestamp (UTC) for the sandbox's current time.
cpu_countintegerNumber of CPU cores.
cpu_used_pctnumberCPU usage percentage.
mem_totalintegerTotal virtual memory, in bytes.
mem_usedintegerUsed virtual memory, in bytes.
mem_cacheintegerCached memory (page cache), in bytes.
mem_total_mibintegerTotal virtual memory, in MiB.
mem_used_mibintegerUsed virtual memory, in MiB.
disk_totalintegerTotal disk space, in bytes.
disk_usedintegerUsed disk space, in bytes.

The field names match the E2B Metrics schema (snake_case) so the E2B SDK can deserialize the response directly.

Request Example

bash
curl -X GET https://api.sandbase.ai/sandboxes/sbx_01.../metrics \
  -H "Authorization: Bearer sk-sb-YOUR_KEY"

Environment Variables

GET/sandboxes/:id/envs

Get the environment variables visible inside the sandbox.

Response

A flat object mapping variable names to their string values.

json
{
  "PATH": "/usr/local/bin:/usr/bin:/bin",
  "HOME": "/home/user",
  "PYTHONUNBUFFERED": "1"
}

Request Example

bash
curl -X GET https://api.sandbase.ai/sandboxes/sbx_01.../envs \
  -H "Authorization: Bearer sk-sb-YOUR_KEY"

Errors

StatusMeaning
400Invalid sandbox id.
404Sandbox not found (or not owned by your org).
502The sandbox runtime is unreachable or the health check failed.