Errors
When a request fails, the response body is an error object. It always has a
type and a message, and sometimes an extra field such as scope:
{ "error": { "type": "insufficient_scope", "message": "…", "scope": "sms:send" } }
| Field | Contract |
|---|---|
type | Stable — base your code's decisions on this. New values may be added, but an existing one is never reused to mean something else. |
message | A human-readable description. It can change at any time, so never write code that reads it. |
scope | Only on insufficient_scope — tells you exactly which permission to ask for next. |
The catalog
type | Status | What happened | What to do |
|---|---|---|---|
invalid_request | 400 | Missing or malformed field, unknown enum value, unknown field in the body, or unparseable JSON | Fix the request. The message names the field. |
unauthenticated | 401 | No credential, or one that is invalid, revoked or expired | Refresh the token, or check the key |
insufficient_scope | 403 | Valid credential, missing scope | Re-authorize with the scope in the scope field |
permission_denied | 403 | Scope is fine — the person's role lacks the permission | Their admin changes the role in the portal |
not_found | 404 | No such object, or it is not this account's | Check the id |
conflict | 409 | The request contradicts current state | Re-read, then retry |
unsupported | 400 | A recognized parameter with a value this API cannot honour | See the message — e.g. enabled=false as a filter |
rate_limited | 429 | Too many requests | Back off. Not currently emitted — see Rate limits. |
unavailable | 503 | A dependency is down | Retry with backoff |
internal_error | 500 | Something failed on our side | Retry. You were not charged. |
Several rows above say to "back off." Backing off means waiting before you retry, and waiting longer after each failure — for example 1s, then 2s, then 4s — rather than retrying in a tight loop. This gives an overloaded server room to recover.
Sign-in (OAuth) errors
Errors shown while signing in or adding an app, and what fixes each, are on OAuth errors.
The two 403s are not the same problem
This is the single most common source of lost time on this API.
{ "error": { "type": "insufficient_scope", "message": "credential is not authorized for sms:send", "scope": "sms:send" } }
→ Your code's problem. The credential was never granted sms:send.
Re-authorize, or add the scope to the key.
{ "error": { "type": "permission_denied", "message": "the user who authorized this application does not have access to call recordings" } }
→ Not your code's problem. The scope is there; it is the person who approved the token who lacks the matching permission in the admin center. Re-authorizing will not fix it — their administrator has to change their role. See Scopes.
401 names the scope it wanted
When a request fails with 401, the response includes a standard header called
WWW-Authenticate (defined by RFC 6750, the OAuth bearer-token standard). Its
scope="…" part names exactly which permission the endpoint needed — sms:read
in the example below.
That saves you from guessing: instead of asking the user up front to approve a big list of permissions "just in case," your app can read this header, see the one scope it was missing, and request just that one the next time it authorizes:
WWW-Authenticate: Bearer realm="Telebroad API", error="invalid_token", scope="sms:read"
What is safe to retry
| Status | Safe to retry | Why |
|---|---|---|
5xx | Yes | Nothing was created or charged. Guaranteed. |
429 | Yes, after backing off | Nothing happened |
4xx | No — fix the request first | It will fail identically |
Two of the write operations are idempotent — doing them twice has the same effect as doing them once — so retrying after a timeout is safe even if the first attempt actually succeeded:
POST /sms/conversations/{line}/{number}/resolve— re-resolving does not change who closed it or when.POST /webhooks/{id}/enableand/disable— setting a state it is already in does nothing.
POST /sms/messages is not idempotent — retrying after a timeout may send (and
bill you for) a second message. If you cannot risk that, check
SMS history before retrying.
5xx messages are deliberately vague
An internal error's message always just reads "internal error". The real details
can include things like internal database and server names, so we keep them in our
own logs instead of sending them back to you. If you need one looked into, send us
the timestamp, the endpoint, and the account — each internal error is logged on our
side with a tracking code.