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

# Get balance and top-up terms

> Free. When top-ups are enabled, `topup` carries the x402 terms and this account's public top-up code.



## OpenAPI

````yaml /openapi.json get /api/v1/credits
openapi: 3.0.3
info:
  title: Chance API
  version: 1.0.0
  description: >-
    Verify an agent's proposed action against its rules, manage escrow wallets,
    and buy credits. Every verification returns a signed, hash-chained receipt.
servers:
  - url: https://harness.chance.cc
    description: Production
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Verification
    description: Check an action against its rules and fetch past verdicts.
  - name: Credits
    description: Balance and x402 top-ups.
  - name: Escrow wallets
    description: Wallets that only move funds through a verified proposal.
  - name: Trader
    description: Liveness reports from trader containers.
  - name: Gas sponsorship
    description: Sponsored gas for trader instances on Polygon.
  - name: Status
    description: Public deployment facts for checking receipts.
paths:
  /api/v1/credits:
    get:
      tags:
        - Credits
      summary: Get balance and top-up terms
      description: >-
        Free. When top-ups are enabled, `topup` carries the x402 terms and this
        account's public top-up code.
      operationId: getCredits
      responses:
        '200':
          description: Balance and terms.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditsStatus'
        '401':
          description: No API key, or the key is unknown or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                e0:
                  summary: missing API key (send x-api-key)
                  value:
                    error: missing API key (send x-api-key)
                e1:
                  summary: invalid or revoked API key
                  value:
                    error: invalid or revoked API key
components:
  schemas:
    CreditsStatus:
      type: object
      properties:
        creditsRemaining:
          type: integer
          example: 42
        priceUsdPerCredit:
          type: number
          example: 0.05
        topup:
          oneOf:
            - $ref: '#/components/schemas/TopupTerms'
            - $ref: '#/components/schemas/TopupUnavailable'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: >-
            An error code (for example `out_of_credits`) or a short sentence
            (for example `intent is required`).
        message:
          type: string
          description: Detail, when present.
    TopupTerms:
      type: object
      properties:
        available:
          type: boolean
          enum:
            - true
        protocol:
          type: string
          example: x402
        method:
          type: string
          example: POST
        url:
          type: string
          example: https://harness.chance.cc/api/v1/credits/topup?credits=N
        accountCode:
          type: string
          nullable: true
          description: This account's public top-up code (`chance_topup_…`).
          example: chance_topup_…
        network:
          type: string
          example: eip155:8453
        asset:
          type: string
          example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
        minCredits:
          type: integer
          example: 20
        maxCredits:
          type: integer
          example: 10000
        guideUrl:
          type: string
          example: https://harness.chance.cc/api/v1/credits/topup/guide
        note:
          type: string
    TopupUnavailable:
      type: object
      properties:
        available:
          type: boolean
          enum:
            - false
        note:
          type: string
          example: Top-up is coming soon.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: An API key (`chance_sk_live_…`) from https://harness.chance.cc/keys.
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        The same API key sent as `Authorization: Bearer <key>`. If both headers
        are sent, `x-api-key` is used.

````