Docs/Error Handling

Error Handling

Learn how to handle API errors gracefully in your application.

Error Response Format

All error responses follow a consistent JSON format:

{
  "success": false,
  "error": {
    "code": "invalid_parameter",
    "message": "The 'to' field must be a valid phone number",
    "param": "to"
  }
}

HTTP Status Codes

400

Bad Request

The request was malformed or missing required parameters.

401

Unauthorized

Authentication failed. Check your API key.

403

Forbidden

You don't have permission to access this resource.

404

Not Found

The requested resource doesn't exist.

429

Too Many Requests

Rate limit exceeded. Slow down your requests.

500

Internal Server Error

Something went wrong on our end. Try again later.

Best Practices

  • Always check the success field in responses
  • Implement exponential backoff for rate limit errors (429)
  • Log error codes and messages for debugging
  • Retry failed requests with idempotency keys