---
title: E2B API Integration on Truto
slug: e2b
category: Application Development
canonical: "https://truto.one/integrations/detail/e2b/"
---

# E2B API Integration on Truto



**Category:** Application Development  
**Status:** Generally available

## MCP-ready AI tools

Truto exposes 64 tools for E2B that AI agents can call directly.

- **list_all_e_2_b_sandboxes** — List running e2b sandboxes, optionally filtered by a metadata query. Returns: sandboxID, cpuCount, code, message.
- **create_a_e_2_b_sandbox** — Create a new e2b sandbox from a template with configurable timeout, networking, environment variables, and lifecycle settings. Returns: templateID, sandboxID, clientID, envdVersion, alias, envdAccessToken, trafficAccessToken, domain. Required: templateID.
- **get_single_e_2_b_sandbox_by_id** — Get a single e2b sandbox by id, including runtime details, network configuration, and lifecycle policy. Returns: sandboxID, cpuCount, code, message. Required: id.
- **delete_a_e_2_b_sandbox_by_id** — Delete (kill) an e2b sandbox by id. Returns an empty 204 response on success. Required: id.
- **e_2_b_sandboxes_connect** — Connect to a paused or running e2b sandbox, resuming it if needed and extending its TTL. Returns: templateID, sandboxID, clientID, envdVersion, alias, envdAccessToken, trafficAccessToken, domain. Required: sandbox_id, timeout.
- **e_2_b_sandboxes_pause** — Pause a running e2b sandbox, persisting its filesystem and optionally capturing a full memory snapshot. Returns an empty 204 response on success. Required: sandbox_id.
- **e_2_b_sandboxes_resume** — Resume a paused e2b sandbox with a new time-to-live, optionally auto-pausing after the timeout. Returns: templateID, sandboxID, clientID, envdVersion, alias, envdAccessToken, trafficAccessToken, domain. Required: sandbox_id.
- **e_2_b_sandboxes_refresh** — Refresh a running e2b sandbox, extending its time to live by the specified duration in seconds (max 3600). Returns an empty 204 response on success. Required: sandbox_id.
- **e_2_b_sandboxes_set_timeout** — Set the timeout (TTL) for a running e2b sandbox, measured in seconds from the current time. Calling multiple times overwrites the TTL each time. Returns an empty 204 response on success. Required: sandbox_id, timeout.
- **e_2_b_sandboxes_get_logs** — Get logs for a specific e2b sandbox (deprecated — use get_logs_v2 instead). Returns: logs, logEntries, code, message. Required: sandbox_id.
- **e_2_b_sandboxes_get_metrics** — Get resource usage metrics for a specific e2b sandbox over a time interval. Returns: timestamp, timestampUnix, cpuCount, cpuUsedPct, memUsed, memTotal, memCache, diskUsed, diskTotal. Required: sandbox_id.
- **e_2_b_sandboxes_list_metrics** — List resource usage metrics for multiple e2b sandboxes at once. Returns: sandboxes. Required: sandbox_ids. Maximum 100 sandbox IDs per request.
- **e_2_b_sandboxes_create_snapshot** — Create a persistent snapshot from an e2b sandbox's current state. Returns: code, message. Required: sandbox_id. An optional name body field assigns a template alias; if a snapshot template with that name already exists, a new build is assigned to the existing template instead of creating a new one.
- **e_2_b_sandboxes_bulk_update** — Update the egress network configuration for a running e2b sandbox. Replaces the current egress rules with the provided configuration; omitting a field clears it. Returns an empty 204 response on success. Required: sandbox_id.
- **list_all_e_2_b_snapshots** — List all e2b sandbox snapshots for the team, optionally filtered by source sandbox ID. Returns: code, message.
- **create_a_e_2_b_template** — Create a new template in e2b. Returns: code, message. The build is processed asynchronously and returns a 202 response on acceptance.
- **e_2_b_templates_create_v_2** — Create a new sandbox template in e2b using the v2 API (deprecated). Returns: createdAt, updatedAt, code, message. Required: alias.
- **delete_a_e_2_b_template_by_id** — Delete an e2b template by id. Returns an empty 204 response on success. Required: id.
- **list_all_e_2_b_templates** — List all e2b templates. Returns: templateID, buildID, cpuCount, memoryMB, diskSizeMB, public, aliases, names, createdAt, updatedAt, createdBy, lastSpawnedAt, spawnCount, buildCount, envdVersion, buildStatus, code, message.
- **get_single_e_2_b_template_by_id** — Get a single e2b sandbox template by id, including its build history. Returns: createdAt, updatedAt, code, message. Required: id.
- **e_2_b_templates_get_by_alias** — Get an e2b sandbox template by its alias. Returns: templateID, public. Required: alias.
- **e_2_b_templates_rebuild** — Rebuild an e2b sandbox template by submitting a new Dockerfile and optional build configuration. Returns: createdAt, updatedAt, code, message. Required: template_id, dockerfile.
- **update_a_e_2_b_template_by_id** — Update an e2b template's visibility by id. Returns: createdAt, updatedAt, code, message. Required: id.
- **e_2_b_templates_start_build** — Start an e2b template build by template_id and build_id. Accepts base image, registry credentials, build steps, and post-build commands. Returns an empty 202 response on success. Required: template_id, build_id.
- **e_2_b_templates_get_build_logs** — Get e2b template build logs by template_id and build_id with optional filtering by timestamp, direction, severity level, and log source. Returns: logs. Required: template_id, build_id.
- **e_2_b_templates_get_build_status** — Get e2b template build status and associated logs by template_id and build_id. Returns: logs, logEntries, templateID, buildID, status, reason. Required: template_id, build_id.
- **e_2_b_templates_get_build_upload_link** — Get a build upload link for a template's build layer files in e2b. Returns: present, url. Required: template_id, hash.
- **e_2_b_tags_assign_tags** — Assign tags to an e2b template by targeting it in "name:tag" format. Returns: code, message. Required: target, tags.
- **e_2_b_tags_delete_tags** — Delete multiple tags from an e2b template by name. Returns an empty 204 response on success. Required: name, tags.
- **list_all_e_2_b_tags** — List all tags assigned to an e2b template. Returns: tag, buildID, createdAt, code, message. Required: template_id.
- **e_2_b_teams_get_metrics** — Get metrics for an e2b team within a specified time interval. Returns an array of metric entries, each containing timestamp, timestampUnix, concurrentSandboxes, and sandboxStartRate. Required: team_id.
- **e_2_b_teams_get_metrics_max** — Get the maximum value of a specific metric for an e2b team in a given interval. Returns: timestamp, timestampUnix, value. Required: team_id, metric.
- **list_all_e_2_b_teams** — List all e2b teams associated with the authenticated account. Returns: code, message.
- **create_a_e_2_b_volume** — Create a new team volume in e2b. Returns: volumeID, name, token. Required: name. The name must match the pattern ^[a-zA-Z0-9_-]+$.
- **delete_a_e_2_b_volume_by_id** — Delete a team volume in e2b by id. Returns an empty 204 response on success. Required: id.
- **list_all_e_2_b_volumes** — List all team volumes in e2b. Returns: volumeID, name, code, message.
- **get_single_e_2_b_volume_by_id** — Get a single team volume in e2b by id. Returns: volumeID, name, token. Required: id.
- **e_2_b_envd_health** — Check the health of an e2b sandbox's envd service. Returns an empty 204 response on success.
- **e_2_b_envd_get_envs** — Get the environment variables set in an e2b sandbox. Returns a key-value map of environment variable names to their string values.
- **e_2_b_envd_get_stats** — Get resource usage metrics for an e2b sandbox's envd service. Returns: ts, cpu_count, cpu_used_pct, mem_total, mem_used, disk_used, disk_total, mem_used_mib, mem_total_mib.
- **e_2_b_filesystem_download_file** — Download a file from an e2b sandbox filesystem by its path. Returns the file content as a binary stream (application/octet-stream). Required: path.
- **e_2_b_filesystem_list_dir** — List directory entries in an e2b sandbox filesystem at a given path, optionally controlling recursion depth. Returns: entries, message, code, sandboxID. Required: path.
- **e_2_b_filesystem_make_dir** — Create a directory in an e2b sandbox filesystem at the specified path. Returns: entry, message, code, sandboxID. Required: path.
- **e_2_b_filesystem_stat** — Get file or directory metadata (EntryInfo) for a path in an e2b sandbox filesystem. Returns: entry, message, code, sandboxID. Required: path.
- **e_2_b_filesystem_remove** — Remove a file or directory from an e2b sandbox filesystem at the specified path. Returns an empty response on success. Required: path.
- **e_2_b_filesystem_move** — Move a file or directory inside an e2b sandbox filesystem. Returns the entry object including name, path, size, mode, permissions, owner, group, modifiedTime, symlinkTarget, and metadata. Required: source, destination.
- **e_2_b_filesystem_upload_file** — Upload a file to an e2b sandbox, ensuring parent directories exist. If the file exists it will be overwritten. Returns: type, code, message. Required: path, file.
- **e_2_b_filesystem_create_watcher** — Create a filesystem watcher on a path inside an e2b sandbox for non-streaming event polling. Returns: watcherId. Required: path.
- **e_2_b_filesystem_remove_watcher** — Remove a filesystem watcher from an e2b sandbox by its watcher id. Returns an empty 200 response on success. Required: watcherId.
- **e_2_b_filesystem_get_watcher_events** — Retrieve pending filesystem events for a watcher in an e2b sandbox. Returns: events, message, code, sandboxID. Required: watcherId.
- **e_2_b_filesystem_watch_dir** — Watch a directory in an e2b sandbox for filesystem changes. Returns a stream of WatchDirResponse events with the filesystem entry's name, path, size, mode, permissions, owner, group, modifiedTime, symlinkTarget, and metadata. Required: path.
- **e_2_b_process_start** — Start a new process in an e2b sandbox. Returns: event. Required: process.
- **list_all_e_2_b_process** — List all running processes in an e2b sandbox. Returns: message, code, sandboxID.
- **e_2_b_process_send_input** — Send input to a running process in an e2b sandbox. Returns an empty response body on success. Required: process, input.
- **e_2_b_process_send_signal** — Send a signal to a running process in an e2b sandbox. Returns an empty response body on success. Required: process.
- **update_a_e_2_b_process_by_id** — Update a running process in an e2b sandbox, e.g. resize its PTY. Returns an empty response on success. Required: process, pty.
- **e_2_b_process_close_stdin** — Close the stdin stream of a running process in an e2b sandbox. Returns an empty response on success. Required: process (containing pid).
- **e_2_b_process_connect** — Connect to a running process in an e2b sandbox to receive a stream of ConnectResponse events with PTY output. Returns: event. Required: process (containing pid).
- **e_2_b_process_stream_input** — Stream input data to a running process in an e2b sandbox by sending PTY input. Returns an empty response on success. Required: data (containing input with pty).
- **create_a_e_2_b_webhook** — Register a new e2b webhook to receive sandbox lifecycle events. Returns the created webhook object including id, teamId, name, createdAt, enabled, url, and events. Required: name, url, enabled, events.
- **list_all_e_2_b_webhooks** — List all registered e2b webhooks for your team. Returns each webhook with id, teamId, name, createdAt, enabled, url, and events.
- **get_single_e_2_b_webhook_by_id** — Get a single e2b webhook configuration by id. Returns: id, teamId, name, createdAt, enabled, url, events, version, timestamp, event_category, event_label, event_data, sandbox_id, sandbox_execution_id, sandbox_template_id, sandbox_build_id, sandbox_team_id. Required: id.
- **update_a_e_2_b_webhook_by_id** — Update an existing e2b webhook configuration by id, replacing previous fields with provided values. Returns: id, teamId, name, createdAt, enabled, url, events, version, timestamp, event_category, event_label, event_data, sandbox_id, sandbox_execution_id, sandbox_template_id, sandbox_build_id, sandbox_team_id. Required: id.
- **delete_a_e_2_b_webhook_by_id** — Delete (unregister) an e2b webhook by id. Returns an empty 204 response on success. Required: id.

## How it works

1. **Link your customer's E2B account.** Use Truto's frontend SDK; we handle every OAuth and API key flow so you don't need to create the OAuth app.
2. **Authentication is automatic.** Truto refreshes tokens, stores credentials securely, and injects them into every API request.
3. **Call Truto's API to reach E2B.** The Proxy API is a 1-to-1 mapping of the E2B API.
4. **Get a unified response format.** Every response uses a single shape, with cursor-based pagination and data in the `result` field.

## Use cases

- **Embed a secure code interpreter in your AI product** — SaaS companies with LLM-powered chat or analytics features can offer users the ability to run AI-generated Python or JavaScript on their own data without exposing host infrastructure. Truto handles the E2B connection so your team can focus on the agent loop, not sandbox lifecycle management.
- **Give end users their own AI data analyst** — CRM, finance, and BI platforms can let customers upload a CSV, ask a natural language question, and receive charts or forecasts generated by an LLM inside an isolated E2B sandbox. Each user session gets a fresh microVM, keeping tenant data cleanly separated.
- **Automate bug reproduction and QA workflows** — Support and developer tooling platforms can spin up ephemeral E2B sandboxes to reproduce customer-reported bugs, run test suites against AI-generated patches, and attach verified stack traces back to tickets. Truto standardizes the auth and sandbox provisioning across your customers' E2B teams.
- **Power agentic web automation for your customers** — Marketing intelligence, RPA, and research SaaS products can offer 'computer use' features where agents drive Playwright inside E2B desktop templates. Your platform orchestrates the agent; Truto abstracts the connection to each customer's E2B account.
- **Persist long-running agent sessions across conversations** — Chat-based SaaS products can snapshot and resume E2B sandboxes so an agent's environment, installed dependencies, and working files survive between user sessions. This turns short LLM chats into durable, stateful workspaces without you having to build the persistence layer.

## What you can build

- **Per-user ephemeral sandbox provisioning** — Create and destroy E2B sandboxes on demand for each end-user session using create_a_e_2_b_sandbox and delete_a_e_2_b_sandbox_by_id, with automatic timeout controls via e_2_b_sandboxes_set_timeout.
- **Real-time process streaming in your UI** — Start processes with e_2_b_process_start and stream stdin/stdout back to your frontend using e_2_b_process_stream_input and e_2_b_process_connect so users can watch the agent execute code live.
- **Uploads and artifact retrieval for AI outputs** — Seed sandboxes with customer files via e_2_b_filesystem_upload_file, then pull generated charts, CSVs, or binaries back out with e_2_b_filesystem_download_file to display in your product.
- **Snapshot-based session resume** — Use e_2_b_sandboxes_create_snapshot, e_2_b_sandboxes_pause, and e_2_b_sandboxes_resume to let users return to a stateful agent workspace hours later without losing dependencies or context.
- **Custom sandbox templates per customer** — Let customers pre-load their preferred libraries or internal CLIs by building templates through e_2_b_templates_start_build, e_2_b_templates_rebuild, and e_2_b_templates_get_build_logs.
- **Usage metering and observability dashboards** — Surface per-sandbox and per-team resource usage in your admin UI using e_2_b_sandboxes_get_metrics, e_2_b_sandboxes_get_logs, and e_2_b_teams_get_metrics for billing or governance features.

## FAQs

### How does authentication to E2B work through Truto?

Your end users connect their E2B account to your product through Truto's managed auth flow. Truto stores and refreshes the credentials, so your backend calls E2B tools through Truto without ever handling raw API keys.

### Which E2B operations are available through the integration?

Truto exposes the full E2B surface area needed for agent infrastructure: sandbox lifecycle (create, pause, resume, delete, snapshot), filesystem operations (upload, download, list, watch), process execution and streaming, templates and builds, tags, teams, volumes, and webhooks.

### Can I stream real-time process output back to my application?

Yes. E2B supports connecting to running processes and streaming stdin/stdout through e_2_b_process_connect and e_2_b_process_stream_input, which you can proxy to your frontend over WebSockets for live terminal-style UIs.

### How do I isolate sandboxes between my customers' end users?

Each end user connects their own E2B account through Truto, so sandboxes are created inside their team. Within a single account, you can provision a fresh sandbox per session using create_a_e_2_b_sandbox and tear it down afterward to guarantee no cross-user state.

### Can I persist an agent's environment across sessions?

Yes. Use e_2_b_sandboxes_create_snapshot together with e_2_b_sandboxes_pause and e_2_b_sandboxes_resume to freeze and restore a sandbox's full state, including installed dependencies and files, when a user returns.

### Does Truto support building custom E2B templates?

Yes. You can create and manage custom templates via create_a_e_2_b_template, e_2_b_templates_create_v_2, e_2_b_templates_start_build, and monitor progress with e_2_b_templates_get_build_status and e_2_b_templates_get_build_logs.

### Can I subscribe to sandbox events via webhooks?

Yes. E2B webhooks can be managed programmatically through create_a_e_2_b_webhook, list_all_e_2_b_webhooks, update_a_e_2_b_webhook_by_id, and delete_a_e_2_b_webhook_by_id, so your product can react to lifecycle and build events without polling.

## Related reading

- [Connect E2B to Claude: Automate filesystem tasks and template builds](https://truto.one/blog/connect-e2b-to-claude-automate-filesystem-tasks-and-template-builds/) — Learn how to connect E2B to Claude using Truto's managed MCP server. Automate filesystem tasks, run secure code, and build templates using natural language.
- [Connect E2B to ChatGPT: Run Secure Code & Isolated Sandboxes](https://truto.one/blog/connect-e2b-to-chatgpt-run-secure-code-and-manage-isolated-sandboxes/) — Learn how to connect E2B to ChatGPT using a managed MCP server. This guide covers sandbox automation, secure code execution, and bypassing API constraints.
- [Connect E2B to AI Agents: Orchestrate remote processes and system metrics](https://truto.one/blog/connect-e2b-to-ai-agents-orchestrate-remote-processes-and-system-metrics/) — Learn how to connect E2B to AI agents using Truto's /tools endpoint. Build autonomous workflows to execute secure code and monitor infrastructure.
