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

# Wallet balance + most recent billing rows

> Return the wallet's current balance and most recent billing rows.

All resource types are included (compute, training, inference, traces,
disks, sandboxes, images) — same source-of-truth `Billing` table the
dashboard's Billing History tab reads. Sorted by `lastBilledAt` desc.



## OpenAPI

````yaml https://api.primeintellect.ai/openapi.json get /api/v1/billing/wallet
openapi: 3.1.0
info:
  title: PI API
  version: 0.1.0
servers:
  - url: https://api.primeintellect.ai
security: []
paths:
  /api/v1/billing/wallet:
    get:
      tags:
        - Billing
      summary: Wallet balance + most recent billing rows
      description: |-
        Return the wallet's current balance and most recent billing rows.

        All resource types are included (compute, training, inference, traces,
        disks, sandboxes, images) — same source-of-truth `Billing` table the
        dashboard's Billing History tab reads. Sorted by `lastBilledAt` desc.
      operationId: get_wallet_api_v1_billing_wallet_get
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Number of recent billing rows to include (max 100).
            default: 20
            title: Limit
          description: Number of recent billing rows to include (max 100).
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: Skip this many rows before returning. Lets callers page.
            default: 0
            title: Offset
          description: Skip this many rows before returning. Lets callers page.
        - name: teamId
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: If provided, return the team's wallet (requires membership).
            title: Teamid
          description: If provided, return the team's wallet (requires membership).
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletResponse'
        '401':
          description: Authorization failed
        '422':
          description: Invalid request data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    WalletResponse:
      properties:
        wallet_id:
          type: string
          title: Wallet Id
        team_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Team Id
        balance_usd:
          type: number
          title: Balance Usd
          description: Current balance in USD
        currency:
          type: string
          title: Currency
        total_billings:
          type: integer
          title: Total Billings
          description: Total billing rows on the wallet (across all pages)
        recent_billings:
          items:
            $ref: '#/components/schemas/BillingEntry'
          type: array
          title: Recent Billings
        credit_grants:
          items:
            $ref: '#/components/schemas/CreditGrantSummary'
          type: array
          title: Credit Grants
          description: >-
            Active (non-revoked, non-expired, non-exhausted) grants on this
            wallet
        sandbox_credits_remaining_usd:
          type: number
          title: Sandbox Credits Remaining Usd
          description: Sum of remaining sandbox-category grant credits in USD, snapshot
          default: 0
        credits_remaining_by_category:
          additionalProperties:
            type: number
          type: object
          title: Credits Remaining By Category
          description: >-
            Remaining grant credits in USD per category (sandboxes, training,
            inference), snapshot
      type: object
      required:
        - wallet_id
        - balance_usd
        - currency
        - total_billings
        - recent_billings
      title: WalletResponse
      description: |-
        Snapshot of a wallet's balance + most recent billing rows.

        Drives `prime wallet`. One call returns everything an agent needs to
        audit the billing flow against a known training run. Credit grants are
        listed separately from `balance_usd`: they are category-scoped free
        credits consumed before balance, not wallet money.
    ErrorResponse:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Errors
      type: object
      required:
        - errors
      title: ErrorResponse
    BillingEntry:
      properties:
        id:
          type: string
          title: Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        last_billed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Billed At
        amount_usd:
          type: number
          title: Amount Usd
        currency:
          type: string
          title: Currency
        resource_type:
          type: string
          title: Resource Type
        resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource Id
        credits_covered_usd:
          type: number
          title: Credits Covered Usd
          description: >-
            Portion of this billing row covered by credit grants (aggregated
            over the returned page). The wallet was charged amount_usd -
            credits_covered_usd.
          default: 0
      type: object
      required:
        - id
        - created_at
        - updated_at
        - amount_usd
        - currency
        - resource_type
      title: BillingEntry
      description: |-
        A single row from the Billing table, with the resource derived from
        whichever foreign-key column is non-null.

        `resource_type` mirrors the strings the dashboard's billing page filters
        by (`compute`, `training`, `inference`, `traces`, `disks`, `sandboxes`,
        `images`).
        `resource_id` is the matching FK value, so callers can drill back into
        the run / pod / disk / etc. that produced the charge.
    CreditGrantSummary:
      properties:
        id:
          type: string
          title: Id
        category:
          type: string
          title: Category
        qualifier:
          anyOf:
            - type: string
            - type: 'null'
          title: Qualifier
        amount_usd:
          type: number
          title: Amount Usd
          description: Original grant amount in USD
        remaining_usd:
          type: number
          title: Remaining Usd
          description: Remaining (amount - consumed) in USD, snapshot
        currency:
          type: string
          title: Currency
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
        expiresAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expiresat
        revokedAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Revokedat
      type: object
      required:
        - id
        - category
        - amount_usd
        - remaining_usd
        - currency
      title: CreditGrantSummary
      description: |-
        A product-scoped credit grant on this wallet (public view).

        Grants are consumed before wallet balance for their category and never
        top up `balance`. `remaining_usd` is a snapshot, not a reservation.
        Admin/audit fields (source, campaign, issuer, revoke reason) are
        deliberately not exposed publicly.
    ErrorDetail:
      properties:
        param:
          type: string
          title: Param
        details:
          type: string
          title: Details
      type: object
      required:
        - param
        - details
      title: ErrorDetail
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

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