canonical: https://jentic.com/apis/e2b.dev/e2b

# E2B API

The E2B API creates and manages isolated cloud sandboxes where AI agents run generated code safely. Agents can start a sandbox, pause and resume it, set timeouts, stream its logs, and read CPU and memory metrics, then snapshot it to resume later. Custom sandbox images are defined as templates that build from files, carry tags and aliases, and report build status and logs. The API also manages persistent volumes, team API keys, and access tokens.

## For AI agents

Create and control cloud sandboxes for running AI-generated code, build custom sandbox templates, and manage snapshots, volumes, and keys. Covers 53 operations across sandboxes and templates.

## Scope

Does not handle code editing, source control, or long-term application hosting. Use for ephemeral code-execution sandboxes and their templates only.

## Capabilities

- Create and list cloud sandboxes for running AI-generated code
- Pause, resume, and set timeouts on a running sandbox
- Stream a sandbox's logs and read its CPU and memory metrics
- Build and version custom sandbox templates from files, with tags and aliases
- Snapshot a sandbox and resume from the snapshot later
- Manage persistent volumes, team API keys, and access tokens

## Use cases

### AI Agent Code Execution

Let an AI agent run code it writes in an isolated cloud sandbox instead of on the host machine: it creates a sandbox, connects to it, streams the logs while the code runs, and deletes the sandbox when the task is done. Through Jentic the agent discovers the right E2B operation by intent and calls it with the sandbox id, so a code-execution loop runs without a developer wiring the sandbox lifecycle by hand.

Example prompt: Create a sandbox, stream its logs while code runs, then delete the sandbox when finished

### Custom Sandbox Templates

Teams bake their dependencies into a reusable sandbox image so every run starts from the same environment. The API creates a template, starts a build from the supplied files, reports build status and logs, and tags the result with a stable alias. Sandboxes then start from that template instead of installing packages on each run.

Example prompt: Create a template, start a build, poll the build status until it succeeds, then tag the template with a stable alias

### Long-Running Sessions with Snapshots

Agents that work in several turns keep a sandbox's state between calls rather than rebuilding it each time. The API pauses a sandbox to persist its state, snapshots it, and resumes it later, while the timeout operation extends how long an idle sandbox stays alive. This keeps a session's files and processes available across an agent's steps.

Example prompt: Create a sandbox, pause it after setup, then resume it later and extend its timeout

### Sandbox Resource Monitoring

Platform teams track how many sandboxes are running and how much they consume to control cost. The API lists sandboxes, reads each sandbox's CPU and memory metrics, and exposes team-level metrics and maximums. An agent uses these to clean up idle sandboxes before they add to the bill.

Example prompt: List running sandboxes, read each sandbox's CPU and memory metrics, then delete any that have been idle

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/sandboxes` | Create a sandbox |
| GET | `/sandboxes` | List sandboxes |
| DELETE | `/sandboxes/{sandboxID}` | Delete a sandbox |
| POST | `/sandboxes/{sandboxID}/pause` | Pause a sandbox |
| POST | `/sandboxes/{sandboxID}/resume` | Resume a sandbox |
| POST | `/templates` | Create a sandbox template |
| GET | `/templates/{templateID}/builds/{buildID}/status` | Get a template build status |
| POST | `/volumes` | Create a persistent volume |

## Key resources

- **Sandboxes** — Create, list, pause, resume, connect to, snapshot, and delete code-execution sandboxes
- **Templates** — Define, build, tag, and version custom sandbox images and read their build status and logs
- **Volumes** — Create, list, and delete persistent volumes attached to sandboxes
- **Teams** — Read team membership and resource usage metrics
- **Auth** — Create and revoke API keys and access tokens

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 40 / 100
- **Maturity:** Non-Ready
- **Dimensions:**
  - Foundational Compliance: 99 / 100
  - Developer Experience & Jentic Compatibility: 69 / 100
  - AI-Readiness & Agent Experience: 16 / 100
  - Agent Usability: 93 / 100
  - Security: 52 / 100
  - AI Discoverability: 59 / 100
- **View full report:** https://jentic.com/apis/e2b.dev/e2b/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring E2B by hand means choosing between its X-API-Key header and bearer access tokens, managing the create-pause-resume sandbox lifecycle, and polling template build status yourself. Through Jentic you install once, import E2B from the API Directory, store the API key once, and your agent calls it.
- **Permission scoping:** E2B puts the sandbox, template, and volume ids in the URL path (`/sandboxes/{sandboxID}`, `/templates/{templateID}`), so a rule can pin your agent to specific sandboxes or templates and the operations you pick. You choose the operations it may call, so creating and reading sandboxes can be allowed while destructive ones like deleting a sandbox or killing a team's sandboxes are not included unless you add them.
- **Credential handling:** Your E2B API key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'create a code sandbox' or 'build a template', and Jentic returns the matching E2B operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Render API** — Managed cloud compute for services and jobs rather than ephemeral sandboxes
- **Railway API** — Deploy and run apps and jobs on managed infrastructure
- **Northflank API** — Container orchestration and build pipelines on managed infrastructure
- **DigitalOcean API** — General cloud infrastructure to host services alongside sandbox workloads

## FAQ

### What authentication does the E2B API use?

The E2B API authenticates with an API key in the X-API-Key header or a bearer access token per its OpenAPI spec, and some team and administrative operations use additional header tokens. Through Jentic the credential is stored encrypted by your own Jentic One instance and injected at call time, so it never enters the agent's context.

### Can I run AI-generated code with the E2B API?

Yes. The create-sandbox operation starts an isolated cloud sandbox, the connect and timeout operations attach to it and keep it alive while code runs, and the logs operation streams its output. You delete the sandbox when the task is done or pause it to resume later.

### What are the rate limits for the E2B API?

The OpenAPI spec does not specify rate limits; see https://e2b.dev/docs for current limits. Sandbox concurrency is governed by your team plan, which you can inspect with the team metrics operations.

### Is there an E2B MCP server?

You don't need an MCP server to give your agent the E2B API. Jentic connects it directly from the API Directory: import it, store your API key once, and your agent calls operations like creating a sandbox or building a template. Operations are discovered on demand, so no extra server's tool definitions sit in your agent's context.

### Can I limit what my agent is allowed to do with the E2B API?

Yes. Write a rule that allows only creating, reading, and pausing sandboxes, so the agent can run and inspect code but cannot delete sandboxes or kill a whole team's sandboxes. Because E2B addresses sandboxes and templates by id in the URL path, a rule can also pin the agent to specific sandboxes, and every call is logged.

### How do I create a sandbox with the E2B API through Jentic?

Search Jentic for 'create a code execution sandbox' to find the create-sandbox operation, start the sandbox, stream its logs while code runs, then delete it. To run it on your own infrastructure, install Jentic One from its GitHub repo.
