Errors
Every error has the same shape, a stable code and a link to its explanation.
{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "limit must be an integer between 1 and 100.",
"param": "limit",
"request_id": "req_8f2c1d9b0a7e4c11",
"doc_url": "https://aichat.md/docs/api/errors#parameter_invalid"
}
}Types
| HTTP | type | When |
|---|---|---|
| 400 / 413 / 422 | invalid_request_error | missing or invalid parameter, invalid body, the channel refused the message |
| 401 | authentication_error | missing, wrong, expired or revoked key, or suspended account |
| 403 | permission_error | the key lacks the required scope |
| 404 | not_found_error | the object does not exist in the key's workspace |
| 409 | idempotency_error | Idempotency-Key reused with another request or still running |
| 429 | rate_limit_error | too many requests — see Retry-After |
| 5xx | api_error | our side — retry with the same Idempotency-Key |
Codes
| code | Meaning |
|---|---|
api_key_missing | The Authorization: Bearer … header is missing. |
api_key_invalid | The key does not exist or is wrong. |
api_key_revoked | The key was revoked (or its post-rotation grace period ended). |
api_key_expired | The key expired. |
account_inactive | The account that owns the key is suspended. |
scope_missing | The key lacks a permission; the message names it. |
parameter_missing | A required parameter is missing (param). |
parameter_invalid | A parameter has a value that is not allowed (param). |
parameter_unknown | Unknown or read-only parameter (e.g. a lead's phone). |
resource_missing | The object does not exist in this workspace. |
route_missing | No such route. |
body_invalid_json | The request body is not valid JSON. |
body_too_large | The body is larger than 1 MB. |
idempotency_key_reused | Same Idempotency-Key with a different body. |
idempotency_in_progress | A request with the same key is still running; retry. |
rate_limited | Limit exceeded; wait Retry-After seconds. |
channel_delivery_failed | The channel (e.g. Meta) refused the message: 24-hour window, disconnected page. |
too_many_endpoints | At most 10 webhooks per workspace. |
internal_error | Our error. Keep the request_id. |
auth_state_unavailable | Account checks are briefly unavailable; retry in a second. |
public_api_unavailable | The API is temporarily unavailable. |