Errors: codes, statuses and what to do
Every bubblr API error: the JSON shape, the HTTP statuses, each error code with what it means and how to fix it, and which errors to retry.
Every error answers with a fitting HTTP status and the same JSON:
{ "error": { "code": "recipient_not_allowed", "message": "This API key may only reach its allowed recipients, and +14155550142 isn't one of them. Ask an admin to add it to the key's allowed_recipients." } }codeis stable and machine-readable: branch on it.messageis for people: it says what went wrong and how to fix it. It may change wording; don't parse it.detailsappears on some codes: the invalid fields forvalidation_failed, the limit forrate_limited.
Validation errors list each problem:
{ "error": { "code": "validation_failed", "message": "Invalid request: to: Invalid input: expected string, received undefined",
"details": [{ "path": "to", "message": "Invalid input: expected string, received undefined" }] } }Which errors to retry
| Status | Retry? |
|---|---|
400, 401, 403, 404, 409, 413 |
No: the same request fails the same way. Fix it first. |
402 |
Not until billing is fixed. Reading still works. |
429 |
Yes, after Retry-After seconds. |
500, 503 |
Yes, with backoff (1 s, 2 s, 4 s…). Sends and calls are safe to retry with the same Idempotency-Key. |
The SDK retries what's safe to retry for you.
Error codes
| Status | Code | Means | What to do |
|---|---|---|---|
| 400 | validation_failed |
A field is missing or invalid. | Read message; details lists each field and what's wrong with it. |
| 400 | idempotency_key_required |
A send or call came without an Idempotency-Key header. |
Send one: any unique string up to 255 characters, such as a UUID. |
| 400 | idempotency_key_reserved |
The Idempotency-Key starts with draft:, which draft approval uses. |
Use another key, such as a UUID. |
| 400 | group_not_supported |
Group chats can't have contact details. | Name the people in the group instead. |
| 400 | invalid_number |
That isn't a phone number calls can go to. | Use a US or Canadian number, in any common format. |
| 400 | forward_loop |
Forwarding there would send the call straight back to a line. | Forward to a number outside your lines. |
| 400 | forward_not_allowed |
Calls can't be forwarded to that number (emergency, premium or outside the US and Canada). | Pick another number. |
| 400 | unsupported_audio |
The greeting isn't an MP3 or WAV file. | Save it as MP3 or WAV and send it as the request body. |
| 400 | greeting_too_long |
The greeting is longer than 2 minutes. | Shorten it. |
| 400 | greeting_too_short |
The greeting is shorter than half a second. | Record a longer one. |
| 400 | unreadable_audio |
The audio file couldn't be read. | Export it again as MP3 or WAV. |
| 401 | unauthorized |
The API key is missing, unknown or revoked. | Send Authorization: Bearer sk_live_… with a key that exists. |
| 402 | payment_required |
The team's subscription isn't paid up, so sending is paused. | Fix billing in the app. Reading still works. |
| 402 | calling_not_subscribed |
The line doesn't have Calling on its plan. | Add Calling to the line in the app. |
| 402 | spending_cap_reached |
The team has used its calling minutes for the month. | Wait for the 1st, or ask support to raise the cap. Incoming calls still ring. |
| 403 | insufficient_scope |
The API key lacks the scope this needs. | Create a key with that scope. |
| 403 | forbidden |
The line is suspended, or the key may not do this. | Read message; contact support about a suspended line. |
| 403 | recipient_not_allowed |
The recipient isn't on this key's allowed recipients. | Add them to the key's list, or use another key. |
| 403 | draft_only_key |
This key can only write drafts; typing, reactions and read receipts aren't drafts. | Use a key that isn't draft-only. |
| 403 | session_required |
Only a signed-in team member can do this, not an API key. | Do it in the app. |
| 403 | not_note_author |
Only a note's author can edit it (or delete it, with owners and admins). | Add a new note instead. |
| 403 | emergency_number_blocked |
Emergency and N11 numbers can't be called from a line. | Dial emergency services from a phone. |
| 403 | destination_not_allowed |
Calls go to US and Canadian numbers only. | Call a US or Canadian number. |
| 403 | fair_use_paused |
Outgoing calls on this line are paused for the month (fair use). | Contact support. Incoming calls still ring. |
| 403 | calling_suspended |
Calling is suspended for the team. | Contact support. |
| 403 | sending_paused |
We paused sending on your account (or this line) while we review recent activity that looked like mass texting. Incoming messages still arrive. details.scope is team or line. |
Reply to our email or contact support. Messages waiting to go out when it paused fail with this code too. |
| 404 | not_found |
No such object, or the key can't see it. | Check the id. A key limited to some lines gets 404 for the others. |
| 404 | attachment_missing |
The file is no longer there. | Ask the sender for it again. |
| 409 | idempotency_key_reused |
The Idempotency-Key was used before for a different request. Nothing was sent. |
Use a new key for a new message. |
| 409 | profile_not_ready |
The line is still being set up. | Wait until its state is working. |
| 409 | not_sent_yet |
The message hasn't gone out yet, so it can't be reacted or replied to. | Wait for message.sent. |
| 409 | imessage_only |
Reactions work only on iMessage messages. | React to an iMessage message, or reply instead. |
| 409 | draft_approved |
The draft was already approved. | Nothing to do: it has been sent. |
| 409 | draft_rejected |
The draft was rejected. | Write a new message. |
| 409 | draft_conflict |
A message already uses the draft's idempotency key. | Draft the message again. |
| 409 | line_needs_update |
The line can't do this yet. | Try again later; we update lines in the background. |
| 409 | calling_not_set_up |
The line has no calling. | Add Calling to the line. |
| 409 | caller_id_unverified |
Calling on the line is still being set up. | Wait until calling's state is working. |
| 409 | call_not_active |
The call has ended or isn't connected yet. | Only a live call can be transferred or hung up. |
| 409 | endpoint_in_use |
Call routing uses this voice endpoint. | Change the routing first. |
| 413 | attachment_too_large |
The file is larger than attachments may be. | Send a smaller file, or a link to it. |
| 413 | greeting_too_large |
The greeting file is over 5 MB. | Shorten it, or save it as MP3. |
| 429 | rate_limited |
The key's sends for this window are used up. | Wait Retry-After seconds. details has the limit and window. |
| 429 | new_conversation_limit |
The line started as many new conversations in the last 24 hours as it may. Replies, and messages to anyone who already wrote to the line, still go. | Wait Retry-After seconds. Texting people who expect to hear from you keeps a line healthy. |
| 503 | line_unavailable |
The line is having trouble right now. | Retry later, or send with queue: true (the default) to have it go out once the line is back. |
| 503 | line_timeout |
The line didn't answer in time. | Retry. |
| 503 | storage_disabled |
File storage is off on this server. | Send a public https URL instead of an upload. |
| 503 | upload_mismatch |
A file didn't arrive whole. | Retry. |
| 503 | calling_error |
Calling couldn't complete the request. | Retry; if it keeps failing, contact support. |
| 500 | internal |
Something went wrong on our side. | Retry; if it keeps happening, contact support. |
Line trouble
503 line_unavailable means the line is having trouble right now. Sends with queue: true (the default) don't get
it: they wait and go out once the line is back. Reactions, typing and read receipts happen at once, so they need the
line working. Webhooks tell you when it's back (profile.online).