> ## 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 build logs

> Get template build logs



## OpenAPI

````yaml /openapi-public.yaml get /templates/{templateID}/builds/{buildID}/logs
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:
  /templates/{templateID}/builds/{buildID}/logs:
    servers:
      - url: https://api.e2b.app
        description: E2B Platform API
    get:
      tags:
        - Templates
      summary: Get build logs
      description: Get template build logs
      operationId: getTemplateBuildLogs
      parameters:
        - $ref: '#/components/parameters/templateID'
        - $ref: '#/components/parameters/buildID'
        - in: query
          name: cursor
          schema:
            type: integer
            format: int64
            minimum: 0
          description: >-
            Starting timestamp of the logs that should be returned in
            milliseconds
        - in: query
          name: limit
          schema:
            default: 100
            type: integer
            format: int32
            minimum: 0
            maximum: 100
          description: Maximum number of logs that should be returned
        - in: query
          name: direction
          schema:
            $ref: '#/components/schemas/LogsDirection'
        - in: query
          name: level
          schema:
            $ref: '#/components/schemas/LogLevel'
        - in: query
          name: source
          schema:
            $ref: '#/components/schemas/LogsSource'
          description: Source of the logs that should be returned from
      responses:
        '200':
          description: Successfully returned the template build logs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateBuildLogsResponse'
        '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:
                buildNotFound:
                  summary: The build ID is valid but the build was not found
                  value:
                    code: 400
                    message: Build '00000000-0000-0000-0000-000000000000' not found
                invalidBuildId:
                  summary: The build ID is malformed
                  value:
                    code: 400
                    message: Invalid build id
        '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
                templateAccessDenied:
                  summary: The authenticated team cannot access the template
                  value:
                    code: 403
                    message: >-
                      You don't have access to this sandbox template
                      (my-template)
        '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: Looking up the build fails
                  value:
                    code: 500
                    message: Error when getting template
      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:
    LogsDirection:
      type: string
      description: Direction of the logs that should be returned
      enum:
        - forward
        - backward
      x-enum-varnames:
        - LogsDirectionForward
        - LogsDirectionBackward
    LogLevel:
      type: string
      description: Severity level for log entries (e.g. info, warn, error)
    LogsSource:
      type: string
      description: Source of the logs that should be returned
      enum:
        - temporary
        - persistent
      x-enum-varnames:
        - LogsSourceTemporary
        - LogsSourcePersistent
    TemplateBuildLogsResponse:
      required:
        - logs
      properties:
        logs:
          default: []
          description: Build logs structured
          type: array
          items:
            $ref: '#/components/schemas/BuildLogEntry'
      type: object
    BuildLogEntry:
      required:
        - timestamp
        - message
        - level
      properties:
        timestamp:
          type: string
          format: date-time
          description: Timestamp of the log entry
        message:
          type: string
          description: Log message content
        level:
          $ref: '#/components/schemas/LogLevel'
        step:
          type: string
          description: Step in the build process related to the log entry
      type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````