Every failure answers the same shape:
{
"error": {
"code": "invalid_request",
"message": "contacts.0.phone: E.164, with the country code.",
"request_id": "req_8f14e45fceea167a5a36dedd4bea2543",
"details": [
{ "field": "contacts.0.phone", "problem": "E.164, with the country code." }
]
}
}
codeis what to branch on. It is stable.messageis a plain sentence for a person to read. It may be reworded at any time, so never match on it.request_idis also theX-Request-Idheader and is in your workspace's request log. Quote it when you ask us about a request.detailsnames the fields that were wrong — all of them, not just the first — when the failure is about fields.
Some errors add meta with what else the refusal knows: which from numbers were missing, which campaign already holds the assistant, which live campaign is blocking a delete.
The catalogue
| Code | Status | When |
|---|---|---|
invalid_request | 400 | The body or a query parameter is not valid. details says which field. |
idempotency_key_required | 400 | A POST that changes something arrived without an Idempotency-Key. |
unauthorized | 401 | No Authorization: Bearer header, a key that is not ours, a revoked key or an expired one. |
missing_scope | 403 | The key is valid but was not given this scope. |
not_found | 404 | No such thing in this workspace. Another workspace's id answers this too. |
conflict | 409 | The request fights something that exists — a name in use, an assistant already running a campaign. |
idempotency_key_reused | 409 | This Idempotency-Key was used for a different body. |
invalid_state | 409 | The thing cannot do this from where it stands — a draft campaign cannot be paused. |
insufficient_credits | 422 | Too little credit to start dialling. |
verification_required | 422 | The workspace owner has not finished their identity check. |
rate_limited | 429 | The key's hourly limit is used up. See Rate limits. |
internal_error | 500 | Something failed on our side. Quote the request_id. |
Older endpoints keep their own codes
/v1/calls, /v1/plans and /v1/plans/{id}/ready shipped before this catalogue existed, and customers already branch on what they answer. Rather than rename codes under working integrations, they keep theirs:
| Code | Status | On | Elsewhere this would be |
|---|---|---|---|
invalid_number | 400 | POST /v1/calls | invalid_request |
assistant_not_found | 404 | POST /v1/calls | not_found |
contact_not_found | 404 | POST /v1/calls | not_found |
idempotency_conflict | 409 | POST /v1/calls | idempotency_key_reused |
contact_blocked | 422 | POST /v1/calls | invalid_state |
contact_has_no_phone | 422 | POST /v1/calls | invalid_state |
too_many_live_calls | 429 | POST /v1/calls | rate_limited |
dial_failed | 502 | POST /v1/calls | internal_error |
invalid_body | 400 | POST /v1/plans/{id}/ready | invalid_request |
invalid_status | 400 | GET /v1/plans | invalid_request |
invalid_contact_id | 400 | GET /v1/plans | invalid_request |
plan_not_found | 404 | /v1/plans/{id}/ready | not_found |
not_waiting | 409 | /v1/plans/{id}/ready | invalid_state |
link_expired | 410 | signed recording links | not_found |
Two more things that are true only of POST /v1/calls: verification_required answers 403 there (422 everywhere else), and too_many_live_calls carries until, the moment there will be room again.
What to do with each
- 400 — fix the request. Retrying unchanged will fail again.
- 401, 403 — fix the key or its scopes. Not worth retrying.
- 404 — the thing is not in this workspace. Check which key you used.
- 409 — read the code.
invalid_statemeans do something else first (pause before changing settings);conflictmeans something is in the way. - 422 — a business rule says no. The workspace must act: top up credits, finish the identity check.
- 429 — wait for
Retry-Afterseconds, then retry. - 500, 502 — ours. Retry with backoff; the same
Idempotency-Keymakes that safe.