> ## 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.

# Get template (v2)

> Get a template by its ID or name, with its default build and without its other builds. Give a namespaced name as `team/name` with the slash encoded as `%2F`, for example `my-team%2Fmy-template`. A reference with a tag (for example `my-template:v2`) returns 400. A template that is missing, deleted or owned by another team returns 404.



## OpenAPI

````yaml /openapi-public.yaml get /v2/templates/{templateID}
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:
  /v2/templates/{templateID}:
    servers:
      - url: https://api.e2b.app
        description: E2B Platform API
    get:
      tags:
        - Templates
      summary: Get template (v2)
      description: >-
        Get a template by its ID or name, with its default build and without its
        other builds. Give a namespaced name as `team/name` with the slash
        encoded as `%2F`, for example `my-team%2Fmy-template`. A reference with
        a tag (for example `my-template:v2`) returns 400. A template that is
        missing, deleted or owned by another team returns 404.
      operationId: getTemplateV2
      parameters:
        - $ref: '#/components/parameters/templateID'
      responses:
        '200':
          description: Successfully returned the template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateV2'
        '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 (a node could not create the sandbox
                      this time; retry), sandbox_create_refused (a node refused
                      the sandbox for a reason no retry changes, such as a vcpu
                      count out of bounds in the stored build; a server error,
                      since no request field reaches that check),
                      internal_server_error, secret_limit_reached,
                      idempotency_request_mismatch, idempotency_in_progress,
                      idempotency_outcome_unknown,
                      sandbox_snapshot_guest_agent_unresponsive (a plain resume
                      of a snapshot taken while the sandbox guest agent was not
                      responding; resume it with memory: false).
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                taggedTemplateReference:
                  summary: The template reference includes a tag
                  value:
                    code: 400
                    message: 'Invalid template ID: a tag is not accepted here'
        '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 (a node could not create the sandbox
                      this time; retry), sandbox_create_refused (a node refused
                      the sandbox for a reason no retry changes, such as a vcpu
                      count out of bounds in the stored build; a server error,
                      since no request field reaches that check),
                      internal_server_error, secret_limit_reached,
                      idempotency_request_mismatch, idempotency_in_progress,
                      idempotency_outcome_unknown,
                      sandbox_snapshot_guest_agent_unresponsive (a plain resume
                      of a snapshot taken while the sandbox guest agent was not
                      responding; resume it with memory: false).
                  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 (a node could not create the sandbox
                      this time; retry), sandbox_create_refused (a node refused
                      the sandbox for a reason no retry changes, such as a vcpu
                      count out of bounds in the stored build; a server error,
                      since no request field reaches that check),
                      internal_server_error, secret_limit_reached,
                      idempotency_request_mismatch, idempotency_in_progress,
                      idempotency_outcome_unknown,
                      sandbox_snapshot_guest_agent_unresponsive (a plain resume
                      of a snapshot taken while the sandbox guest agent was not
                      responding; resume it with memory: false).
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                teamBanned:
                  summary: The team is banned at authentication
                  value:
                    code: 403
                    message: team is banned
        '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 (a node could not create the sandbox
                      this time; retry), sandbox_create_refused (a node refused
                      the sandbox for a reason no retry changes, such as a vcpu
                      count out of bounds in the stored build; a server error,
                      since no request field reaches that check),
                      internal_server_error, secret_limit_reached,
                      idempotency_request_mismatch, idempotency_in_progress,
                      idempotency_outcome_unknown,
                      sandbox_snapshot_guest_agent_unresponsive (a plain resume
                      of a snapshot taken while the sandbox guest agent was not
                      responding; resume it with memory: false).
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                templateNotFound:
                  summary: The template is missing, deleted or owned by another team
                  value:
                    code: 404
                    message: Template not found
        '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 (a node could not create the sandbox
                      this time; retry), sandbox_create_refused (a node refused
                      the sandbox for a reason no retry changes, such as a vcpu
                      count out of bounds in the stored build; a server error,
                      since no request field reaches that check),
                      internal_server_error, secret_limit_reached,
                      idempotency_request_mismatch, idempotency_in_progress,
                      idempotency_outcome_unknown,
                      sandbox_snapshot_guest_agent_unresponsive (a plain resume
                      of a snapshot taken while the sandbox guest agent was not
                      responding; resume it with memory: false).
                  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 (a node could not create the sandbox
                      this time; retry), sandbox_create_refused (a node refused
                      the sandbox for a reason no retry changes, such as a vcpu
                      count out of bounds in the stored build; a server error,
                      since no request field reaches that check),
                      internal_server_error, secret_limit_reached,
                      idempotency_request_mismatch, idempotency_in_progress,
                      idempotency_outcome_unknown,
                      sandbox_snapshot_guest_agent_unresponsive (a plain resume
                      of a snapshot taken while the sandbox guest agent was not
                      responding; resume it with memory: false).
                  message:
                    type: string
                    description: Error
                type: object
              examples:
                operationFailed:
                  summary: The template lookup fails
                  value:
                    code: 500
                    message: Error when getting template
      security:
        - ApiKeyAuth: []
components:
  parameters:
    templateID:
      name: templateID
      in: path
      required: true
      schema:
        type: string
  schemas:
    TemplateV2:
      description: >
        A template with its default build. `defaultBuild` is the build a sandbox
        created without a tag starts from, the latest ready build tagged
        default; it is absent until such a build is ready. `buildStatus` is the
        status of the latest build tagged default in any state: it is `building`
        while a rebuild runs, although sandboxes still start from the default
        build.
      required:
        - templateID
        - names
        - public
        - createdAt
        - updatedAt
        - createdBy
        - lastSpawnedAt
        - spawnCount
        - buildCount
        - isDefault
        - buildStatus
      properties:
        templateID:
          type: string
          description: Identifier of the template
        names:
          type: array
          description: Names of the template (namespace/alias format when namespaced)
          items:
            type: string
        public:
          type: boolean
          description: Whether the template is public or only accessible by the team
        createdAt:
          type: string
          format: date-time
          description: Time when the template was created
        updatedAt:
          type: string
          format: date-time
          description: Time when the template was last updated
        createdBy:
          oneOf:
            - $ref: '#/components/schemas/TeamUser'
            - type: 'null'
        lastSpawnedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: Time when the template was last used
        spawnCount:
          type: integer
          format: int64
          description: Number of times the template was used
        buildCount:
          type: integer
          format: int32
          description: Number of times the template was built
        isDefault:
          type: boolean
          description: Whether the template is one of the platform's default templates
        description:
          type: string
          description: Description of the template
        buildStatus:
          $ref: '#/components/schemas/TemplateBuildStatus'
        defaultBuild:
          $ref: '#/components/schemas/TemplateBuild'
      type: object
    TeamUser:
      required:
        - id
        - email
      properties:
        id:
          type: string
          format: uuid
          description: Identifier of the user
        email:
          type:
            - string
            - 'null'
          deprecated: true
          default: null
          description: Email of the user
      type: object
    TemplateBuildStatus:
      type: string
      description: Status of the template build
      enum:
        - building
        - waiting
        - ready
        - error
        - uploaded
    TemplateBuild:
      required:
        - buildID
        - status
        - createdAt
        - updatedAt
        - cpuCount
        - memoryMB
      properties:
        buildID:
          type: string
          format: uuid
          description: Identifier of the build
        status:
          $ref: '#/components/schemas/TemplateBuildStatus'
        createdAt:
          type: string
          format: date-time
          description: Time when the build was created
        updatedAt:
          type: string
          format: date-time
          description: Time when the build was last updated
        finishedAt:
          type: string
          format: date-time
          description: Time when the build was finished
        cpuCount:
          $ref: '#/components/schemas/CPUCount'
        maxCpuCount:
          allOf:
            - $ref: '#/components/schemas/CPUCount'
          description: >-
            Maximum CPU count for resizable templates; absent for fixed-size
            templates.
        memoryMB:
          $ref: '#/components/schemas/MemoryMB'
        diskSizeMB:
          $ref: '#/components/schemas/DiskSizeMB'
        envdVersion:
          $ref: '#/components/schemas/EnvdVersion'
      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
    DiskSizeMB:
      type: integer
      format: int32
      minimum: 0
      description: Disk size for the sandbox in MiB
    EnvdVersion:
      type: string
      description: Version of the envd running in the sandbox
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````