Preview:The API is still being rolled out and details may change before launch. Follow progress in the changelog.
Errors
When a request fails, the API answers with an HTTP status that matches the problem and a body with the same shape every time.
{
"message": "The request was refused as invalid",
"code": "INVALID",
"details": { "fields": ["messages.0.text"] }
}
Field
Description
message
An English explanation for developers. The wording may change, so don’t make decisions in code based on it.
code
A constant that doesn’t change. Base your code’s decisions on this.
details
Only for some codes, e.g. fields, retry_after, reason, until
Every answer has an X-Request-Id header. Include it when you report a problem to us. Answers never contain stack traces or messages from internal systems.
The reply token is unknown, used, expired, another bot’s or another chat’s
403
FORBIDDEN
The bot may not do that; details.reason gives the cause: paused, banned (the bot’s status in this chat), attacher_lost_rights, plan_limit, owner_inactive
403
BANNED
The bot is on this room’s ban list
403
CHAT_INACTIVE
The chat isn’t active
403
RESTRICTED
The bot or its owner is restricted (details.until when known)
5xx: retry, waiting longer each time (exponential backoff, e.g. 1, 2, 4, 8 seconds) plus a little random extra (jitter). Send a client_id with messages so a retry doesn’t post twice if the first attempt went through.
Other 4xx: don’t repeat the same request; fix it first.
v1 may gain new codes, and that doesn’t count as a breaking change (a change that breaks existing code). When your code sees a code it doesn’t know, decide by the HTTP status.