Skip to main content
GET
/
api
/
v1
/
distributors
/
{distributorID}
/
balance
curl -X GET "https://api.yourdomain.com/api/v1/distributors/36e48800-22ce-4ea0-b37a-198f7978cd53/balance" \
  -H "Authorization: Bearer uwk_YOUR_API_KEY_HERE"
{
  "balance": "50000.00"
}

Endpoint

GET /api/v1/distributors/{distributorID}/balance

Authentication

Authorization
string
required
Bearer token with your API key. Must have Read Balance permission.

Path Parameters

distributorID
string
required
The unique identifier of the distributor. Must match the distributor ID associated with the API key.

Response

balance
string
The current balance of the distributor’s wallet as a decimal string (e.g., “50000.00”)
curl -X GET "https://api.yourdomain.com/api/v1/distributors/36e48800-22ce-4ea0-b37a-198f7978cd53/balance" \
  -H "Authorization: Bearer uwk_YOUR_API_KEY_HERE"
{
  "balance": "50000.00"
}

Use Cases

  • Balance Monitoring: Automated alerts when balance falls below threshold
  • Pre-transaction Validation: Check if sufficient balance exists before attempting operations
  • Dashboard Integration: Display current balance in POS or admin systems
  • Reconciliation: Regular balance checks for accounting purposes

Example: Balance Monitoring Script

const axios = require('axios');

const AGENT_ID = '36e48800-22ce-4ea0-b37a-198f7978cd53';
const API_KEY = process.env.UNIVERSAL_WALLET_API_KEY;
const MIN_BALANCE = 10000.00;

async function checkBalance() {
  try {
    const response = await axios.get(
      `https://api.yourdomain.com/api/v1/distributors/${AGENT_ID}/balance`,
      {
        headers: { 'Authorization': `Bearer ${API_KEY}` }
      }
    );
    
    const balance = parseFloat(response.data.balance);
    console.log(`Current balance: ${balance}`);
    
    if (balance < MIN_BALANCE) {
      console.warn('⚠️ Balance below minimum threshold!');
      // Send alert email/SMS
    }
    
    return balance;
  } catch (error) {
    console.error('Failed to check balance:', error.message);
  }
}

// Run every hour
setInterval(checkBalance, 60 * 60 * 1000);
checkBalance(); // Initial check