Errors
Every error from /v1 has the same shape:
{ "error": { "type": "invalid_request_error", "code": "validation_failed", "message": "name is required.", "request_id": "req_8c1f" }}typegroups errors by HTTP status:invalid_request_error(400, 413, 415, 422),authentication_error(401),permission_error(403),not_found_error(404),conflict_error(409),rate_limit_error(429),api_errorfor anything else.codeis stable and safe to match on.messageis for people. Do not match on it.request_ididentifies the call in your request logs. Quote it when you contact support.
The app API under /api returns the shorter { "code": "...", "message": "..." }.
| Code | Status | Meaning | What to do |
|---|---|---|---|
validation_failed | 400 | The request body or a parameter is wrong. The message says which. | Fix the request. Retrying will not help. |
unauthorized | 401 | Missing, expired or wrong credentials, or a wrong authenticator code. | Check the credentials. For a signed-in session, sign in again. |
email_not_verified | 401 | Sign-in worked but the email address is not verified yet. | Verify the email, then sign in. |
invalid_api_key | 401 | The Bearer key is not a valid AirFone key. | Check for a revoked, rolled or mistyped key. |
forbidden | 403 | You are authenticated but not allowed. | Use a key or role with the right access. |
insufficient_credit | 402 | The wallet balance is too low for this. The message says by how much. | Add funds, then repeat the request. |
sandbox_workspace | 403 | Asked of a sandbox organization, such as a live key. | Use your business’s own organization. |
missing_scope | 403 | A restricted key lacks the scope this call needs, or a publishable key was used outside the widget. | Use a key with the scope named in the message. |
reauthentication_required | 403 | A sensitive action needs your password again. | Call POST /api/auth/step-up, then retry the same request within five minutes. See Teams and roles. |
production_requires_administrator | 403 | Making, rolling or revoking a live key needs an admin. A role with only developer.manage is not enough. | Ask an admin to do it. |
not_found | 404 | The resource does not exist in your organization. | Check the id and the organization. |
conflict | 409 | The request clashes with the current state, such as a taken email or a sole owner with members. | Read the message and change the state first. |
idempotency_in_progress | 409 | A request with this Idempotency-Key is still running. | Retry after a short wait. |
idempotency_key_reused | 422 | This Idempotency-Key was already used for a different request (method, path or body differ). | Use a new key for a new request. Reuse a key only to retry the identical request. |
idempotency_key_too_long | 400 | The Idempotency-Key header is too long. | Use a shorter key. |
unknown_version | 400 | The AirFone-Version header names a version that does not exist. | Use the version in the message. |
body_too_large | 413 | A POST with an Idempotency-Key had a body over 1 MB. | Send a smaller body. |
rate_limited | 429 | Too many requests, or too many failed sign-in or step-up attempts. | See below. |
wrong_cell | 421 | The organization lives in another region cell. The message is that cell’s API base. | Send the request to that base. |
internal | 500 | Something failed on our side. Some of these use 501 or 503, for example when payments are not configured. | Retry with backoff. Quote the request_id if it persists. |
Rate limits and lockouts
Section titled “Rate limits and lockouts”- API calls are limited per key (each key has its own requests per minute), or per IP when no key is sent. A refused call returns 429 with
Retry-After: 60. - Ten wrong passwords or wrong sign-in codes lock sign-in for that account for 15 minutes.
- Five wrong passwords or codes at step-up lock step-up for 15 minutes. The message is “Too many wrong tries. Try again in 15 minutes.”
- Resending a verification message too often also returns 429.
Sandbox organizations
Section titled “Sandbox organizations”A sandbox organization only takes test keys. Asking for a live key there is refused with 403 sandbox_workspace and the message “A sandbox only takes test keys. Make live keys in your business’s own organization.” Create the live key in your business’s own organization.
Not enough balance
Section titled “Not enough balance”Live use is paid from the organization’s wallet. When the balance is too low, the call is refused with HTTP 402 and a message such as “Your balance is short by Rs 400.00. Add funds and try again.” The code is insufficient_credit. Add funds, then repeat the request.