Skip to main content
You can list your project’s templates, inspect a single template and its builds, and delete templates you no longer need. Use the CLI or the API. The JavaScript and Python SDKs don’t have methods to list or delete templates.

CLI

These commands need E2B CLI 2.23.0 or later.

List templates

The CLI pages through all of your templates for you, so it works for projects of any size.

Delete a template

Pass the template ID or name. The CLI asks for confirmation unless you pass -y.
The CLI has no command to inspect a single template. Use GET /templates/{templateID} instead.

API

Authenticate every request with your API key in the X-API-Key header.

List templates

GET /v2/templates returns your templates newest first, one page at a time. The X-Next-Token header is only set when there are more results. Keep requesting pages until it’s missing:
Each template includes templateID, names, buildID, buildStatus, cpuCount, memoryMB, diskSizeMB, public, createdAt, updatedAt, lastSpawnedAt, spawnCount, and buildCount.
GET /templates (without /v2) is deprecated. It returns every template in one response and fails with 400 Bad Request when your project has more than 5,000 templates. Use GET /v2/templates instead.

Get a template

GET /templates/{templateID} returns one template with its builds. Pass the template ID, not a name. Builds are paginated with the same limit, nextToken, and X-Next-Token as the list endpoint.

Delete a template

DELETE /templates/{templateID} deletes a template by ID or name and returns 204 No Content. The template’s names become free to reuse.
You can’t delete a template while running or paused sandboxes use it. The API returns 400 Bad Request. Kill those sandboxes first, then retry.