Skip to Content
API ReferenceBalance API

Balance API

Check your account’s resource balances programmatically. Use this API to integrate balance monitoring into your own dashboards, alerting systems, and automation workflows.

Base URL

https://voxvaani.com/api/v1

Authentication

All requests require an API key in the header: x-api-key: YOUR_API_KEY or Authorization: Bearer YOUR_API_KEY

Required scope: balance:read

ℹ️ Real-Time vs. Cached Balance

The Balance API always returns real-time balance values directly from the database. This is more current than the dashboard/Wallet page, which may cache values for up to 60 seconds.

Use the Balance API when you need guaranteed up-to-the-second balance data for:

  • Programmatic checks before sending API messages
  • Automated monitoring and alerting scripts
  • Integration with external billing or reporting systems

Get All Balances

Retrieve all resource balances and account information for the authenticated API key.

Endpoint: GET /balance

Response

{ "success": true, "user": { "name": "Demo Client", "email": "[email protected]", "role": "user", "balance": 12000, "whatsappBalance": 25000, "emailBalance": 50000, "voiceMins": 0, "createdAt": "2026-06-10T19:24:05.579Z" } }

Response Fields

FieldTypeDescription
successbooleanRequest success status
user.namestringAccount holder name
user.emailstringAccount email address
user.rolestringAccount role (user, admin, client)
user.balanceintegerMonetary balance (INR or configured currency)
user.whatsappBalanceintegerWhatsApp message credits remaining
user.emailBalanceintegerEmail credits remaining
user.voiceMinsintegerVoice minutes remaining
user.createdAtstringAccount creation timestamp

Example

curl:

curl -X GET "https://voxvaani.com/api/v1/balance" \ -H "x-api-key: YOUR_API_KEY"

Python:

import requests response = requests.get( "https://voxvaani.com/api/v1/balance", headers={"x-api-key": "YOUR_API_KEY"} ) data = response.json() print(f"WhatsApp Balance: {data['user']['whatsappBalance']}") print(f"Voice Minutes: {data['user']['voiceMins']}")

JavaScript:

const response = await fetch("https://voxvaani.com/api/v1/balance", { headers: { "x-api-key": "YOUR_API_KEY" } }); const data = await response.json(); console.log(`WhatsApp Balance: ${data.user.whatsappBalance}`); console.log(`Voice Minutes: ${data.user.voiceMins}`);

Parameters

ParameterTypeDescription
emailBalanceintegerRemaining email credits
voiceMinsintegerRemaining voice minutes
whatsappBalanceintegerRemaining WhatsApp messages
balanceintegerMonetary balance

Monitoring & Alerting Recommendations

Set Up Balance Monitoring

Use the Balance API to build automated monitoring that prevents campaign interruptions:

  1. Poll frequency: Check balances every 5-15 minutes during business hours; every 30 minutes outside business hours. Higher frequency during active campaigns.
  2. Threshold alerts: Set alerts at graduated thresholds:
    • Warning (30%): Send email notification to the team
    • Critical (10%): Send urgent notification (push, Slack, SMS)
    • Depleted (0%): Trigger incident response workflow
  3. Trend tracking: Store balance history to forecast when resources will run out based on consumption rate

Example Monitoring Script (Python)

import requests import time import smtplib API_URL = "https://voxvaani.com/api/v1/balance" API_KEY = "your-api-key" THRESHOLD_PERCENT = 10 # Alert at 10% plan_allocations = { "whatsappBalance": 5000, "emailBalance": 10000, "voiceMins": 1000 } while True: resp = requests.get(API_URL, headers={"x-api-key": API_KEY}) data = resp.json()["user"] for resource, plan_limit in plan_allocations.items(): current = data.get(resource, 0) pct = (current / plan_limit) * 100 if pct <= THRESHOLD_PERCENT: print(f"ALERT: {resource} at {pct:.1f}% ({current} remaining)") # Send email, Slack message, or push notification here time.sleep(300) # Check every 5 minutes

Low Balance Webhooks

For real-time low balance alerts without polling, register a webhook for balance events. Webhooks push notifications to your HTTPS endpoint when a balance crosses a threshold, eliminating the need for continuous polling.

Contact support or your administrator to configure balance webhook thresholds. Available events include:

  • balance.low — Balance dropped below warning threshold
  • balance.critical — Balance dropped below critical threshold
  • balance.depleted — Balance reached zero

Tips

  • Check balances before sending bulk messages or campaigns — a single API call can prevent thousands of failed sends
  • Set up monitoring to alert on low balances — don’t rely on manual checks
  • Use the balance API for automated resource management — integrate with your CI/CD pipeline to halt deployments if resources are insufficient
  • For real-time balance data during active campaigns, use the Balance API instead of the Wallet page (which may be cached)
  • The balance:read scope covers monitoring, but scope enforcement is not applied uniformly across all endpoints yet — read Authentication before handing a monitoring key to a third party