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

# List prepaid credits for an account

> Lists every unit of measure the account holds credit in, or the single one named by `uom` when that filter is supplied.
`include` is a comma-separated list of expansions. Only `buckets` is supported.



## OpenAPI

````yaml /billing.openapi.json get /api/accounts/prepaid-credits
openapi: 3.1.0
info:
  title: Billing
  description: |+

  version: 1.0.0
  summary: ''
servers:
  - url: https://sbx.api.easybilling.cloud/billing
    description: SBX
  - url: https://api.easybilling.cloud/billing
    description: Production-AWS
security:
  - token: []
tags:
  - name: account
  - name: payment method
  - name: contract action
  - name: usage event
  - name: billing document
  - name: invoice pdf
  - name: prepaid credits
  - name: customer portal
paths:
  /api/accounts/prepaid-credits:
    get:
      tags:
        - prepaid credits
      summary: List prepaid credits for an account
      description: >-
        Lists every unit of measure the account holds credit in, or the single
        one named by `uom` when that filter is supplied.

        `include` is a comma-separated list of expansions. Only `buckets` is
        supported.
      operationId: listAccountPrepaidCredits
      parameters:
        - name: uom
          in: query
          required: false
          description: >-
            Unit of measure name. Omit to list every unit of measure the account
            holds. When present, the value is trimmed and must be non-blank and
            at most 64 characters. A name may contain `/`; do not put it in the
            path. Lookup is case-insensitive; the response echoes the stored
            spelling, not the request's casing.
          schema:
            type: string
            minLength: 1
            maxLength: 64
          example: Token
        - name: include
          in: query
          description: >-
            Comma-separated expansions. Only `buckets` is supported. Null or
            blank means nothing is expanded. Unknown tokens are rejected.
          required: false
          example: buckets
          schema:
            type: string
        - name: accountNumber
          in: query
          description: ''
          required: true
          example: ''
          schema:
            type: string
        - name: trace-id
          in: header
          description: ''
          required: true
          example: '{{$string.uuid}}'
          schema:
            type: string
      responses:
        '200':
          description: Prepaid credits returned successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountPrepaidCreditsResponse'
              examples:
                All:
                  summary: >-
                    Every unit of measure the account holds, without bucket
                    detail
                  value:
                    accountId: a4d2ea0f-10b5-4d25-979c-8dc5ed325e5d
                    prepaidCredits:
                      - id: f21661f0-e909-4c18-b5ab-526b27fd6946
                        uom: API
                        remainingBalance: 20000
                        totalBalance: 20000
                        version: 1
                      - id: 9d7da474-44fb-49c9-9cd1-87df06680ba4
                        uom: Token
                        remainingBalance: 20000
                        totalBalance: 20000
                        version: 1
          headers: {}
        '400':
          $ref: '#/components/responses/BadRequest'
          description: >-
            The request is invalid. Typical causes: blank or overlong
            `accountId` or `uom`; a present-but-blank `uom`; an unsupported
            `include` token such as `alerts`.
        '401':
          $ref: '#/components/responses/Unauthorized'
          description: Missing or invalid credentials.
        '404':
          $ref: '#/components/responses/NotFound'
          description: >-
            The account does not exist in the authenticated tenant, or `uom`
            names a unit of measure with neither a materialized row nor a
            controlled definition.
      deprecated: false
      security:
        - token: []
components:
  schemas:
    AccountPrepaidCreditsResponse:
      type: object
      required:
        - accountId
        - prepaidCredits
      properties:
        accountId:
          type: string
          description: The account that was queried.
          examples:
            - a1b2c3d4-e5f6-7890-abcd-ef1234567890
        prepaidCredits:
          type: array
          description: >-
            One element per unit of measure. Unfiltered queries omit units the
            account has never held. A filtered query always returns exactly one
            element when it succeeds.
          items:
            $ref: '#/components/schemas/AccountPrepaidCredits'
    AccountPrepaidCredits:
      type: object
      required:
        - uom
        - remainingBalance
        - totalBalance
      properties:
        id:
          type:
            - string
            - 'null'
          description: >-
            Materialized row identifier. Null when the account holds no row for
            this unit of measure (a zero position, not a 404).
          examples:
            - PC-TOKEN
        uom:
          type: string
          description: >-
            Unit of measure name as stored on the row, or as defined by the
            controlled definition when there is no row.
          examples:
            - Token
        remainingBalance:
          type: number
          description: >-
            Spendable credit on the effective-available-balance basis. Periodic
            issuance means a bucket's grant for a future period is not included.
            Never null; a missing column value is returned as 0.
          examples:
            - 11000
        totalBalance:
          type: number
          description: >-
            Total credit granted by the same buckets `availableCredit` is drawn
            from, taken from grant sizes rather than remaining balances.
            Drawdown does not move this figure. It is not `availableCredit +
            consumed`: a periodic bucket grants across every issuance period at
            once while `availableCredit` covers only the current one.
          examples:
            - 12000
        version:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            The row's `optimisticVersion`. Null when there is no materialized
            row, and therefore nothing to concurrency-check against. This is the
            only version in the contract.
          examples:
            - 7
        buckets:
          type:
            - array
            - 'null'
          description: >-
            Present only when `include=buckets`. Empty when the expansion was
            requested and this unit of measure has no eligible bucket. Omitted
            from the JSON when the expansion was not requested.
          items:
            $ref: '#/components/schemas/Bucket'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            message:
              type: string
            errors:
              type: array
              items:
                type: object
                additionalProperties: true
                properties: {}
    Bucket:
      type: object
      properties:
        id:
          type: string
        accountId:
          type: string
        contractId:
          type:
            - string
            - 'null'
        contractSegmentId:
          type:
            - string
            - 'null'
        externalReferenceId:
          type:
            - string
            - 'null'
        totalBalance:
          type:
            - number
            - 'null'
        issuedBalance:
          type:
            - number
            - 'null'
          description: >-
            For one-time buckets this equals the grant. For periodic buckets
            this is the amount issued as of the tenant business date.
        remainingBalance:
          type:
            - number
            - 'null'
        effectiveAvailableBalance:
          type:
            - number
            - 'null'
          description: >-
            Spendable balance as of the tenant business date after
            issuance-period and rollover rules. This is what rolls into
            `availableCredit`.
        uom:
          type:
            - string
            - 'null'
        price:
          type:
            - number
            - 'null'
        validFrom:
          type:
            - string
            - 'null'
          format: date
          description: Inclusive start of the bucket window (`effectiveStartDate`).
        validTo:
          type:
            - string
            - 'null'
          format: date
          description: >-
            Inclusive end of the bucket window (`effectiveEndDate`). An expired
            bucket keeps ACTIVE status and stops counting because this window no
            longer covers the tenant business date.
        type:
          $ref: '#/components/schemas/BucketType'
        sourceId:
          type:
            - string
            - 'null'
        status:
          $ref: '#/components/schemas/BucketStatus'
        sourceItemId:
          type:
            - string
            - 'null'
        grantFrequency:
          $ref: '#/components/schemas/GrantFrequency'
        createdAt:
          type:
            - string
            - 'null'
          format: date-time
        createdBy:
          type:
            - string
            - 'null'
        updatedAt:
          type:
            - string
            - 'null'
          format: date-time
        updatedBy:
          type:
            - string
            - 'null'
        creditSchedules:
          type:
            - array
            - 'null'
          description: >-
            Issuance-period schedules. This query path does not currently expand
            them; the field is typically null.
          items:
            $ref: '#/components/schemas/CreditSchedule'
    BucketType:
      type:
        - string
        - 'null'
      enum:
        - resource-based-credit
        - currency-based-credit
        - resource-based-commitment
        - currency-based-commitment
    BucketStatus:
      type:
        - string
        - 'null'
      enum:
        - draft
        - active
        - cancelled
      description: >-
        Buckets expanded by this endpoint are ACTIVE. Draft and cancelled rows
        do not count toward prepaid credits.
    GrantFrequency:
      type:
        - string
        - 'null'
      enum:
        - one-time
        - weekly
        - monthly
        - quarterly
        - semi-annual
        - annual
        - custom
    CreditSchedule:
      type: object
      properties:
        id:
          type: string
        bucketId:
          type:
            - string
            - 'null'
        bucketStatus:
          $ref: '#/components/schemas/BucketStatus'
        accountId:
          type:
            - string
            - 'null'
        contractId:
          type:
            - string
            - 'null'
        contractSegmentId:
          type:
            - string
            - 'null'
        originalTotalBalance:
          type:
            - number
            - 'null'
        totalBalance:
          type:
            - number
            - 'null'
        remainingBalance:
          type:
            - number
            - 'null'
        uom:
          type:
            - string
            - 'null'
        sourceItemId:
          type:
            - string
            - 'null'
        validFrom:
          type:
            - string
            - 'null'
          format: date
        validTo:
          type:
            - string
            - 'null'
          format: date
        bucketType:
          $ref: '#/components/schemas/BucketType'
  responses:
    BadRequest:
      description: >-
        The request is invalid. Typical causes: blank or overlong `accountId` or
        `uom`; a present-but-blank `uom`; an unsupported `include` token such as
        `alerts`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            unsupportedInclude:
              summary: unsupportedInclude
              value:
                error:
                  message: 'Unsupported include value: alerts. Supported values: buckets'
            blankUom:
              summary: blankUom
              value:
                error:
                  message: uom must not be blank
            parameterValidation:
              summary: parameterValidation
              value:
                error:
                  message: >-
                    Request validation failed. Please correct the highlighted
                    fields.
                  errors:
                    - field: accountId
                      message: must not be blank
    Unauthorized:
      description: Missing or invalid credentials.
      content:
        application/json:
          schema:
            type: object
            properties: {}
    NotFound:
      description: >-
        The account does not exist in the authenticated tenant, or `uom` names a
        unit of measure with neither a materialized row nor a controlled
        definition.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            accountNotFound:
              summary: accountNotFound
              value:
                error:
                  message: >-
                    Cannot find account by ID:
                    a1b2c3d4-e5f6-7890-abcd-ef1234567890
            uomNotFound:
              summary: uomNotFound
              value:
                error:
                  message: 'Cannot find unit of measure by name: Gigawatt'
  securitySchemes:
    token:
      type: http
      scheme: bearer

````