Error codes
Lane.Chat's REST API returns a JSON envelope on every response. Success is code: 0; errors carry a non-zero code that mirrors the HTTP status.
json
{ "code": 0, "msg": "success", "data": { } }json
{ "code": 404, "msg": "Application not found" }Common codes
| Code | Meaning | Typical cause |
|---|---|---|
0 | Success | The request succeeded; read data. |
400 | Bad request | A required parameter is missing (e.g. appId, chat_id). |
401 | Unauthorized | Missing/invalid/expired token, or the visitor could not be authenticated. |
403 | Forbidden | The visitor is banned, the caller does not own the resource, or the request was identified as a bot. |
404 | Not found | Application, chat, or resource does not exist. |
422 | Unprocessable | Validation failed (e.g. empty values on a form submit, invalid field). |
429 | Rate limited | Too many requests — see Rate limits. |
500 | Server error | An unexpected server-side failure. |
Notable variants
Some endpoints add fields alongside the code to disambiguate:
| Response | Meaning |
|---|---|
{ "code": 403, "bot": true } | Session init refused because the request looked like a crawler/bot. |
{ "code": 403, "banned": true } | The visitor has been banned; chat is blocked. |
Validation errors
Dashboard endpoints that validate input return code with a message and, where applicable, a field-level errors object:
json
{
"code": 400,
"msg": "Validation failed",
"errors": { "password": ["The password must be at least 6 characters."] }
}Rate-limit responses
A throttled request returns HTTP 429 with a JSON body and headers:
json
{ "code": 429, "error": "rate_limited", "message": "Too many requests", "retry_after": 42 }| Header | Meaning |
|---|---|
Retry-After | Seconds to wait before retrying |
X-RateLimit-Limit | The window's request cap |
X-RateLimit-Remaining | Remaining requests in the window |
X-RateLimit-Reset | Unix time when the window resets |
Webhook and channel endpoints
Inbound webhook receivers use HTTP status directly rather than the JSON envelope. For example, the email inbound endpoint returns 200 (stored), 204 (silently dropped — invalid token or empty body), or 401 (bad shared secret).