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



## OpenAPI

````yaml /api-reference/openapi.json get /v1/billing/usage/sandbox
openapi: 3.1.0
info:
  title: microsandbox cloud API
  description: >-
    REST API for microsandbox cloud: sandbox and volume lifecycle, organization
    context, quotas, usage, and audit events, authenticated with an organization
    API key.
  version: 0.1.0
servers:
  - url: https://api.microsandbox.dev
security:
  - api_key: []
paths:
  /v1/billing/usage/sandbox:
    get:
      tags:
        - Usage
      summary: Get per-sandbox usage
      operationId: get_sandbox_breakdown
      responses:
        '200':
          description: Per-sandbox / per-day usage
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageBreakdown'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_api_key
                  message: unauthorized
                  details: null
      security:
        - api_key: []
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'
    ErrorResponse:
      type: object
      description: Error envelope returned by every non-2xx response.
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable error code, e.g. `invalid_api_key`.
            message:
              type: string
              description: Human-readable description of the error.
            details:
              type:
                - object
                - 'null'
              description: Optional structured context for the error.
    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:
    api_key:
      type: http
      scheme: bearer
      description: Organization API key (msb_…) - org-scoped programmatic access.

````