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

> Groups compute usage by sandbox and day for the requested time range.



## OpenAPI

````yaml /api-reference/openapi.personal.json get /v1/orgs/{slug}/billing/usage/sandbox
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}/billing/usage/sandbox:
    get:
      tags:
        - Billing
      summary: Get sandbox usage
      description: Groups compute usage by sandbox and day for the requested time range.
      operationId: get_sandbox_breakdown
      parameters:
        - name: slug
          in: path
          description: Organization slug
          required: true
          schema:
            type: string
        - name: from
          in: query
          description: Window start (RFC 3339); defaults to month start
          required: false
          schema:
            type: string
        - name: to
          in: query
          description: Window end (RFC 3339); defaults to now
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Per-sandbox / per-day usage
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageBreakdown'
        '401':
          description: Unauthorized
      security:
        - bearer: []
components:
  schemas:
    UsageBreakdown:
      type: object
      description: >-
        Compute-on-read usage breakdown for an org over a window: per-(sandbox,
        day)

        quantity rows plus a directory of the sandboxes they reference. The
        frontend

        groups `rows` by sandbox (for the per-sandbox table) or by day (for the

        chart) and labels them via `sandboxes`.
      required:
        - rows
        - sandboxes
      properties:
        rows:
          type: array
          items:
            $ref: '#/components/schemas/SandboxDailyUsage'
        sandboxes:
          type: array
          items:
            $ref: '#/components/schemas/SandboxIdentity'
    SandboxDailyUsage:
      type: object
      description: >-
        Compute usage for one sandbox on one UTC day, across both billed
        dimensions.


        Computed on read from `sandbox_runs` (not from the billing provider) -
        open runs accrue

        against `now()`, so a *running* sandbox shows live usage. Quantities are

        seconds-based (vCPU-seconds, MiB-seconds), the same units the metering
        events

        carry; display converts to vCPU-hours / GiB-hours. Sum over days for a

        sandbox's period total; sum over sandboxes for the daily series.
      required:
        - sandbox_id
        - day
        - vcpu_seconds
        - mem_mib_seconds
        - disk_mib_seconds
      properties:
        day:
          type: string
          format: date-time
          description: UTC midnight of the day this usage falls in.
        disk_mib_seconds:
          type: number
          format: double
          description: >-
            Σ(overlap_secs × disk_mib) for this sandbox on this day -
            provisioned

            writable disk billed on the same GiB-seconds basis while the sandbox
            runs.
        mem_mib_seconds:
          type: number
          format: double
          description: Σ(overlap_secs × mem_mib) for this sandbox on this day.
        sandbox_id:
          type: string
          format: uuid
        vcpu_seconds:
          type: number
          format: double
          description: Σ(overlap_secs × vcpus) for this sandbox on this day.
    SandboxIdentity:
      type: object
      description: >-
        Minimal sandbox display info - the directory that turns the
        `sandbox_id`s in

        a [`UsageBreakdown`]'s rows into human labels without a second
        round-trip.
      required:
        - id
        - name
        - slug
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        slug:
          type: string
  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.

````