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

# Start template build (v2)

> Start the build



## OpenAPI

````yaml /compute/api-reference/e2b-openapi.yaml post /v2/templates/{templateID}/builds/{buildID}
openapi: 3.0.0
info:
  title: Anona Compute API (E2B-compatible routes)
  version: 0.1.0
  description: >-
    The E2B API operations the Anona Compute gateway serves, from the E2B spec
    pinned at e2b SDK 2.61.0 (`gateway/third_party/specs/e2b/openapi.yml`).
    Generated by `docs-site/scripts/gen_e2b_openapi.py`; do not edit by hand.
servers:
  - url: https://api.compute.anonalabs.com
security: []
tags:
  - name: sandboxes
paths:
  /v2/templates/{templateID}/builds/{buildID}:
    post:
      tags:
        - templates
      summary: Start template build (v2)
      description: Start the build
      parameters:
        - $ref: '#/components/parameters/templateID'
        - $ref: '#/components/parameters/buildID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateBuildStartV2'
      responses:
        '202':
          description: The build has started
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    templateID:
      name: templateID
      in: path
      required: true
      schema:
        type: string
    buildID:
      name: buildID
      in: path
      required: true
      schema:
        type: string
  schemas:
    TemplateBuildStartV2:
      type: object
      description: Exactly one of fromImage or fromTemplate must be given and non-empty.
      properties:
        fromImage:
          type: string
          minLength: 1
          description: Image to use as a base for the template build
        fromTemplate:
          type: string
          minLength: 1
          description: Template to use as a base for the template build
        fromImageRegistry:
          $ref: '#/components/schemas/FromImageRegistry'
        force:
          default: false
          type: boolean
          description: >-
            Whether the whole build should be forced to run regardless of the
            cache
        steps:
          default: []
          description: List of steps to execute in the template build
          type: array
          items:
            $ref: '#/components/schemas/TemplateStep'
        startCmd:
          description: Start command to execute in the template after the build
          type: string
        readyCmd:
          description: Ready check command to execute in the template after the build
          type: string
    FromImageRegistry:
      oneOf:
        - $ref: '#/components/schemas/AWSRegistry'
        - $ref: '#/components/schemas/GCPRegistry'
        - $ref: '#/components/schemas/GeneralRegistry'
      discriminator:
        propertyName: type
        mapping:
          aws: '#/components/schemas/AWSRegistry'
          gcp: '#/components/schemas/GCPRegistry'
          registry: '#/components/schemas/GeneralRegistry'
    TemplateStep:
      description: Step in the template build process
      required:
        - type
      properties:
        type:
          type: string
          description: Type of the step
        args:
          default: []
          type: array
          description: Arguments for the step
          items:
            type: string
        filesHash:
          type: string
          pattern: ^[0-9a-f]{64}$
          description: Hash of the files used in the step (lowercase hex SHA-256)
        force:
          default: false
          type: boolean
          description: Whether the step should be forced to run regardless of the cache
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: Error code
        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.
        message:
          type: string
          description: Error
    AWSRegistry:
      type: object
      required:
        - type
        - awsAccessKeyId
        - awsSecretAccessKey
        - awsRegion
      properties:
        type:
          type: string
          enum:
            - aws
          description: Type of registry authentication
        awsAccessKeyId:
          type: string
          description: AWS Access Key ID for ECR authentication
        awsSecretAccessKey:
          type: string
          description: AWS Secret Access Key for ECR authentication
        awsRegion:
          type: string
          description: AWS Region where the ECR registry is located
    GCPRegistry:
      type: object
      required:
        - type
        - serviceAccountJson
      properties:
        type:
          type: string
          enum:
            - gcp
          description: Type of registry authentication
        serviceAccountJson:
          type: string
          description: Service Account JSON for GCP authentication
    GeneralRegistry:
      type: object
      required:
        - type
        - username
        - password
      properties:
        type:
          type: string
          enum:
            - registry
          description: Type of registry authentication
        username:
          type: string
          description: Username to use for the registry
        password:
          type: string
          description: Password to use for the registry
  responses:
    '400':
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '401':
      description: Authentication error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '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
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.