# E2B

> Start, pause and stop E2B cloud sandboxes for running AI-generated code, read their logs, metrics and events, and manage templates, snapshots and webhooks.

App · 19 actions. Web page: https://docs.lodol.com/docs/integrations/e2b

## Actions

### Connect sandbox

Connect to a sandbox, resuming it first if it is paused, and set how long it stays up.

**Inputs**

- Sandbox (`sandbox_id`, text, required): Sandbox id.
- Memory (`memory`, true/false): Defaults to true. When false and the sandbox is paused, resume from disk state only: the sandbox cold-boots fresh and any memory in the snapshot is ignored, never modified or deleted. Disk state has crash-recovery semantics ; writes not flushed before the pause may be lost. A no-op for snapshots that contain no memory. Rejected with an error in environments where this capability is not enabled, never silently downgraded to a memory restore. A snapshot taken while the sandbox guest agent was not
- Timeout (`timeout`, number): Timeout in seconds from the current time after which the sandbox should expire. At least 1. Default: `300`.

**Outputs**

- `data` (object): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {
    "alias": "example",
    "domain": "example",
    "envdAccessToken": "example",
    "envdVersion": "example",
    "sandboxID": "example",
    "templateID": "example",
    "trafficAccessToken": "example"
  },
  "next_cursor": ""
}
```

### Create sandbox

Start a new sandbox from a template, with its own timeout, resources and environment variables.

**Inputs**

- Idempotency key (`idempotency_key`, text): Idempotency key.
- Allow internet access (`allow_internet_access`, true/false): Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut to 0.0.0.0/0 in the network config.
- Auto pause (`auto_pause`, true/false): Automatically pauses the sandbox after the timeout. Default: `false`.
- Auto pause memory (`auto_pause_memory`, true/false): Controls the snapshot kind taken when the sandbox auto-pauses on timeout (only relevant when autoPause is true). When false, the auto-pause drops the in-memory state and persists only the filesystem (a filesystem-only snapshot); resuming it cold-boots (reboots) the sandbox from disk. Such a snapshot cannot be auto-resumed by traffic and must be resumed explicitly, so it cannot be combined with autoResume. Defaults to true (full memory snapshot). Default: `true`.
- Auto resume (`auto_resume`, object): Auto-resume configuration for paused sandboxes.
- Cpu count (`cpu_count`, number): CPU cores for the sandbox. At least 1.
- Env vars (`env_vars`, text): Env vars.
- Iam (`iam`, object): Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
- Mcp (`mcp`, object): MCP configuration for the sandbox
- Metadata (`metadata`, text): Metadata.
- Network (`network`, object): Network.
- Template (`template_id`, text, required): Identifier of the required template
- Timeout (`timeout`, number): Time to live for the sandbox in seconds. At least 1. Default: `300`.
- Volume mounts (`volume_mounts`, list): Volume mounts.

**Outputs**

- `data` (object): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {
    "alias": "example",
    "domain": "example",
    "envdAccessToken": "example",
    "envdVersion": "example",
    "sandboxID": "example",
    "templateID": "example",
    "trafficAccessToken": "example"
  },
  "next_cursor": ""
}
```

### Create webhook

Add a webhook that receives sandbox events at an address you choose.

**Inputs**

- Enabled (`enabled`, true/false): Enabled. Default: `true`.
- Events (`events`, list, required): Events.
- Name (`name`, text, required): Name.
- Signature secret (`signature_secret`, text, required): Secret used to sign the webhook payloads
- Url (`url`, text, required): Url.

**Outputs**

- `data` (object): Webhook creation response
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {
    "createdAt": "example",
    "enabled": false,
    "events": [],
    "id": "example",
    "name": "example",
    "teamId": "example",
    "url": "example"
  },
  "next_cursor": ""
}
```

### Delete webhook

Delete a webhook so it stops receiving sandbox events.

**Inputs**

- Webhook id (`webhook_id`, text, required): Webhook id.

**Outputs**

- `data` (object): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {},
  "next_cursor": ""
}
```

### Get sandbox

Get a sandbox's details, such as its template, state, resources and when it ends.

**Inputs**

- Sandbox (`sandbox_id`, text, required): Sandbox id.

**Outputs**

- `data` (object): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {
    "alias": "example",
    "allowInternetAccess": false,
    "cpuCount": 1,
    "diskSizeMB": 1,
    "domain": "example",
    "endAt": "example",
    "envdAccessToken": "example",
    "envdUnresponsiveAtPause": false,
    "envdVersion": "example",
    "lifecycle": {
      "autoResume": false,
      "onTimeout": "kill"
    },
    "memoryMB": 1,
    "metadata": "example",
    "network": {
      "allowOut": [],
      "allowPublicTraffic": false,
      "denyOut": [],
      "dnsServers": [],
      "egressProxy": {
        "address": "example",
        "password": "example",
        "tls": {
          "caCert": "example",
          "enabled": false,
          "serverName": "example"
        },
        "username": "example"
      },
      "httpsPorts": [],
      "maskRequestHost": "example",
      "rules": {}
    },
    "pauseMode": "full",
    "sandboxID": "example",
    "startedAt": "example",
    "state": "running",
    "templateID": "example",
    "volumeMounts": []
  },
  "next_cursor": ""
}
```

### Get sandbox logs

Read a sandbox's logs, optionally filtered by level or text.

**Inputs**

- Sandbox (`sandbox_id`, text, required): Sandbox id.
- Logs starting at (`cursor`, date and time): Start of the time window.
- Limit (`limit`, number): Limit. From 0 to 1000. Default: `1000`.
- Direction (`direction`, text): Direction of the logs that should be returned. One of: `forward`, `backward`.
- Level (`level`, text): State of the sandbox. One of: `debug`, `info`, `warn`, `error`.
- Search (`search`, text): Search.

**Outputs**

- `data` (object): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {
    "logs": []
  },
  "next_cursor": ""
}
```

### Get sandbox metrics

Get a sandbox's CPU, memory and disk use over a period.

**Inputs**

- Sandbox (`sandbox_id`, text, required): Sandbox id.
- Start (`start`, date and time): Start of the time window.
- End (`end`, date and time): End of the time window.

**Outputs**

- `data` (list): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": [],
  "next_cursor": ""
}
```

### Get template

Get a template's details and its builds.

**Inputs**

- Template (`template_id`, text, required): Template id.

**Outputs**

- `data` (object): A template with its default build. `defaultBuild` is the build a sandbox created without a tag starts from, the latest ready build tagged default; it is absent until such a build is ready. `buildStatus` is the status of the latest build tagged default in any state: it is `building` while a rebuild runs, although sandboxes still start from the default build.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {
    "buildCount": 1,
    "buildStatus": "building",
    "createdAt": "example",
    "createdBy": {
      "id": "example"
    },
    "defaultBuild": {
      "buildID": "example",
      "cpuCount": 1,
      "createdAt": "example",
      "diskSizeMB": 1,
      "envdVersion": "example",
      "finishedAt": "example",
      "maxCpuCount": 1,
      "memoryMB": 1,
      "status": "building",
      "updatedAt": "example"
    },
    "description": "example",
    "isDefault": false,
    "lastSpawnedAt": "example",
    "names": [],
    "public": false,
    "spawnCount": 1,
    "templateID": "example",
    "updatedAt": "example"
  },
  "next_cursor": ""
}
```

### Get webhook

Get a webhook's details, such as its address and the events it receives.

**Inputs**

- Webhook id (`webhook_id`, text, required): Webhook id.

**Outputs**

- `data` (object): Webhook detail response
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {
    "createdAt": "example",
    "enabled": false,
    "events": [],
    "id": "example",
    "name": "example",
    "teamId": "example",
    "url": "example"
  },
  "next_cursor": ""
}
```

### Kill sandbox

Stop a sandbox straight away and discard it.

**Inputs**

- Sandbox (`sandbox_id`, text, required): Sandbox id.

**Outputs**

- `data` (object): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {},
  "next_cursor": ""
}
```

### List events

List recent sandbox lifecycle events across your team, such as sandboxes created, paused or killed.

**Inputs**

- Offset (`offset`, number): Offset. At least 0. Default: `0`.
- Limit (`limit`, number): Limit. From 1 to 100. Default: `10`.
- Order asc (`order_asc`, true/false): Order asc. Default: `false`.
- Types (`types`, list): Types.

**Outputs**

- `data` (list): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": [],
  "next_cursor": ""
}
```

### List sandbox events

List the lifecycle events of one sandbox.

**Inputs**

- Sandbox (`sandbox_id`, text, required): Sandbox id.
- Offset (`offset`, number): Offset. At least 0. Default: `0`.
- Limit (`limit`, number): Limit. From 1 to 100. Default: `10`.
- Order asc (`order_asc`, true/false): Order asc. Default: `false`.
- Types (`types`, list): Types.

**Outputs**

- `data` (list): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": [],
  "next_cursor": ""
}
```

### List sandboxes

List your running and paused sandboxes, optionally filtered by state, template or metadata.

**Inputs**

- Metadata (`metadata`, text): Metadata.
- State (`state`, list): State. One or more of: `running`, `paused`.
- Order (`order`, text): Sort direction. One of: `asc`, `desc`. Default: `desc`.
- Started after (`started_after`, date and time): Started after.
- Template (`template`, text): Template.
- Next token (`next_token`, text): Next token.
- Limit (`limit`, number): Limit. From 1 to 100. Default: `100`.

**Outputs**

- `data` (list): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": [],
  "next_cursor": ""
}
```

### List snapshots

List saved sandbox snapshots, optionally for one sandbox or by name.

**Inputs**

- Sandbox (`sandbox_id`, text): Filter snapshots by source sandbox ID
- Name (`name`, text): Name.
- Limit (`limit`, number): Limit. From 1 to 100. Default: `100`.
- Next token (`next_token`, text): Next token.

**Outputs**

- `data` (list): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": [],
  "next_cursor": ""
}
```

### List templates

List the sandbox templates your team can start sandboxes from.

**Inputs**

- Team id (`e2b_team_id`, text): Identifier of the team, as its UUID or its public project ID (prj_)
- Next token (`next_token`, text): Next token.
- Limit (`limit`, number): Limit. From 1 to 100. Default: `100`.

**Outputs**

- `data` (list): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": [],
  "next_cursor": ""
}
```

### List webhooks

List the webhooks that receive your team's sandbox events.

**Inputs**: None.

**Outputs**

- `data` (list): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": [],
  "next_cursor": ""
}
```

### Pause sandbox

Pause a running sandbox, keeping its files and memory so it can be resumed later.

**Inputs**

- Sandbox (`sandbox_id`, text, required): Sandbox id.
- Memory (`memory`, true/false): Whether to capture a full memory snapshot. When false, only the filesystem is persisted and resuming the sandbox cold-boots (reboots) it from disk, losing in-memory state, running processes, and open connections. Resume it with an explicit request (connect or resume); auto-resume, which can be triggered by arbitrary traffic, refuses such a sandbox. Defaults to true. Default: `true`.
- Require healthy guest (`require_healthy_guest`, true/false): The pause checks that the sandbox guest agent answers before it takes the snapshot. By default an unresponsive agent is recorded on the snapshot and the pause proceeds; the sandbox then shows `envdUnresponsiveAtPause` and a later resume must ask for `memory: false`, since restoring that memory would bring the unresponsive agent back. With this true, the pause is instead refused with 503 while the agent does not answer, and the sandbox keeps running. A filesystem-only pause (`memory: false`) is a. Default: `false`.

**Outputs**

- `data` (object): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {},
  "next_cursor": ""
}
```

### Set timeout

Set how many seconds from now a running sandbox stays up before it is stopped.

**Inputs**

- Sandbox (`sandbox_id`, text, required): Sandbox id.
- Timeout (`timeout`, number, required): Timeout in seconds from the current time after which the sandbox should expire. At least 0.

**Outputs**

- `data` (object): Response.
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {},
  "next_cursor": ""
}
```

### Update webhook

Change a webhook's name, address, events or whether it is turned on.

**Inputs**

- Webhook id (`webhook_id`, text, required): Webhook id.
- Enabled (`enabled`, true/false): Enabled.
- Events (`events`, list): Events.
- Name (`name`, text): Webhook user friendly name
- Signature secret (`signature_secret`, text): Secret used to sign the webhook payloads
- Url (`url`, text): Url.

**Outputs**

- `data` (object): Webhook detail response
- `next_cursor` (text): Continuation token, when returned by the service.

**Example output**

```json
{
  "data": {
    "createdAt": "example",
    "enabled": false,
    "events": [],
    "id": "example",
    "name": "example",
    "teamId": "example",
    "url": "example"
  },
  "next_cursor": ""
}
```
