Errors and limits
Every error the API returns, the rate-limit headers, each plan's limits, and how to keep your keys safe.
Error shape
Every error has the same JSON body, whatever went wrong:
{
"error": {
"code": "invalid_request",
"message": "member: Invalid input: expected object, received undefined"
}
}Branch on error.code in your app. error.message is for people, and its wording can change.
Status codes
| Status | code | What it means | What to do | Retry? |
|---|---|---|---|---|
| 400 | invalid_request | The body isn't JSON, or a field is missing, wrong or unknown. | Fix the request. The message names the field. | No |
| 401 | invalid_key | The key is missing, wrong or revoked. | Check the Authorization: Bearer header, or create a new key. | No |
| 402 | upgrade_required | The API is switched off for this workspace. | Contact Dexbi support. | No |
| 409 | request_in_progress | The same message, with the same messageId, is still being answered. | Wait for the first request's answer. Sending it again after that runs it again. | No |
| 413 | payload_too_large | The body is over 64 KB. A valid request is far smaller. | Check what you're sending. | No |
| 429 | rate_limited | Too many calls this minute, or too many invalid keys from one address. | Wait Retry-After seconds. | Yes |
| 500 | internal | Something broke on our side. | Retry. If it keeps happening, contact support with the X-Request-Id. | Yes |
| 503 | engine_unavailable, api_unavailable or guard_unavailable | Dexbi can't answer right now. It doesn't count toward your AI replies. | Retry after a short wait. | Yes |
A messageId stops a double-send while the first copy is being answered. Dexbi doesn't keep answers: a retry after the first copy finished is answered, and counted, again.
Examples
{
"error": {
"code": "invalid_key",
"message": "Missing or invalid API key. Send it as `Authorization: Bearer dexbi_…`."
}
}{ "error": { "code": "invalid_request", "message": "Unrecognized key: \"membr\"" } }{
"error": {
"code": "rate_limited",
"message": "Over 10 calls a minute for this workspace. Retry after the reset."
}
}The API reference lists an example for every error.
Limits on each plan
The API is on every plan. Only the limits differ.
| Free | Basic | Pro | Max | |
|---|---|---|---|---|
| API keys | 1 | 2 | 3 | 10 |
- A short burst limit also applies per minute, to every request with a valid key, for your whole workspace. You'll rarely meet it; the rate-limit headers below tell you where you stand.
- AI replies come from your plan's monthly AI replies, the same ones Discord uses. A response with a
messageuses one.noneis free, and so is ahandoverorclosewithout amessage. See Plans compared. - When the monthly AI replies run out, Dexbi sends
nonefor every message, the way it stays quiet in Discord. It's not an error. The Owner gets the same emails as for Discord. See Plans and billing. - After a downgrade, your keys keep working. You can't create new ones while you're over the new plan's number.
Rate-limit headers
Every response to a request with a valid key says where you stand this minute, except a 402, or a 503 with guard_unavailable:
| Header | What it is |
|---|---|
X-RateLimit-Limit | Calls your workspace may make a minute. |
X-RateLimit-Remaining | Calls left this minute. |
X-RateLimit-Reset | When this minute's count resets, as a Unix timestamp in seconds. |
Retry-After | On a 429 only: seconds to wait before trying again. |
HTTP/2 200
content-type: application/json
x-request-id: 3f1c2a7e-9b4d-4c1e-8a52-6d0f9e2b7c41
x-ratelimit-limit: 10
x-ratelimit-remaining: 7
x-ratelimit-reset: 1759453260Request ids
Every response has an X-Request-Id header, except a 413. Log it. If you contact support about a request, include its id so we can find it.
Keep your key safe
An API key answers as your workspace. Treat it like a password.
- It's shown once. Copy it when you create it. If you lose it, create a new one.
- Keep it on your server. Never put it in website code, a Discord message or a public repository. Load it from an environment variable.
- Revoke it any time. Under Settings > API keys, revoke a key you don't use or one that may have leaked. It stops working right away.
- Only owners and admins can create and revoke keys.
