API Authentication
All Voxvaani API requests require authentication using an API key.
Quick Auth Summary
| Property | Value |
|---|---|
| Header Name | x-api-key (recommended), Authorization: Bearer, or Authorization: ApiKey |
| Format | x-api-key: YOUR_API_KEY |
| Key Prefix | vv_ (production) or vv_test_ (sandbox) |
| Where to Get One | Settings > API Keys |
Never expose API keys in client-side code, mobile apps, or public repositories. Keys embedded in frontend JavaScript, mobile APKs, or git repositories can be extracted by anyone. Always route API calls through your backend server. A compromised key gives the attacker your full permitted access — they can send messages, drain balances, and read campaign data.
Authentication Methods
Include your API key using one of these methods:
Recommended — x-api-key header:
x-api-key: YOUR_API_KEYAlternative — Authorization Bearer header:
Authorization: Bearer YOUR_API_KEYAlso supported — Authorization ApiKey header:
Authorization: ApiKey YOUR_API_KEYAll three methods are functionally equivalent. x-api-key is recommended because it keeps keys separate from OAuth/SSO tokens that may also use the Authorization header.
Permission Scopes
API keys support granular permissions. When creating a key, assign only the scopes your integration actually needs. Each scope unlocks a specific set of endpoints:
| Scope | Description | Endpoints Unlocked |
|---|---|---|
balance:read | Query account and resource balances | /api/v1/balance |
whatsapp:send | Send single WhatsApp messages and media | /api/v1/whatsapp/send, /api/v1/whatsapp/send-media |
whatsapp:send-template | Send single WhatsApp template messages | /api/v1/whatsapp/send-template |
whatsapp:bulk-send | Send bulk WhatsApp template messages | /api/v1/whatsapp/bulk-send |
whatsapp:campaigns | Query campaign and delivery status | /api/v1/whatsapp/campaigns/** |
email:send | Send single email messages | /api/v1/email/send |
voice:calls | Initiate voice calls and query call logs | /api/v1/voice/call, /api/v1/voice/call-logs |
Some endpoints perform scope validation, while others accept any valid API key regardless of assigned scopes:
- Scope-validated endpoints:
/api/v1/voice/call,/api/v1/voice/call-logs,/api/v1/whatsapp/send-template,/api/v1/whatsapp/bulk-send,/api/v1/whatsapp/campaigns,/api/v1/whatsapp/send-media,/api/v1/whatsapp/webhooks - Non-validated endpoints (any valid API key is accepted):
/api/v1/balance,/api/v1/whatsapp/send,/api/v1/email/send
Principle of least privilege: If your app only checks balances, do not grant it whatsapp:send. If your app sends bulk messages, it needs whatsapp:bulk-send but may not need whatsapp:send or email:send. Each unnecessary scope increases the blast radius of a compromised key.
Obtaining an API Key
- Log in to your Voxvaani account.
- Navigate to Settings from the sidebar and go to the API Keys section.
- Click Create New Key.
- Enter a descriptive name (e.g., “Production WhatsApp Bot”).
- Select the required permission scopes.
- Click Create and copy the key immediately — it is shown only once.
Example Requests
CURL
curl -X GET "https://voxvaani.com/api/v1/balance" \
-H "x-api-key: YOUR_API_KEY"Python
import requests
headers = {"x-api-key": "YOUR_API_KEY"}
response = requests.get(
"https://voxvaani.com/api/v1/balance",
headers=headers
)
print(response.json())JavaScript (Node.js)
const response = await fetch("https://voxvaani.com/api/v1/balance", {
headers: { "x-api-key": "YOUR_API_KEY" }
});
const data = await response.json();
console.log(data);JavaScript (Browser)
// WARNING: Never expose API keys in client-side code.
// Route API calls through your backend server instead.Multi-Key Strategy
For applications with multiple environments or services, use separate API keys:
| Key Name | Scopes | Used By |
|---|---|---|
vv_live_monitor | balance:read, whatsapp:campaigns | Monitoring dashboard |
vv_live_whatsapp | whatsapp:send, whatsapp:send-template | Customer support integration |
vv_live_bulk | whatsapp:bulk-send | Marketing automation |
vv_live_email | email:send | Transactional email service |
Benefits of separate keys:
- If one key is compromised, only that service is affected.
- You can revoke and rotate individual keys without disrupting other services.
- Transaction logs show which service made each API call, simplifying audit and debugging.
API Key Security Checklist
| Practice | Detail | Priority |
|---|---|---|
| Store keys in environment variables | Use .env files (never committed) or a secrets manager | Critical |
| Rotate keys every 90 days | Create a new key, update apps, revoke old key | High |
| Use separate keys per environment | Different keys for dev, staging, and production | High |
| Apply least privilege scopes | Grant only the scopes each integration needs | High |
| Never embed in client-side code | No frontend JS, no mobile app, no public repo | Critical |
| Revoke unused keys immediately | Decommissioned integrations should have their keys revoked | Medium |
| Monitor key usage in logs | Review the transaction log for unexpected API call patterns | Medium |
| Use a secrets manager in production | AWS Secrets Manager, HashiCorp Vault, or GitHub Secrets | Recommended |
Key Rotation Workflow
- Create a new key with the same scopes while the old key is still active.
- Deploy the new key to your application (update environment variable or secrets manager).
- Verify the application works with the new key — check a few API calls return 200.
- Revoke the old key from the API Keys settings page.
- Confirm the old key returns 401 — verify revocation took effect.
Recommended rotation frequency: Every 90 days for production keys. Rotate immediately if a key is suspected to be compromised. Plan rotations during low-traffic periods or maintenance windows to avoid service disruptions.
Error Responses
Every error response is a single error field containing a descriptive message.
Authentication failure (missing or invalid key — HTTP 401):
{
"error": "Unauthorized: Invalid or missing API key"
}Insufficient scope (valid key, wrong permissions — HTTP 403):
{
"error": "Forbidden: This API key does not have the 'whatsapp:send' permission."
}The Balance API, Email API, and POST /whatsapp/send validate only that an API key is present and valid; they do not currently enforce the permission scopes listed above. A key issued for a single purpose can therefore call these endpoints.
Treat those three endpoints as key-wide access when you hand out API keys. The WhatsApp, Voice, and webhook endpoints do enforce their documented scopes.