API REFERENCE

API Error Handling

HTTP status codes, error response format, and common error scenarios for the Kubeadapt API. Covers 400, 401, 403, 404, 422, and 500 responses.

All error responses use a consistent JSON format. Check the HTTP status code first, then read the detail field for a description of what went wrong.

Error Response Format

json
{ "detail": "Error description" }

For validation errors (422), the detail field may be an array of objects describing each invalid field.

Status Codes

CodeMeaningWhen
200OKRequest succeeded
400Bad RequestInvalid query parameter, such as an unrecognized timeframe value
401UnauthorizedMissing or invalid API key
403ForbiddenAPI key lacks the required permission scope, or the requested cluster is not in the key's allowed clusters
404Not FoundResource does not exist or is not accessible to your organization
422Unprocessable EntityRequest parameter failed validation
429Too Many RequestsRate limit exceeded for your API key
500Internal Server ErrorUnexpected server error

Common Error Scenarios

400 Bad Request

Returned when a query parameter has an invalid value.

bash
curl -H "Authorization: Bearer ka_your_api_key" \ "https://public-api.kubeadapt.io/v1/clusters/not-a-uuid"
json
{ "detail": "Invalid cluster ID format" }

401 Unauthorized

Returned when the Authorization header is missing or the key is invalid.

bash
curl https://public-api.kubeadapt.io/v1/clusters
json
{ "detail": "API key required. Use 'Authorization: Bearer <api_key>'" }

A valid-looking key that has been revoked or is otherwise invalid returns:

json
{ "detail": "Invalid API key" }

403 Forbidden

Returned when your key is valid but doesn't have the required scope, when the requested cluster is not in the key's allowed list, or when the key has been revoked.

json
{ "detail": "Missing required permission: recommendations:read" }
json
{ "detail": "Access to this cluster is not allowed" }

429 Too Many Requests

Returned when your API key has exceeded the rate limit (100 requests per minute by default). The response includes headers to help you handle the backoff:

json
{ "detail": "Rate limit exceeded" }

The response also includes:

HeaderExampleDescription
X-RateLimit-Limit100Your limit
X-RateLimit-Remaining0Requests left
X-RateLimit-Reset1741910460When the window resets (Unix timestamp)
Retry-After42Seconds to wait before retrying
Tip

Space your requests evenly rather than sending bursts. If you hit the limit, wait for the Retry-After duration before retrying.

404 Not Found

Returned when the resource ID doesn't exist or belongs to a different organization.

bash
curl -H "Authorization: Bearer ka_your_api_key" \ https://public-api.kubeadapt.io/v1/clusters/cls-nonexistent
json
{ "detail": "Cluster not found" }