> ## 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 metrics

> Gets a sandbox's request, error, CPU, and memory metrics over time.

Related guide: [Inspect sandbox metrics](/sandboxes/metrics).


## OpenAPI

````yaml get /v1/sandboxes/instances/{sandbox_name}/metrics
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}/metrics:
    get:
      tags:
        - Sandboxes
      summary: Get sandbox metrics
      description: >
        Returns every interval in the requested half-open range [start_time,
        end_time).

        Buckets align to UTC interval boundaries; partial boundary buckets
        include only samples

        within the requested range. The first bucket may start before
        start_time. Ranges are limited to 31 days

        and 10000 buckets. Request counts are zero when there is no traffic, and
        null

        for buckets entirely before sandbox creation. CPU and memory are null
        without

        samples, including standby. Error rate is the fraction of requests
        returning

        4xx or 5xx, null when there are no requests. Telemetry failures return
        an error.
      operationId: GetSandboxMetrics
      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: interval_seconds
          in: query
          required: true
          schema:
            type: integer
            enum:
              - 10
              - 30
              - 60
              - 300
              - 900
              - 3600
      responses:
        '200':
          description: Complete sandbox metrics time series.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxMetricsV1'
        '400':
          description: Invalid range, interval, or query parameter.
        '401':
          description: Authentication required.
        '403':
          description: Team access denied.
        '404':
          description: Sandbox not found.
        '502':
          description: Metrics query failed.
        '503':
          description: Metrics 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:
    SandboxMetricsV1:
      type: object
      required:
        - sandbox_name
        - start_time
        - end_time
        - interval_seconds
        - data
      properties:
        sandbox_name:
          type: string
        start_time:
          format: date-time
          type: string
        end_time:
          format: date-time
          type: string
        interval_seconds:
          type: integer
        data:
          type: array
          maxItems: 10000
          items:
            $ref: '#/components/schemas/SandboxMetricsPointV1'
    SandboxMetricsPointV1:
      type: object
      required:
        - timestamp
        - requests
        - cpu_percent
        - memory_bytes
        - error_rate
      properties:
        timestamp:
          type: string
          format: date-time
          description: Start of this interval.
        requests:
          description: >-
            Request count. Zero without traffic; null for intervals entirely
            before creation.
          anyOf:
            - type: number
            - type: 'null'
        cpu_percent:
          description: >-
            Peak CPU usage in this interval, where 100 is one full CPU core.
            Null without a sample.
          anyOf:
            - type: number
            - type: 'null'
        memory_bytes:
          description: >-
            Memory usage in bytes, averaged per series then maximum across
            series. Null without a sample.
          anyOf:
            - type: number
            - type: 'null'
        error_rate:
          description: >-
            Fraction of requests returning 4xx or 5xx. Null when there are no
            requests.
          anyOf:
            - type: number
              minimum: 0
              maximum: 1
            - type: 'null'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````