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

# Get sandbox metrics

> Returns CPU, memory, disk, and network metrics for a time range.



## OpenAPI

````yaml /api-reference/openapi.personal.json get /v1/orgs/{slug}/sandboxes/{sandbox_id}/metrics
openapi: 3.1.0
info:
  title: Personal token API
  description: User-scoped API for account and organization management.
  version: 0.1.0
servers:
  - url: https://api.microsandbox.dev
security:
  - bearer: []
paths:
  /v1/orgs/{slug}/sandboxes/{sandbox_id}/metrics:
    get:
      tags:
        - Sandboxes
      summary: Get sandbox metrics
      description: Returns CPU, memory, disk, and network metrics for a time range.
      operationId: get_metrics
      parameters:
        - name: slug
          in: path
          description: Organization slug
          required: true
          schema:
            type: string
        - name: sandbox_id
          in: path
          description: Sandbox ID
          required: true
          schema:
            type: string
            format: uuid
        - name: range_secs
          in: query
          description: Look-back window in seconds (default 3600 = 1h, max 604800 = 7d).
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
            minimum: 0
        - name: step_secs
          in: query
          description: Sample resolution in seconds (default 30, min 5).
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
            minimum: 0
      responses:
        '200':
          description: Sandbox metrics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxMetricsResponse'
        '400':
          description: Invalid range/step
        '401':
          description: Unauthorized
        '404':
          description: Sandbox not found
        '502':
          description: Metrics backend unavailable
      security:
        - bearer: []
components:
  schemas:
    SandboxMetricsResponse:
      type: object
      description: |-
        Per-sandbox metrics over a time range, keyed by metric (`cpu`,
        `memory_bytes`, `net_rx_bytes_rate`, …). See `plans/monitoring-plan.md`
        § B for the catalog.
      required:
        - sandbox_id
        - range
        - metrics
      properties:
        metrics:
          type: object
          description: Metric key → series. An empty series means "no data in range".
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/MetricSeries'
          propertyNames:
            type: string
        range:
          $ref: '#/components/schemas/MetricsRange'
          description: The resolved query window.
        sandbox_id:
          type: string
          format: uuid
          description: The sandbox these metrics belong to.
    MetricSeries:
      type: object
      description: One labelled series for a metric.
      required:
        - labels
        - samples
      properties:
        labels:
          type: object
          description: >-
            Series labels (e.g. `sandbox_name`), minus internal Prometheus
            names.
          additionalProperties:
            type: string
          propertyNames:
            type: string
        samples:
          type: array
          items:
            type: array
            items:
              type: number
              format: double
          description: '`[epoch_millis, value]` pairs in ascending time order.'
    MetricsRange:
      type: object
      description: The resolved time window a metrics response covers.
      required:
        - start
        - end
        - step_secs
      properties:
        end:
          type: integer
          format: int64
          description: Window end, epoch milliseconds.
        start:
          type: integer
          format: int64
          description: Window start, epoch milliseconds.
        step_secs:
          type: integer
          format: int64
          description: Sample resolution in seconds.
          minimum: 0
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        Personal access token (msb_pat_…) or session JWT - the credential an
        agent acts with on a user's behalf.

````