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

# Get Sailbox spend

> Returns Sailbox usage and estimated cost for your organization over a time window, with a per-Sailbox breakdown. Defaults to the current UTC calendar month up to now. Costs are reported in billionths of a US dollar, and the active portion is an estimate that settles when the Sailbox stops.



## OpenAPI

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


    Three things need an SDK or the CLI: running commands and moving files,
    turning on SSH, and building an image. Once SSH is on you can use `ssh` and
    `scp` for the first of those. 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: Networking
    description: >-
      Publish ports, serve them on hostnames you own, and identify a Sailbox to
      other Sailboxes.
  - 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:
  /sailboxes/spend:
    get:
      tags:
        - Usage
      summary: Get Sailbox spend
      description: >-
        Returns Sailbox usage and estimated cost for your organization over a
        time window, with a per-Sailbox breakdown. Defaults to the current UTC
        calendar month up to now. Costs are reported in billionths of a US
        dollar, and the active portion is an estimate that settles when the
        Sailbox stops.
      operationId: getSailboxSpend
      parameters:
        - name: from
          in: query
          schema:
            type: string
            format: date-time
          description: >-
            Start of the window, as an RFC 3339 timestamp. Defaults to the first
            of the current UTC month.
        - name: to
          in: query
          schema:
            type: string
            format: date-time
          description: >-
            End of the window, as an RFC 3339 timestamp. Defaults to now, and
            must be after `from`.
        - name: app_id
          in: query
          schema:
            type: string
          description: Only count Sailboxes in this app.
        - name: sailbox_id
          in: query
          schema:
            type: string
            pattern: >-
              ^(sb_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})?$
          description: Only count this Sailbox.
      responses:
        '200':
          description: The spend summary.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SailboxSpend'
        '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_gib for size m must be between 8 and 128
                  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: >-
            For its first ten minutes a new organization is capped on how many
            requests it can have in flight at once, and yours is over that cap.
            The request never started, so retry it unchanged after the delay in
            the `Retry-After` header. The limit clears as those requests finish.
          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:
    SailboxSpend:
      type: object
      properties:
        start_at:
          type: string
          format: date-time
          description: Start of the window.
        end_at:
          type: string
          format: date-time
          description: End of the window.
        finalized_cost_usd_nanos:
          type: integer
          description: Cost of time already used, in billionths of a US dollar.
          format: int64
        estimated_active_cost_usd_nanos:
          type: integer
          description: Estimated cost of time still in progress.
          format: int64
        estimated_total_cost_usd_nanos:
          type: integer
          description: Finalized plus estimated active cost.
          format: int64
        duration_seconds:
          type: integer
          description: Total Sailbox seconds in the window.
          format: int64
        vcpu_seconds:
          type: number
          description: Total virtual CPU seconds used.
        memory_gib_seconds:
          type: number
          description: Total memory GiB seconds used.
        state_disk_gib_seconds:
          type: number
          description: Total disk GiB seconds used.
        rates:
          $ref: '#/components/schemas/SpendRates'
        sailboxes:
          type: array
          items:
            $ref: '#/components/schemas/SpendItem'
          description: Per-Sailbox breakdown.
      required:
        - start_at
        - end_at
        - finalized_cost_usd_nanos
        - estimated_active_cost_usd_nanos
        - estimated_total_cost_usd_nanos
        - duration_seconds
        - vcpu_seconds
        - memory_gib_seconds
        - state_disk_gib_seconds
        - rates
        - sailboxes
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    SpendRates:
      type: object
      description: >-
        Prices used to work out the costs in this response, in billionths of a
        US dollar. New rates can appear over time.
      properties:
        vcpu_second_usd_nanos:
          type: integer
          description: Price of one virtual CPU second.
          format: int64
        memory_gib_second_usd_nanos:
          type: integer
          description: Price of one memory GiB second.
          format: int64
        state_disk_gib_second_usd_nanos:
          type: integer
          description: Price of one disk GiB second.
          format: int64
        s_creation_usd_nanos:
          type: integer
          description: One-time charge for creating an `s` Sailbox.
          format: int64
        m_creation_usd_nanos:
          type: integer
          description: One-time charge for creating an `m` Sailbox.
          format: int64
        l_creation_usd_nanos:
          type: integer
          description: One-time charge for creating an `l` Sailbox.
          format: int64
      additionalProperties:
        type: integer
        format: int64
      required:
        - vcpu_second_usd_nanos
        - memory_gib_second_usd_nanos
        - state_disk_gib_second_usd_nanos
        - s_creation_usd_nanos
        - m_creation_usd_nanos
        - l_creation_usd_nanos
    SpendItem:
      type: object
      properties:
        sailbox_id:
          type: string
          description: Sailbox the usage belongs to.
        app_id:
          type: string
          description: App the Sailbox belongs to.
        finalized_cost_usd_nanos:
          type: integer
          description: >-
            Cost of time the Sailbox has finished using, in billionths of a US
            dollar.
          format: int64
        estimated_active_cost_usd_nanos:
          type: integer
          description: Estimated cost of time the Sailbox is still using right now.
          format: int64
        estimated_total_cost_usd_nanos:
          type: integer
          description: Finalized plus estimated active cost.
          format: int64
        duration_seconds:
          type: integer
          description: Seconds the Sailbox was running in the window.
          format: int64
        vcpu_seconds:
          type: number
          description: Virtual CPU seconds used.
        memory_gib_seconds:
          type: number
          description: Memory GiB seconds used.
        state_disk_gib_seconds:
          type: number
          description: Disk GiB seconds used.
        active:
          type: boolean
          description: Whether the Sailbox is still accruing usage.
      required:
        - sailbox_id
        - app_id
        - finalized_cost_usd_nanos
        - estimated_active_cost_usd_nanos
        - estimated_total_cost_usd_nanos
        - duration_seconds
        - vcpu_seconds
        - memory_gib_seconds
        - state_disk_gib_seconds
        - active
    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`, 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.
        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

````