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

# Get image build logs

> Gets logs from a sandbox image's latest build, newest first.

Keep the time range fixed when paging with `offset`.

Related guide: [Inspect image build logs](/sandboxes/logs#inspect-image-build-logs).


## OpenAPI

````yaml get /v1/sandboxes/images/{image_name}/logs
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/sandboxes/images/{image_name}/logs:
    parameters:
      - $ref: '#/components/parameters/SandboxImageName'
    get:
      tags:
        - Images
      summary: Get image build logs
      description: >-
        Return one page of logs from the latest recorded build of this image,
        including failed builds, newest first. Logs may take a short time to
        appear. Defaults to the last 24 hours; the requested time range must not
        exceed 7 days. Keep start_time and end_time fixed when paging with
        offset. A new build changes the log source; this endpoint does not
        retrieve a historical build by ID. While a new upload is waiting to
        start, logs may still refer to the preceding build. Older builds without
        a recorded environment use image-level build logs within the requested
        time range.
      operationId: GetImageBuildLogs
      parameters:
        - $ref: '#/components/parameters/TeamId'
        - $ref: '#/components/parameters/TeamIdHeader'
        - name: start_time
          in: query
          description: Inclusive RFC 3339 start time. Defaults to 24 hours before end_time.
          schema:
            format: date-time
            type: string
        - name: end_time
          in: query
          description: RFC 3339 end time. Defaults to the current time.
          schema:
            format: date-time
            type: string
        - name: limit
          in: query
          description: Maximum number of log entries to return.
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
        - name: offset
          in: query
          description: >-
            Number of log entries to skip. Narrow the time range beyond 10000
            entries.
          schema:
            type: integer
            minimum: 0
            maximum: 10000
            default: 0
      responses:
        '200':
          description: >-
            Build logs in the requested time range. An empty array means no logs
            are available in that range.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxImageBuildLogsResponseV1'
              example:
                logs:
                  - timestamp: '2026-09-29T12:00:00Z'
                    message: 'Step 1/2: loading build context'
                    severity: 9
                total_count: 1
        '400':
          $ref: '#/components/responses/SandboxError400'
        '401':
          $ref: '#/components/responses/SandboxError401'
        '403':
          $ref: '#/components/responses/SandboxError403'
        '404':
          $ref: '#/components/responses/SandboxError404'
        '429':
          $ref: '#/components/responses/SandboxError429'
        '500':
          $ref: '#/components/responses/SandboxError500'
        '503':
          description: >-
            Build log service is temporarily unavailable. Returns a JSON error
            with code and message.
components:
  parameters:
    SandboxImageName:
      name: image_name
      in: path
      required: true
      description: Image repository name.
      schema:
        type: string
        minLength: 1
        example: base-image
    TeamId:
      name: team_id
      in: query
      required: false
      description: >-
        Optional team ID. Must match X-Team-Id when both are supplied. If
        neither selector is supplied, defaults to the caller's only accessible
        team. Callers with multiple accessible teams must select a team.
        Requests without access to any team are forbidden.
      schema:
        minLength: 1
        type: string
    TeamIdHeader:
      name: X-Team-Id
      in: header
      required: false
      description: >-
        Optional team ID. Must match the team_id query parameter when both are
        supplied. If neither selector is supplied, defaults to the caller's only
        accessible team. Callers with multiple accessible teams must select a
        team. Requests without access to any team are forbidden.
      schema:
        minLength: 1
        type: string
  schemas:
    SandboxImageBuildLogsResponseV1:
      type: object
      required:
        - logs
        - total_count
      properties:
        logs:
          type: array
          items:
            $ref: '#/components/schemas/SandboxImageBuildLogV1'
        total_count:
          type: integer
          format: int64
          description: Number of matching log entries in the requested time range.
    SandboxImageBuildLogV1:
      type: object
      required:
        - timestamp
        - message
        - severity
      properties:
        timestamp:
          format: date-time
          type: string
        message:
          type: string
        severity:
          type: integer
          description: Numeric OpenTelemetry severity level.
  responses:
    SandboxError400:
      description: >-
        Invalid request. Returns a JSON error with code, message, and optional
        details.
      content:
        application/json:
          example:
            code: INVALID_REQUEST
            message: One or more request parameters are invalid.
            details:
              request_id: a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043
    SandboxError401:
      description: >-
        Missing or invalid authentication. Returns a JSON error with code,
        message, and optional details.
      content:
        application/json:
          example:
            code: UNAUTHORIZED
            message: Provide a valid authentication token in the Authorization header.
            details:
              header: Authorization
    SandboxError403:
      description: >-
        Insufficient permissions. Returns a JSON error with code, message, and
        optional details.
      content:
        application/json:
          example:
            code: FORBIDDEN
            message: >-
              This authentication token does not grant permission to perform
              this operation.
            details:
              request_id: a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043
    SandboxError404:
      description: >-
        Resource not found. Returns a JSON error with code, message, and
        optional details.
      content:
        application/json:
          example:
            code: NOT_FOUND
            message: The requested resource was not found.
            details:
              request_id: a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043
    SandboxError429:
      description: >-
        Request limit exceeded. Returns a JSON error with code, message, and
        optional details.
      content:
        application/json:
          example:
            code: RATE_LIMITED
            message: Too many requests. Try again in 30 seconds.
            details:
              retry_after_seconds: 30
    SandboxError500:
      description: >-
        Internal server error. Returns a JSON error with code, message, and
        optional details.
      content:
        application/json:
          example:
            code: INTERNAL_ERROR
            message: The request could not be completed. Try again later.
            details:
              request_id: a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````