> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e2b.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create template (v3)

> Create a new template



## OpenAPI

````yaml /openapi-public.yaml post /v3/templates
openapi: 3.1.0
info:
  title: E2B API
  version: 0.1.0
  description: >-
    Complete E2B developer API. Platform endpoints are served on api.e2b.app.
    Sandbox endpoints (envd) are served on the shared sandbox host
    (sandbox.e2b.app); target a specific sandbox with the E2b-Sandbox-Id and
    E2b-Sandbox-Port headers.
servers:
  - url: https://api.e2b.app
    description: E2B Platform API
security: []
tags:
  - name: Sandboxes
  - name: Templates
  - name: Tags
  - name: Volumes
  - name: Envd
  - name: Filesystem
  - name: Process
  - name: Teams
  - name: Secrets
  - name: Events
  - name: Webhooks
paths:
  /v3/templates:
    servers:
      - url: https://api.e2b.app
        description: E2B Platform API
    post:
      tags:
        - Templates
      summary: Create template (v3)
      description: Create a new template
      operationId: postTemplatesV3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateBuildRequestV3'
      responses:
        '202':
          description: The build was requested successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateRequestResponseV3'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 400
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                nameRequired:
                  summary: Neither name nor the deprecated alias was supplied
                  value:
                    code: 400
                    message: Name is required
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 401
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                missingAuthentication:
                  summary: No supported authentication header was supplied
                  value:
                    code: 401
                    message: authorization header is missing
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 403
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                teamBanned:
                  summary: The team is banned at authentication
                  value:
                    code: 403
                    message: team is banned
                teamBlocked:
                  summary: >-
                    The authenticated team is blocked. The message may append a
                    reason
                  value:
                    code: 403
                    message: team is blocked
        '404':
          description: Not found
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 404
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                templateDeleted:
                  summary: The template was deleted while registering the build
                  value:
                    code: 404
                    message: >-
                      Template 'my-template' has been deleted and cannot be
                      rebuilt
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 409
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                clusterChanged:
                  summary: The team's cluster changed during template registration
                  value:
                    code: 409
                    message: >-
                      The team's cluster changed; retry the template build
                      request
        '429':
          description: Too many requests
          headers:
            Retry-After:
              description: >-
                When present, the number of seconds to wait before retrying the
                request.
              required: false
              schema:
                type: integer
                minimum: 0
              example: 30
            RateLimit-Limit:
              description: Configured rate-limit burst size.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests remaining in the rate-limit window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the rate-limit window resets.
              schema:
                type: integer
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 429
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                rateLimitExceeded:
                  summary: A configured API rate limit was exceeded
                  value:
                    code: 429
                    message: Rate limit exceeded
        '500':
          description: Server error
          content:
            application/json:
              schema:
                required:
                  - code
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                    description: Error code
                    example: 500
                  error_code:
                    type: string
                    description: >-
                      Machine-readable semantic error code. Not a closed set;
                      initial values: sandbox_capacity_unavailable,
                      sandbox_placement_timeout, sandbox_no_compatible_node,
                      sandbox_create_failed, internal_server_error.
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                operationFailed:
                  summary: The team's template-build cluster cannot be read
                  value:
                    code: 500
                    message: Error when checking the team's cluster
      security:
        - ApiKeyAuth: []
components:
  schemas:
    TemplateBuildRequestV3:
      properties:
        name:
          description: >-
            Name of the template. Can include a tag with colon separator (e.g.
            "my-template" or "my-template:v1"). If tag is included, it will be
            treated as if the tag was provided in the tags array.
          type: string
          maxLength: 128
        tags:
          type: array
          description: Tags to assign to the template build
          items:
            type: string
        alias:
          description: Alias of the template. Deprecated, use name instead.
          type: string
          maxLength: 128
          deprecated: true
        teamID:
          deprecated: true
          type: string
          description: Identifier of the team, as its UUID or its public project ID (prj_)
        cpuCount:
          $ref: '#/components/schemas/CPUCount'
        memoryMB:
          $ref: '#/components/schemas/MemoryMB'
        minFreeDiskMb:
          $ref: '#/components/schemas/MinFreeDiskMb'
      type: object
    TemplateRequestResponseV3:
      required:
        - templateID
        - buildID
        - public
        - aliases
        - names
        - tags
      properties:
        templateID:
          type: string
          description: Identifier of the template
        buildID:
          type: string
          description: Identifier of the last successful build for given template
        public:
          type: boolean
          description: Whether the template is public or only accessible by the team
        names:
          type: array
          description: Names of the template
          items:
            type: string
        tags:
          type: array
          description: Tags assigned to the template build
          items:
            type: string
        aliases:
          type: array
          description: Aliases of the template
          deprecated: true
          items:
            type: string
      type: object
    CPUCount:
      type: integer
      format: int32
      minimum: 1
      description: CPU cores for the sandbox
    MemoryMB:
      type: integer
      format: int32
      minimum: 128
      description: Memory for the sandbox in MiB
    MinFreeDiskMb:
      type: integer
      format: int32
      minimum: 0
      description: >-
        Requested minimum free space after the template's build steps, in MiB.
        Omit to use the team's default. Set to 0 to request no minimum free-disk
        growth. The filesystem is never shrunk, including inherited or
        already-larger filesystems. Growth is best effort, so filesystem
        metadata can leave the available space slightly below the requested
        minimum.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````