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

# Get costs

> Returns itemized costs for a period, priced per machine class.

Requires the `billing:GetBillingCosts` permission.



## OpenAPI

````yaml /api-reference/openapi/billing.json get /billing/v1/costs
openapi: 3.0.3
info:
  title: Mount Thor Billing API
  version: 15089fd70390
  description: >-
    Read your billing account, funds, credits, prices, usage, costs and
    invoices. Amounts are exact: `units` whole currency units plus `nanos`
    billionths, never floating point.
servers:
  - url: https://customer-api.mountthor.com
security:
  - bearerAuth: []
paths:
  /billing/v1/costs:
    get:
      summary: Get costs
      description: |-
        Returns itemized costs for a period, priced per machine class.

        Requires the `billing:GetBillingCosts` permission.
      operationId: CustomerBillingService_GetBillingCosts
      parameters:
        - name: period
          in: query
          description: '`current` (the current calendar month) or a past month as `YYYY-MM`.'
          schema:
            type: string
          required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBillingCostsResponse'
        '400':
          description: The request is invalid, for example an unknown query parameter.
          headers:
            mt-error-slug:
              description: A stable, machine-readable error identifier, when one applies.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            The credential is missing, invalid or expired. The response has no
            body.
          headers:
            mt-error-slug:
              description: A stable, machine-readable error identifier, when one applies.
              schema:
                type: string
        '403':
          description: >-
            The credential does not allow this operation. When a permission is
            missing, `requiredAction` names it; otherwise the body may be empty.
          headers:
            mt-error-slug:
              description: A stable, machine-readable error identifier, when one applies.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    GetBillingCostsResponse:
      type: object
      properties:
        period_start:
          type: string
          description: >-
            Start of the period covered (inclusive). The period ends at
            `period_end`, never later than now.
          format: date-time
        period_end:
          type: string
          format: date-time
        requested:
          type: string
          description: The canonicalized requested period (`current` or `YYYY-MM`).
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/BillingCostLineItem'
          description: Itemized lines, meter-ordered for stable client rendering.
        total:
          allOf:
            - $ref: '#/components/schemas/Money'
          description: Sum of `amount` across all priced lines.
    Error:
      type: object
      properties:
        code:
          type: integer
          description: A numeric status code.
        message:
          type: string
          description: A human-readable explanation.
        reason:
          type: string
          description: On a 403 from a missing permission, `permission_denied`.
        requiredAction:
          type: string
          description: >-
            On a 403 from a missing permission, the permission the request
            needs.
    BillingCostLineItem:
      type: object
      properties:
        meter:
          type: string
          description: The rating meter this line aggregates.
        resource_kind:
          type: string
          description: >-
            `host` for a paid window (taken from the reservation, not the
            meter), or `bm`/`vm` parsed from a metered meter. Empty for
            non-compute meters.
        resource_class:
          type: string
          description: The priced SKU (the machine class), parsed from the meter.
        quantity_seconds:
          type: string
          description: Billable seconds aggregated for this line over the window.
        unit_price:
          allOf:
            - $ref: '#/components/schemas/Money'
          description: >-
            Price per machine-hour. For a paid compute window, the rate actually
            charged; unset when the line has no price.
        amount:
          allOf:
            - $ref: '#/components/schemas/Money'
          description: >-
            The line amount. For a paid-window line this is the sum of the
            ORIGINAL quotes (never recomputed, so it may not equal
            `quantity_seconds * unit_price`); for a metered line it follows the
            per-hour rule above. Zero when `!priced`.
        priced:
          type: boolean
          description: >-
            Whether the line carries a charge. Metered usage with no price for
            its class is shown unpriced.
      description: >-
        Costs for one meter over the period. Lines for paid compute windows
        carry the amount actually charged; `priced` is false for metered usage
        with no price.
    Money:
      type: object
      properties:
        currency_code:
          type: string
          description: ISO-4217 currency code, e.g. "USD".
        units:
          type: string
          description: Whole units of the amount. May be negative.
        nanos:
          type: integer
          description: >-
            Fractional units in nanos (10^-9). For a positive amount, nanos is
            in [0, 999999999]; units and nanos must share sign.
          format: int32
      description: >-
        Money — an exact monetary amount. Never use floating point for money;
        this mirrors the google.type.Money shape (units + nanos + ISO-4217
        currency).
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <credential>` to
        https://customer-api.mountthor.com. People use the session that `mthr
        login` stores (a token starting `mt_session_`, valid for up to 12
        hours). Automation uses a service-account credential (starting
        `mt_sa_v1_`, valid for 90 days) from Create credential. Each operation
        names the permission it needs. Service accounts hold permissions through
        custom roles, and some operations refuse them; those operations say so.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.