Skip to Content
API ReferenceAPI Authentication

API Authentication

All Voxvaani API requests require authentication using an API key.

Quick Auth Summary

PropertyValue
Header Namex-api-key (recommended), Authorization: Bearer, or Authorization: ApiKey
Formatx-api-key: YOUR_API_KEY
Key Prefixvv_ (production) or vv_test_ (sandbox)
Where to Get OneSettings  > 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_KEY

Alternative — Authorization Bearer header:

Authorization: Bearer YOUR_API_KEY

Also supported — Authorization ApiKey header:

Authorization: ApiKey YOUR_API_KEY

All 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:

ScopeDescriptionEndpoints Unlocked
balance:readQuery account and resource balances/api/v1/balance
whatsapp:sendSend single WhatsApp messages and media/api/v1/whatsapp/send, /api/v1/whatsapp/send-media
whatsapp:send-templateSend single WhatsApp template messages/api/v1/whatsapp/send-template
whatsapp:bulk-sendSend bulk WhatsApp template messages/api/v1/whatsapp/bulk-send
whatsapp:campaignsQuery campaign and delivery status/api/v1/whatsapp/campaigns/**
email:sendSend single email messages/api/v1/email/send
voice:callsInitiate voice calls and query call logs/api/v1/voice/call, /api/v1/voice/call-logs
ℹ️ Scope Enforcement Notes

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

  1. Log in to your Voxvaani account.
  2. Navigate to Settings from the sidebar and go to the API Keys section.
  3. Click Create New Key.
  4. Enter a descriptive name (e.g., “Production WhatsApp Bot”).
  5. Select the required permission scopes.
  6. 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 NameScopesUsed By
vv_live_monitorbalance:read, whatsapp:campaignsMonitoring dashboard
vv_live_whatsappwhatsapp:send, whatsapp:send-templateCustomer support integration
vv_live_bulkwhatsapp:bulk-sendMarketing automation
vv_live_emailemail:sendTransactional 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

PracticeDetailPriority
Store keys in environment variablesUse .env files (never committed) or a secrets managerCritical
Rotate keys every 90 daysCreate a new key, update apps, revoke old keyHigh
Use separate keys per environmentDifferent keys for dev, staging, and productionHigh
Apply least privilege scopesGrant only the scopes each integration needsHigh
Never embed in client-side codeNo frontend JS, no mobile app, no public repoCritical
Revoke unused keys immediatelyDecommissioned integrations should have their keys revokedMedium
Monitor key usage in logsReview the transaction log for unexpected API call patternsMedium
Use a secrets manager in productionAWS Secrets Manager, HashiCorp Vault, or GitHub SecretsRecommended

Key Rotation Workflow

  1. Create a new key with the same scopes while the old key is still active.
  2. Deploy the new key to your application (update environment variable or secrets manager).
  3. Verify the application works with the new key — check a few API calls return 200.
  4. Revoke the old key from the API Keys settings page.
  5. Confirm the old key returns 401 — verify revocation took effect.
⚠️ Rotation Timing

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." }
⚠️ Scope Checks Are Not Uniform Across Endpoints

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.