Errors¶
Every Klaris API reports errors the same way: an HTTP status and a body like this:
{
"error": {
"type": "invalid_request_error",
"code": "conversation_not_found",
"message": "No such conversation for this user."
}
}
Check code in your code. message is plain English you may show to people.
Any API¶
| Status | code |
Means | What to do |
|---|---|---|---|
| 401 | invalid_api_key |
The key is missing, wrong or revoked. | Check the Authorization header. |
| 403 | api_not_enabled |
The workspace doesn't have API access switched on. | Ask us to switch it on. |
| 403 | missing_scope |
The key can't do this. | Use a key with that scope. See API keys. |
A request whose JSON doesn't match the expected shape (a missing field, a wrong type) gets 422 with a standard detail list, which names each field that's wrong.
Klaris Agent API¶
| Status | code |
Means | What to do |
|---|---|---|---|
| 400 | empty_input |
input is empty. |
|
| 400 | input_too_long |
input is over 100,000 characters. |
|
| 400 | mixed_input |
Approval answers and a new question in one request. | Send the answers first, then the question. |
| 400 | bad_approval_id |
That isn't an approval id (apr_…). |
|
| 400 | memory_not_kept |
The memory looks sensitive, is too long, or the person already has 50. | Show message. |
| 400 | invalid_connection |
A connection's fields are wrong or missing. | Show message. |
| 400 | return_url_not_allowed |
return_url isn't an allowed return address. |
Add it on Settings → API Keys. |
| 400 | bad_period |
start is after end, or the period is over a year. |
|
| 404 | conversation_not_found, response_not_found, memory_not_found, connection_not_found |
It doesn't exist, or belongs to another person or workspace. | |
| 429 | rate_limited |
This key started 60 responses in the last minute, its limit. | Wait a moment and try again. Ask us if you need a higher limit. |
| 409 | approval_mismatch |
The answers don't match what's waiting in that conversation. | Fetch the conversation's items and answer what's waiting. |
| 409 | not_configured |
The workspace has no AI model set up. | Set one on Settings → AI Configuration. |
| 409 | conversation_busy |
An answer is still being worked on in this conversation (the message names it). A conversation takes one answer at a time. | Wait for that response to finish (fetch it), or cancel it, then send again. |
| 503 | secrets_not_configured, sign_in_not_configured |
This Klaris server isn't set up to store logins or offer Google sign-in yet. | Tell Klaris. |
When the model fails¶
If the AI model itself fails part-way (for example, the provider is down), you don't get an error status. The response comes back with status: "failed" and an error object whose message says what happened in plain words. The provider's own error text is never passed on. Asking again usually works.