Errors
The error body, what retryable means, and every code
A refused request gets a 4xx or 5xx status and the same JSON body every time.
Usually nothing was sent; details.messageId and details.sentParts say
when something was.
The error body
{
"error": {
"code": "recipient_not_allowed",
"message": "This person opted out of your messages.",
"details": { "reason": "opted_out" },
"requestId": "0192c4e1-…",
"docUrl": "https://docs.mapier.ai/convo/api/errors#recipient_not_allowed.opted_out",
"retryable": false
}
}| Field | Means |
|---|---|
code | What went wrong, the value to switch on |
details.reason | Which case of that code, from a fixed list per code |
details on a 422 | A list: each field at fault, with path, message and sometimes reason |
details.retryAfter | Seconds to wait, when known |
details.messageId | A message that may have gone out: read its result, don't resend |
details.sentParts | Parts of a split message already sent |
Other details fields | Some codes add their own, listed on the code's page |
message | A sentence for people, never for parsing |
requestId | Give this to support |
docUrl | This code's row on this page, at the reason when there is one |
retryable | true when the same request can succeed later |
When retryable is true
Only six cases are retryable. Every other refusal needs a fix first.
429 rate_limited, and503 service_busy.503 line_unavailablewith reasontransport_down: the line's connection to the channel is down for now.503 upstream_unavailablewhen nothing reached the channel.409 conflictwith reasonidempotency_key_in_flight, and with reasoncard_update_in_flightonce the card's last send has finished.
Retries says which Idempotency-Key to send in each case.
Every code
This table lists every code, and whether retryable can be true.
| Status | Code | Means | retryable |
|---|---|---|---|
| 400 | bad_request | The request could not be read, or a header it needs is missing | No |
| 401 | invalid_credentials | The key or token is missing, unknown, revoked or expired | No |
| 403 | channel_not_entitled | This channel is not turned on for your project | No |
| 403 | forbidden | The key or token may not make this call here | No |
| 403 | insufficient_scope | The key or token lacks the scope for this call | No |
| 403 | line_not_allowed | The line does not belong to this project | No |
| 403 | recipient_not_allowed | You may not send this to this person now | No |
| 404 | not_found | Nothing exists at that id | No |
| 404 | unsupported_command | This channel or line cannot do that, or the name is retired | No |
| 409 | conflict | The request clashes with an earlier one, or with the current state | Only idempotency_key_in_flight and card_update_in_flight |
| 409 | conversation_closed | Your line can no longer send into this group | No |
| 409 | limit_reached | A test line's daily cap, your paid lines, or another count is reached | No |
| 409 | project_archived | The project is archived | No |
| 413 | payload_too_large | The request body is over 64 KiB | No |
| 422 | validation_failed | A field is missing or wrong | No |
| 429 | rate_limited | Too many requests | Yes |
| 500 | internal_error | Mapier failed on its side | No |
| 503 | capacity_exhausted | Every line is full for new people | No |
| 503 | line_unavailable | The line cannot send right now | Only transport_down |
| 503 | no_line | Your project has no active line on that channel | No |
| 503 | service_busy | Mapier is busy and did nothing | Yes |
| 503 | upstream_unavailable | The channel did not answer | Only before anything was sent |
Older API versions use other words for some codes and reasons: see Older versions.