Metrics
Sandbox metrics let you monitor CPU, memory, and disk usage of running sandboxes. Metrics are collected every 5 seconds.Getting metrics using the SDKs
Getting metrics using the CLI
It may take a second or more to get the first metrics after the sandbox is created. Until the first metrics are collected from the sandbox, you will get an empty array.
Lifecycle events API
The lifecycle API provides RESTful endpoints to request the latest sandbox lifecycle events. This allows you to track when sandboxes are created, paused, resumed, updated, snapshotted, or killed, along with metadata. All requests require authentication using your team API key. Query Parameters:offset(optional): Number of events to skip (default: 0, min: 0)limit(optional): Number of events to return (default: 10, min: 1, max: 100)orderAsc(optional): Sort order - true for ascending, false for descending (default: false)
Lifecycle webhooks
Webhooks provide a way for notifications to be delivered to an external web server whenever certain sandbox lifecycle events occur. This allows you to receive real-time updates about sandbox creation, updates, and termination without having to poll the API. All webhook requests require authentication using your team API key.Register webhook
Register a new webhook to receive sandbox lifecycle events. The webhook will be registered for the team ID associated with your API key. All events specified during webhook creation will be sent to URL provided during registration with the webhook payload.List webhooks
List all registered webhooks for your team.Get webhook configuration
Retrieve the current webhook configuration for your team.Update webhook configuration
Update an existing webhook configuration. The update will replace the previous configuration fields with provided fields.Delete webhook
Unregister the webhook.Webhook payload
When a webhook is triggered, your endpoint will receive a POST request with a JSON payload containing the sandbox event data. The payload structure matches the event format from the API:eventData.execution contains sandbox execution details and is included on sandbox.lifecycle.killed and sandbox.lifecycle.paused events:
started_at- UTC RFC3339 timestamp when the current sandbox execution startedvcpu_count- Number of vCPUs assigned to the sandboxmemory_mb- Memory assigned to the sandbox in MBexecution_time- Sandbox runtime in milliseconds
Webhook verification
To ensure the authenticity of webhook requests, each request includes a signature in thee2b-signature header.
You can verify the signature using the signature secret you provided when registering the webhook.
This confirms that the request originated from E2B and has not been tampered with.
Webhook request headers
When a webhook is sent, E2B adds headers to help you verify authenticity and debug delivery:e2b-webhook-id- Webhook ID that triggered the evente2b-delivery-id- Unique ID for the delivery attempte2b-signature-version- Currently alwaysv1, reserved for future usee2b-signature- Signature for verifying the request authenticity
Available event types
The following event types can be subscribed to via webhooks, they are used as thetype field in the payload.
sandbox.lifecycle.created- Sandbox creationsandbox.lifecycle.killed- Sandbox terminationsandbox.lifecycle.updated- Sandbox configuration updatessandbox.lifecycle.paused- Sandbox pausingsandbox.lifecycle.resumed- Sandbox resumingsandbox.lifecycle.checkpointed- Sandbox snapshot created