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

# List credit allocations for a wallet

> List the credit allocations for a wallet, with the granted amount and consumed amount. Fetch the transactions for a wallet via the wallet transactions endpoints.



## OpenAPI

````yaml GET /api/v1/credit_systems/v2/wallets/{id}/credit-allocations
openapi: 3.0.1
info:
  title: Metrifox API Documentation
  version: v1
  description: >-
    Welcome to Metrifox Platform's API documentation. This comprehensive API
    suite enables seamless integration with our platform, providing secure and
    efficient access to our services.
servers:
  - url: https://{defaultHost}
    variables:
      defaultHost:
        default: api.metrifox.com
security:
  - api_key: []
paths:
  /api/v1/credit_systems/v2/wallets/{id}/credit-allocations:
    get:
      tags:
        - Wallets
      summary: List credit allocations for a wallet
      description: >
        Retrieves the credit allocations for a wallet. An allocation represents
        a grant of credits — for example, the credits provisioned by a
        subscription's billing cycle, a one-time top-up, or a manual adjustment.


        Each allocation reports both the granted `amount` and the `consumed`
        amount, so the available balance for the allocation is `amount -
        consumed`. This endpoint does not embed the individual debit/credit
        transactions within each allocation — fetch those separately via `GET
        /api/v1/credit_systems/v2/wallets/{id}/transactions` (or `GET
        /api/v1/credit_systems/v2/wallets/transactions` to span all of a
        customer's wallets).


        Use the optional `status` query parameter to filter (e.g. only active or
        expired allocations).
      operationId: listWalletCreditAllocations
      parameters:
        - name: id
          in: path
          required: true
          description: The unique wallet identifier
          schema:
            type: string
            format: uuid
          example: b7bf0d46-9f7d-4d58-9bb4-6bfb2d3e6a5c
        - name: status
          in: query
          required: false
          description: Optional allocation status filter (e.g. `active`, `expired`)
          schema:
            type: string
          example: active
      responses:
        '200':
          description: Credit allocations fetched successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditAllocationListResponse'
              examples:
                credit_allocations:
                  summary: Credit Allocations Response
                  value:
                    statusCode: 200
                    message: Credit allocations fetched successfully
                    meta: {}
                    data:
                      - id: a3f2b8e0-4d11-4f9a-8c2d-7e1b3a9f0c12
                        amount: 100
                        consumed: 35
                        allocation_type: subscription
                        invoice_id: 0d9e5a0e-7de4-48c6-b01a-b1759394578b
                        order_id: null
                        order_number: null
                        valid_until: '2026-04-12T16:55:21.847Z'
                        created_at: '2026-03-12T16:55:22.014Z'
                      - id: f51c9d3a-2b48-4e10-9c61-71d8b4e2a503
                        amount: 50
                        consumed: 0
                        allocation_type: topup
                        invoice_id: 762d8b5f-e416-4d88-8461-2a357b91ff25
                        order_id: ord_01HABCDEFGHIJK
                        order_number: ORD012
                        valid_until: null
                        created_at: '2026-03-20T11:04:18.221Z'
                    errors: {}
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Wallet not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: python
          label: Python SDK
          source: >
            from metrifox_sdk import MetrifoxClient


            client = MetrifoxClient(api_key="your_api_key")


            # List credit allocations for a wallet

            allocations =
            client.wallets.list_credit_allocations("b7bf0d46-9f7d-4d58-9bb4-6bfb2d3e6a5c")

            for alloc in allocations['data']:
                available = alloc['amount'] - alloc['consumed']
                print(f"{alloc['allocation_type']}: {available} available / {alloc['amount']} granted")

            # Filter by status

            active = client.wallets.list_credit_allocations(
                "b7bf0d46-9f7d-4d58-9bb4-6bfb2d3e6a5c",
                status="active",
            )
        - lang: javascript
          label: Javascript SDK
          source: >
            import { init } from "metrifox-js";


            const metrifoxClient = init({
              apiKey: process.env.METRIFOX_API_KEY
            });


            const allocations = await
            metrifoxClient.wallets.listCreditAllocations(
              "b7bf0d46-9f7d-4d58-9bb4-6bfb2d3e6a5c"
            );


            allocations.data.forEach((a) => {
              const available = a.amount - a.consumed;
              console.log(`${a.allocation_type}: ${available} available / ${a.amount} granted`);
            });


            // Filter by status

            const active = await metrifoxClient.wallets.listCreditAllocations(
              "b7bf0d46-9f7d-4d58-9bb4-6bfb2d3e6a5c",
              { status: "active" }
            );
        - lang: ruby
          label: Ruby SDK
          source: >
            require 'metrifox-sdk'


            METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })


            # List credit allocations for a wallet

            response =
            METRIFOX_SDK.wallets.list_credit_allocations("b7bf0d46-9f7d-4d58-9bb4-6bfb2d3e6a5c")

            response["data"].each do |alloc|
              available = alloc["amount"] - alloc["consumed"]
              puts "#{alloc['allocation_type']}: #{available} available / #{alloc['amount']} granted"
            end


            # Filter by status

            active = METRIFOX_SDK.wallets.list_credit_allocations(
              "b7bf0d46-9f7d-4d58-9bb4-6bfb2d3e6a5c",
              status: "active"
            )
components:
  schemas:
    CreditAllocationListResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 200
        message:
          type: string
          example: Credit allocations fetched successfully
        meta:
          type: object
          additionalProperties: true
        data:
          type: array
          items:
            $ref: '#/components/schemas/CreditAllocationEntity'
        errors:
          type: object
          additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message
        errors:
          type: object
          additionalProperties: true
          description: Detailed error information
    CreditAllocationEntity:
      type: object
      properties:
        id:
          type: string
          description: Unique allocation identifier
        amount:
          type: number
          description: Total amount of credits granted by this allocation
        consumed:
          type: number
          description: Amount of this allocation that has been used so far
        allocation_type:
          type: string
          description: >-
            Source of the allocation (e.g. subscription grant, one-time top-up,
            manual adjustment)
        invoice_id:
          type: string
          nullable: true
          description: ID of the invoice that generated this allocation, if any
        order_id:
          type: string
          nullable: true
          description: ID of the order that generated this allocation, if any
        order_number:
          type: string
          nullable: true
          description: Human-readable order number associated with this allocation
        valid_until:
          type: string
          format: date-time
          nullable: true
          description: When this allocation expires (null if it never expires)
        created_at:
          type: string
          format: date-time
          description: When the allocation was created
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````