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

# Read volume spend

> Returns observed hourly storage usage and estimated cost at the current list rate, including deleted volumes. Each recorded storage reading represents one volume-hour; sampled_hours counts those readings across volumes. Cost is summed GiB-hours multiplied by the returned rate. Group costs and the total are rounded independently to billionths of a US dollar. Totals cover the full filtered window independently of pagination. Missing samples are not filled in and recent samples can arrive late: this does not guarantee complete billing coverage. Discounts, credits, contract prices and invoice rounding are excluded. No live-volume lookup is required; unknown or other-organization IDs return no usage. Existing Sailbox spend totals are unchanged.



## OpenAPI

````yaml /sailbox-openapi.json get /sailbox-volumes/spend
openapi: 3.1.0
info:
  title: Sail Sailbox API
  version: '2026-10-04'
  description: >-
    Create and operate Sailboxes over HTTP. Sailboxes are fast-booting virtual
    machines that you can pause, resume, and checkpoint.


    Run commands, stream files, manage lifecycle and networking, and inspect
    usage. Turning on SSH and building an image still require an SDK or the CLI.
    See the [HTTP API guide](/sailboxes-http-api).
servers:
  - url: https://sailbox-api.sailresearch.com/v1
security:
  - BearerAuth: []
tags:
  - name: Apps
    description: Groups that own Sailboxes. One app per workload.
  - name: Lifecycle
    description: >-
      A Sailbox's whole life: create it, watch it, stop and start it, terminate
      it.
  - name: Checkpoints
    description: Save a Sailbox to start from later, and copy a running one.
  - name: Image builds
    description: >-
      Watch and cancel the image builds your organization starts with an SDK or
      the CLI.
  - name: Exec
    description: Run commands and control their standard input and terminals.
  - name: Files
    description: Stream regular files into and out of a Sailbox.
  - name: Networking
    description: >-
      Publish ports, serve them on hostnames you own, and identify a Sailbox to
      other Sailboxes.
  - name: Secrets
    description: >-
      Organization and personal values that egress policy rules can add to
      matching requests. Sail never returns a stored value.
  - name: Egress policies
    description: >-
      What a Sailbox may connect to, and what happens to the HTTPS requests it
      sends.
  - name: Volumes
    description: >-
      Shared storage that outlives any one Sailbox. Alpha: these endpoints can
      still change.
  - name: SSH access
    description: Certificates for connecting to a Sailbox with `ssh`.
  - name: Usage
    description: Resource usage and spend.
  - name: Identity
    description: Who your API key belongs to.
paths:
  /sailbox-volumes/spend:
    get:
      tags:
        - Volumes
      summary: Read volume spend
      description: >-
        Returns observed hourly storage usage and estimated cost at the current
        list rate, including deleted volumes. Each recorded storage reading
        represents one volume-hour; sampled_hours counts those readings across
        volumes. Cost is summed GiB-hours multiplied by the returned rate. Group
        costs and the total are rounded independently to billionths of a US
        dollar. Totals cover the full filtered window independently of
        pagination. Missing samples are not filled in and recent samples can
        arrive late: this does not guarantee complete billing coverage.
        Discounts, credits, contract prices and invoice rounding are excluded.
        No live-volume lookup is required; unknown or other-organization IDs
        return no usage. Existing Sailbox spend totals are unchanged.
      operationId: getVolumeSpend
      parameters:
        - name: from
          in: query
          schema:
            type: string
            format: date-time
          description: >-
            Inclusive sample timestamp. Defaults to the current UTC month,
            capped at 30 days before to.
        - name: to
          in: query
          schema:
            type: string
            format: date-time
          description: >-
            Exclusive sample timestamp. Defaults to now. Maximum window: 30
            days.
        - name: volume_id
          in: query
          style: form
          explode: true
          schema:
            type: array
            maxItems: 200
            items:
              type: string
          description: Repeatable volume ID filter.
        - name: group_by
          in: query
          schema:
            type: string
            enum:
              - volume
              - hour
              - day
            default: volume
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 0
            maximum: 1000
            default: 1000
          description: Maximum rows returned. Zero returns totals only.
        - name: starting_after
          in: query
          schema:
            type: string
          description: >-
            The preceding response's next_cursor. Rows are ordered by volume ID
            or UTC bucket start. Keep the same filters and explicit time bounds
            across requests; reads are not a point-in-time snapshot.
      responses:
        '200':
          description: Observed volume storage and estimated spend.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VolumeSpend'
        '400':
          description: >-
            The request was rejected. See the error message for the offending
            field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: memory_limit_mib must be between 16384 and 262144
                  type: invalid_request_error
                  param: null
                  code: null
        '401':
          description: The API key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: Invalid API key
                  type: authentication_error
                  param: null
                  code: invalid_api_key
        '402':
          description: >-
            The organization is out of credits. The error carries a
            `billing_url` pointing at the page where you add them. Retry once
            you have.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: >-
                    Your API key has been disabled due to insufficient credits.
                    Visit https://app.sailresearch.com/billing to add credits.
                  type: billing_error
                  param: null
                  code: credits_exhausted
                  billing_url: https://app.sailresearch.com/billing
        '403':
          description: The API key is not allowed to perform this operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: sailboxes require an organization-scoped API key
                  type: permission_error
                  param: null
                  code: null
        '429':
          description: >-
            Too many requests in flight, or the organization is at a limit. A
            `Retry-After` header means the request never started, so retry it
            unchanged after that delay. Without one, the request ran and hit the
            limit `message` names. Some of those clear on their own, such as a
            shortage of public ports; others need you to free something up
            first. Send the request again once the cause is gone.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: >-
                    Too many concurrent requests. Please retry after some of
                    your organization's in-flight requests complete.
                  type: rate_limit_error
                  param: null
                  code: rate_limited
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: failed to fetch sailbox
                  type: server_error
                  param: null
                  code: null
        '503':
          description: >-
            Sail is momentarily unavailable. Retry after the delay in the
            `Retry-After` header when one is present, and with backoff
            otherwise.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: Authentication service unavailable
                  type: server_error
                  param: null
                  code: null
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
components:
  schemas:
    VolumeSpend:
      type: object
      required:
        - start_at
        - end_at
        - gib_hours
        - sampled_hours
        - cost_usd_nanos
        - rate_usd_nanos_per_gib_hour
        - group_by
        - items
        - has_more
        - next_cursor
      properties:
        start_at:
          type: string
          format: date-time
        end_at:
          type: string
          format: date-time
        gib_hours:
          type: number
          description: Sum of recorded hourly storage quantities.
        sampled_hours:
          type: integer
          format: int64
          description: >-
            Number of recorded volume-hour samples; time groups sum across
            volumes.
        cost_usd_nanos:
          type: integer
          format: int64
          description: >-
            Estimated cost at the returned current list rate, in billionths of a
            US dollar.
        rate_usd_nanos_per_gib_hour:
          type: integer
          format: int64
          description: Current list rate, not a historical or customer contract rate.
        group_by:
          type: string
          enum:
            - volume
            - hour
            - day
        items:
          type: array
          items:
            $ref: '#/components/schemas/VolumeSpendItem'
        has_more:
          type: boolean
        next_cursor:
          type: string
          description: Pass as starting_after; empty when exhausted.
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    VolumeSpendItem:
      type: object
      required:
        - key
        - gib_hours
        - sampled_hours
        - cost_usd_nanos
      properties:
        key:
          type: string
          description: Volume ID or UTC hour/day start in RFC 3339 format.
        gib_hours:
          type: number
          description: Sum of recorded hourly storage quantities.
        sampled_hours:
          type: integer
          format: int64
          description: >-
            Number of recorded volume-hour samples; time groups sum across
            volumes.
        cost_usd_nanos:
          type: integer
          format: int64
          description: >-
            Estimated cost at the returned current list rate, in billionths of a
            US dollar.
    ErrorObject:
      type: object
      required:
        - message
        - type
        - param
        - code
      properties:
        message:
          type: string
          description: Human-readable description of what went wrong.
        type:
          type: string
          description: >-
            Error category: `invalid_request_error`, `authentication_error`,
            `permission_error`, `billing_error`, `not_found_error`,
            `conflict_error`, `rate_limit_error`, `quota_exceeded_error`,
            `not_implemented_error`, or `server_error`.
        param:
          oneOf:
            - type: string
            - type: 'null'
          description: >-
            The request field the error refers to, when the error is about one
            field.
        code:
          oneOf:
            - type: string
            - type: integer
            - type: 'null'
          description: >-
            Stable short code for the error, when one applies. Errors relayed
            from the Sailbox runtime carry its status token, for example
            `already_exists` or `failed_precondition` on a 409, which the HTTP
            status alone does not distinguish.
        billing_url:
          type: string
          format: uri
          description: Page where you add credits. Sent with a 402.
      additionalProperties: true
  headers:
    RetryAfter:
      description: >-
        How many seconds to wait before retrying. On a 429 it also means the
        request never started, so the retry can reuse the same
        `Idempotency-Key`.
      schema:
        type: integer
        minimum: 0
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````