Errors & status codes
HTTP status codes
200
OK
Successful request, payload in response.
201
Created
Resource created.
400
Bad Request
Invalid request body or missing required field.
401
Unauthorized
Missing or invalid credentials.
403
Forbidden
Credentials valid but not authorised for this resource (e.g. instance not visible to user).
404
Not Found
Resource (instance, document, conflict) does not exist.
409
Conflict
State-machine violation (e.g. trying to close an already-managed conflict).
422
Unprocessable Entity
Request body validates but is semantically wrong (e.g. answer length exceeds limit).
429
Too Many Requests
Rate limit hit (auth: 5 logins/min/IP).
500
Internal Server Error
Unexpected server failure. Exponential backoff retry recommended.
502
Bad Gateway
Upstream component (LLM router, vector store) unreachable.
503
Service Unavailable
Service in maintenance or degraded; respect the Retry-After header.
Error body shape
All three APIs return {"detail": "<message>"} on error. The success wrapper {"response": ...} is only present on 2xx.
{
"detail": "Instance not found"
}Per-API specifics
Retrieval API — api-retrieval.kai-studio.ai
401— token expired or revoked.403— instance access denied (group RBAC).422— query length or pagination parameter violation.
Audit API — api-audit.kai-studio.ai
401— token expired or revoked.409— conflict already managed or ignored.422— workflow-state mismatch (e.g. answering a conflict that is inMANAGEDstate).
Authenticating with an Organization API key
The Audit and Retrieval APIs — REST and /mcp alike — accept an Organization API key directly in Authorization: Bearer. That path returns exactly two failure codes, and they mean opposite things:
401
Invalid or revoked API key, Token has expired, or Invalid token. The credential is refused.
Stop. Do not retry, and do not fall back to OAuth.
503
Authentication service temporarily unavailable, with a Retry-After header. Authentication is momentarily unavailable or saturated; the credential is not implicated.
Retry after Retry-After seconds.
Nothing else comes out of the key authentication path. An unattended agent must treat 401 as fatal: MCP hosts respond to 401 by starting an OAuth flow that requires a browser, so an agent that retries there hangs instead of failing. See Autonomous agents (API key).
OAuth-specific errors
OAuth 2.1 endpoints return standard error responses defined in RFC 6749 §5.2:
invalid_request
Required parameter missing, included twice, or malformed.
invalid_client
Client authentication failed (unknown client_id or bad client secret).
invalid_grant
Authorization code, refresh token, or resource-owner credential is invalid, expired, or revoked.
unauthorized_client
Client is not authorised to use the requested grant type.
unsupported_grant_type
The grant type is not supported by the authorisation server.
invalid_scope
Requested scope is invalid, unknown, malformed, or exceeds the granted scope.
See the OAuth 2.1 page for the full authentication flow.
Last updated