Errors
Every error response has the same shape, a stable machine-readable code and a fitting HTTP status. Branch on the code; show the message to people.
Error envelope#
codeis stable; build logic on it.messageis a sentence written for people. It may change, so don't parse it.detailsappears withvalidation_failedonly, keyed by request field.- The
X-Request-Idresponse header names the request in the API's logs. Quote it when you report a problem.
Error codes#
Campaigns
Telegram accounts and proxies
Recipients
Team, keys and webhooks
Sign-in and profile
Campaign validation errors#
When a launch fails its pre-launch checks, the response carries the whole report next to the error, warnings included. The same report is saved on the campaign as validation.
Show each check with status FAIL to whoever launched it. See pre-launch validation for every check.
Telegram sign-in errors#
Connecting an account goes through a worker that talks to Telegram. When Telegram rejects a step, the API answers with Telegram's error type as the code, in lowercase, and a readable message:
Errors while sending are not API errors: they land on the delivery (last_error), the send job, the account status and the message.failed webhook event. See delivery and account states.
Handling errors#
429: wait forRetry-After, then retry.5xxand network errors: retry reads with a growing delay. Before retrying a create, check whether the first attempt succeeded.401: the credential is missing, wrong or revoked. Retrying won't help; fix the credential.409: the object is in the wrong state for this. Reload it; the message says what to do instead.- Other
4xx: the request needs to change. Showmessage, and mapdetailsonto your form fields.