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

# Start build (v2)

> Start the build



## OpenAPI

````yaml /openapi-public.yml post /v2/templates/{templateID}/builds/{buildID}
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
paths:
  /v2/templates/{templateID}/builds/{buildID}:
    servers:
      - url: https://api.e2b.app
        description: E2B Platform API
    post:
      tags:
        - Templates
      summary: Start build (v2)
      description: Start the build
      operationId: postTemplateBuildV2
      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
          content:
            application/json:
              schema:
                type: object
                description: Empty response
        '401':
          $ref: '#/components/responses/401'
        '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
      properties:
        fromImage:
          type: string
          description: Image to use as a base for the template build
        fromTemplate:
          type: string
          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:
            $ref: '#/components/schemas/AWSRegistry'
          gcp:
            $ref: '#/components/schemas/GCPRegistry'
          registry:
            $ref: '#/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
          description: Hash of the files used in the step
        force:
          default: false
          type: boolean
          description: Whether the step should be forced to run regardless of the cache
      type: object
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: Error code
        message:
          type: string
          description: Error
      type: object
    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:
    '401':
      description: Authentication error
      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

````