Swipelux

Balances

Query and monitor wallet balances across your platform

Balances

Query wallet balances in real-time to display accurate fund information to your users.

For real-time balance change notifications, use Webhooks.

Get Wallet Balance

Retrieve the current balance for a specific wallet.

Quick Example

Response:

{
  "walletId": "wal_abc123",
  "network": "polygon",
  "balances": [
    {
      "currency": "USDC",
      "amount": "1250.50",
      "decimals": 6
    },
    {
      "currency": "USDT",
      "amount": "0.00",
      "decimals": 6
    }
  ],
  "lastUpdated": "2024-01-15T10:30:00Z"
}

Request Parameters

ParameterTypeRequiredDescription
walletIdstringYesWallet ID in the URL path (e.g., wal_abc123)

Response Fields

FieldTypeDescription
walletIdstringUnique wallet identifier
networkstringNetwork the wallet is on (e.g., polygon, ethereum)
balances[]arrayArray of token balances in the wallet
balances[].currencystringCurrency/token symbol (e.g., USDC, USDT)
balances[].amountstringBalance amount (decimal string)
balances[].decimalsnumberToken decimals (e.g., 6 for USDC)
lastUpdatedstringISO timestamp of last balance update

Get Customer Balances

Retrieve all wallet balances for a customer across all networks.

Quick Example

Response:

{
  "customerId": "cus_abc123",
  "totalBalance": {
    "amount": "2500.75",
    "currency": "USD"
  },
  "wallets": [
    {
      "walletId": "wal_poly_001",
      "network": "polygon",
      "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "balances": [
        {
          "currency": "USDC",
          "amount": "1250.50"
        }
      ]
    },
    {
      "walletId": "wal_eth_002",
      "network": "ethereum",
      "address": "0x9876543210987654321098765432109876543210",
      "balances": [
        {
          "currency": "USDC",
          "amount": "1250.25"
        }
      ]
    }
  ]
}

Request Parameters

ParameterTypeRequiredDescription
customerIdstringYesCustomer ID in the URL path (e.g., cus_abc123)

Response Fields

FieldTypeDescription
customerIdstringCustomer ID from the request
totalBalanceobjectTotal balance across all wallets (converted to base currency)
totalBalance.amountstringTotal balance amount
totalBalance.currencystringBase currency (e.g., USD)
wallets[]arrayArray of wallets owned by the customer
wallets[].walletIdstringUnique wallet identifier
wallets[].networkstringNetwork the wallet is on
wallets[].addressstringWallet address on the network
wallets[].balances[]arrayToken balances in this wallet
wallets[].balances[].currencystringCurrency/token symbol
wallets[].balances[].amountstringBalance amount

Language Examples

Best Practices

Balance Consistency: Balances may have a slight delay (a few seconds) after transactions complete due to blockchain confirmation times.

Caching: Balance queries can be cached for short periods (30-60 seconds) to reduce API calls. Use webhooks for real-time updates.

See Also

On this page