Skip to main content
Template names are unique identifiers used to reference and create sandboxes from your templates. They serve as human-readable names that make it easy to identify and use your templates across your applications.

What is a Template Name?

A name is a string identifier that you assign to a template when building it. Once a template is built with a name, you can use that name to create sandboxes from the template.
// Build a template with a name
await Template.build(template, 'my-python-env', {
  cpuCount: 2,
  memoryMB: 2048,
})

// Create a sandbox using the name
const sandbox = await Sandbox.create('my-python-env')

Uniqueness Requirement

Template names must be globally unique across the entire E2B platform, not just within your team or account. This means if another user has already claimed a name, you cannot use it for your template.
When choosing a name, consider using:
  • Your company or project name as a prefix (e.g., acme-api-server)
  • Version numbers or environment indicators (e.g., myapp-v2, myapp-staging)
  • Descriptive names that indicate the template’s purpose (e.g., data-analysis-python)

Common Use Cases

Development and Production Environments

Use different names for different environments:
// Development template
await Template.build(template, 'myapp-dev', {
  cpuCount: 1,
  memoryMB: 1024,
})

// Production template
await Template.build(template, 'myapp-prod', {
  cpuCount: 4,
  memoryMB: 4096,
})

Multiple Template Variants

Create different variants of the same template with different configurations:
// Small instance
await Template.build(template, 'myapp-small', {
  cpuCount: 1,
  memoryMB: 512,
})

// Large instance
await Template.build(template, 'myapp-large', {
  cpuCount: 8,
  memoryMB: 16384,
})
When building variants with the same template definition but different CPU/RAM configurations, E2B’s caching system will reuse common layers, making subsequent builds much faster.

Checking Name Availability

You can check if a name is already in use with the aliasExists method.
import { Template } from 'e2b'

const exists = await Template.aliasExists('my-template')
console.log(`Name ${exists ? 'is taken' : 'is available'}`)

Best Practices

  1. Use descriptive names: Choose names that clearly indicate the template’s purpose or configuration
  2. Include versioning: Consider adding version numbers to your names for better version management (e.g., myapp-v1, myapp-v2)
  3. Use consistent naming: Establish a naming convention for your team and stick to it
  4. Document your names: Keep a record of which names are used for which purposes in your team