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

> Gets a sandbox's runtime logs, newest first.

Follow `next_cursor` until it's `null`, keeping the same time range and limit.

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


## OpenAPI

````yaml get /v1/sandboxes/instances/{sandbox_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/instances/{sandbox_name}/logs:
    get:
      tags:
        - Sandboxes
      summary: Get sandbox logs
      description: >
        Returns sandbox runtime logs, newest first, within the half-open range

        [start_time, end_time). Ranges are limited to 7 days. Follow next_cursor

        until it is null to retrieve all pages, keeping the same range and
        limit.

        Logs before sandbox creation are excluded. Unavailable telemetry returns
        an error.
      operationId: GetSandboxLogs
      parameters:
        - $ref: '#/components/parameters/TeamId'
        - $ref: '#/components/parameters/TeamIdHeader'
        - $ref: '#/components/parameters/SandboxName'
        - name: start_time
          in: query
          required: true
          schema:
            format: date-time
            type: string
        - name: end_time
          in: query
          required: true
          schema:
            format: date-time
            type: string
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
        - name: cursor
          in: query
          required: false
          description: Opaque next_cursor from the previous page. Omit for the first page.
          schema:
            type: string
            minLength: 1
            maxLength: 4096
      responses:
        '200':
          description: A page of sandbox logs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxLogsV1'
        '400':
          description: Invalid range, limit, cursor, or query parameter.
        '401':
          description: Authentication required.
        '403':
          description: Team access denied.
        '404':
          description: Sandbox not found.
        '502':
          description: Logs query failed.
        '503':
          description: Logs are unavailable.
components:
  parameters:
    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
    SandboxName:
      name: sandbox_name
      in: path
      required: true
      description: Immutable sandbox name returned by creation.
      schema:
        type: string
        minLength: 1
        example: baseten-api-review-0916
  schemas:
    SandboxLogsV1:
      type: object
      required:
        - sandbox_name
        - start_time
        - end_time
        - logs
        - next_cursor
      properties:
        sandbox_name:
          type: string
        start_time:
          format: date-time
          type: string
        end_time:
          format: date-time
          type: string
        logs:
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/SandboxLogEntryV1'
        next_cursor:
          description: >-
            Opaque cursor for the next page; null when there are no more
            entries.
          anyOf:
            - type: string
            - type: 'null'
    SandboxLogEntryV1:
      type: object
      required:
        - timestamp
        - message
        - severity
        - trace_id
      properties:
        timestamp:
          format: date-time
          type: string
        message:
          type: string
        severity:
          type: integer
          description: Numeric log severity.
        trace_id:
          type: string
          description: Associated trace identifier, or an empty string when unavailable.
        action:
          type: string
          description: Action or command when present on the log entry.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````