2xx status means success, a 4xx status means something was wrong with your request, and a 5xx status means something went wrong on our side.
Every error response has the same shape: a JSON body with an error object. This is consistent across every endpoint, so you can parse errors the same way everywhere.
The error object
Branch on
error.code (stable) or error.type (broad), never on error.message (the wording can change). Check the HTTP status code first to decide how to react.Error types
Thetype field is derived from the HTTP status code:
Status codes
Common errors
Missing or invalid API key:The Web agent endpoint is different
The public widget endpoint (POST /v1/widget/message) never returns a hard error to the visitor’s browser. It always responds with 200 and an ok flag:
200 with ok: false and a short reason, so your widget can show a friendly fallback instead of breaking:
Handling errors well
1
Check the status code
A
4xx means fix your request. A 5xx means our side - safe to retry.2
Branch on error.code
The
code is stable and machine-readable. Use it to decide how your app reacts. Show error.message to a human if needed.3
Retry 5xx with a short backoff
For a
500, wait a moment and try again. Do not retry in a tight loop.