Errors
Every error response is a JSON problem document, sent as application/problem+json:
{ "type": "https://docs.messaging.500calls.com/errors/validation_error", "title": "Validation error", "status": 422, "code": "validation_error", "detail": "No recipient could be accepted. No messages were created.", "request_id": "req_01M3KR6CQ26S90NG2V790GVFTX", "errors": [ { "field": "to[0]", "code": "invalid_recipient", "message": "Not a valid mobile number." }, { "field": "to[1]", "code": "invalid_recipient", "message": "Not a valid mobile number." } ]}Branch on the code
code is stable: branch on it, never on title or detail, which are written for people. type links to the code's page on this site; error codes lists them all. New codes can be added within v1, so treat a code you do not know by its HTTP status.
Field errors
For validation_error, errors lists each failure. field is a path in your request: to for a single send, to[3] for the fourth recipient of a bulk send, messages[3].to or messages[3].body for a batch item, or a header or query parameter name. code is one of these, or a message error code for a recipient:
| Code | Meaning |
|---|---|
required | The field is missing |
unknown_field | The API does not know the field |
invalid_type | The value has the wrong type |
invalid_format | The value is not in the expected format |
too_short, too_long | The text is too short or too long |
out_of_range | The number or time is out of range |
invalid_enum | The value is not one of the allowed ones |
body_empty, body_too_long, body_invalid_characters | The body is empty, over 10 segments, or has control characters |
too_many_items | The list is too long |
invalid_cursor | The cursor is not one we gave you |
range_too_large | The time range is too long |
Treat a field code you do not know as a general validation failure.
Extra members
Some codes add members: insufficient_balance adds required_amount, available_amount and currency, and too_many_recipients adds limit.
Retrying
Idempotency and retries says which codes to retry, and how.
The request ID
Every response, error or not, carries an X-Request-Id header, and every error body repeats it as request_id. Quote it when you contact support.