Error handling
Every error response uses a consistent envelope:
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more fields failed validation.",
"details": { "to": "Must be a valid E.164 phone number." }
}
}
Successful responses have "success": true and a data key (or data + meta for paginated lists).
Error code reference
| Code | HTTP | When it occurs |
|---|---|---|
MISSING_API_KEY | 401 | No Authorization header provided. |
INVALID_API_KEY | 401 | API key is invalid or revoked. |
ACCOUNT_SUSPENDED | 403 | The account is suspended. |
ACCOUNT_PENDING_KYC | 403 | KYC is not yet approved. |
INSUFFICIENT_CREDIT | 402 | Balance too low for a usage action. |
VALIDATION_ERROR | 422 | One or more fields failed validation. The details object maps field names to messages. |
RATE_LIMIT_EXCEEDED | 429 | Per-minute rate limit exceeded. |
NUMBER_NOT_FOUND | 404 | Number not provisioned to your account. |
NUMBER_UNAVAILABLE | 409 | No matching number is available to provision. |
PLAN_LIMIT_REACHED | 409 | Plan number limit reached. |
DEVICE_OFFLINE | 409 | The device for this number is currently offline. |
CROSS_COUNTRY_CALL_NOT_PERMITTED | 422 | Voice destination country differs from the source number's country. |
MESSAGE_NOT_FOUND | 404 | SMS message not found. |
CALL_NOT_FOUND | 404 | Call session not found. |
CALL_ALREADY_ENDED | 409 | Call is not in a hangable state (already ended). |
CALL_NOT_RINGING | 409 | Answer attempted on a call that is not ringing. |
WEBHOOK_NOT_FOUND | 404 | Webhook not found. |
INVALID_EVENT_TYPE | 422 | Unknown webhook event type. |