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

# Get Credit Wallet Balance

> Retrieve the authenticated user's credit wallet balance and details

## Overview

Credit wallets hold funds available for spending through the Baanx platform. This endpoint retrieves the current balance, currency, and withdrawal status of the authenticated user's credit wallet. Balance updates reflect purchases, refunds, and withdrawals in real-time.

**Use Cases:**

* Display user's available credit balance in your application
* Check if funds can be withdrawn before initiating withdrawal
* Monitor credit wallet status for transaction processing
* Verify sufficient balance before card operations

## Authentication

<ParamField header="x-client-key" type="string" required>
  Your public API client key that identifies your environment
</ParamField>

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from OAuth flow or direct login
</ParamField>

## Query Parameters

<ParamField query="x-us-env" type="boolean" default={false}>
  Set to `true` to route request to US backend environment (if available for your client)
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique identifier for the credit wallet
</ResponseField>

<ResponseField name="balance" type="string">
  Current balance in the wallet (decimal string for precision)
</ResponseField>

<ResponseField name="currency" type="string">
  Currency code (e.g., "usdc", "usdt")
</ResponseField>

<ResponseField name="isWithdrawable" type="boolean">
  Whether funds can be withdrawn from this wallet
</ResponseField>

<ResponseField name="type" type="string">
  Wallet type identifier, always "CREDIT" for this endpoint
</ResponseField>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "id": "098aeb90-e7f7-4f81-bc2e-4963330122c5",
    "balance": "150.50",
    "currency": "usdc",
    "isWithdrawable": true,
    "type": "CREDIT"
  }
  ```

  ```json 401 - Authentication Error theme={null}
  {
    "message": "Not authenticated"
  }
  ```

  ```json 403 - Authorization Error theme={null}
  {
    "message": "Not authorized"
  }
  ```

  ```json 500 - Internal Server Error theme={null}
  {
    "message": "Internal server error"
  }
  ```
</ResponseExample>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://dev.api.baanx.com/v1/wallet/credit" \
    -H "x-client-key: YOUR_CLIENT_KEY" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```

  ```python Python theme={null}
  import requests

  url = "https://dev.api.baanx.com/v1/wallet/credit"
  headers = {
      "x-client-key": "YOUR_CLIENT_KEY",
      "Authorization": "Bearer YOUR_ACCESS_TOKEN"
  }

  response = requests.get(url, headers=headers)
  credit_wallet = response.json()

  print(f"Balance: {credit_wallet['balance']} {credit_wallet['currency']}")
  print(f"Withdrawable: {credit_wallet['isWithdrawable']}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://dev.api.baanx.com/v1/wallet/credit', {
    method: 'GET',
    headers: {
      'x-client-key': 'YOUR_CLIENT_KEY',
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
  });

  const creditWallet = await response.json();
  console.log(`Balance: ${creditWallet.balance} ${creditWallet.currency}`);
  ```

  ```typescript TypeScript theme={null}
  interface CreditWallet {
    id: string;
    balance: string;
    currency: string;
    isWithdrawable: boolean;
    type: 'CREDIT';
  }

  const response = await fetch('https://dev.api.baanx.com/v1/wallet/credit', {
    method: 'GET',
    headers: {
      'x-client-key': 'YOUR_CLIENT_KEY',
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
  });

  const creditWallet: CreditWallet = await response.json();
  ```
</CodeGroup>

## Important Notes

<Note>
  **Balance Precision**: Balances are returned as strings to maintain precision for decimal values. Always parse as decimal types in your application, never as floating-point numbers.
</Note>

<Warning>
  **Withdrawal Restrictions**: The `isWithdrawable` flag indicates whether funds can be withdrawn. Some credit wallets may have restrictions based on user verification status, pending transactions, or platform policies.
</Warning>

## Related Endpoints

* [Withdraw from Credit Wallet](/api-reference/wallet/credit-withdraw) - Initiate withdrawal to external wallet
* [Estimate Credit Withdrawal Fees](/api-reference/wallet/credit-withdraw-estimation) - Calculate network fees before withdrawal
* [Get Wallet History](/api-reference/wallet/history) - View transaction history for credit wallet
