Error Handling

All error responses use a consistent format:

{
  "error": {
    "code": "validation_error",
    "message": "project_id is required",
    "field": "project_id"
  }
}

HTTP Status Codes

CodeMeaningCommon Cause
400Bad RequestMissing required field, invalid value
401UnauthorizedMissing or invalid API key
403ForbiddenUser not assigned to project
404Not FoundResource doesn’t exist
409ConflictDuplicate entry (if idempotency used)
422Unprocessable EntityValid JSON but business rule violated
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer-side error

Error Codes

CodeDescription
validation_errorRequest body failed validation
authentication_errorAPI key missing or invalid
authorization_errorInsufficient permissions
not_foundResource not found
rate_limit_exceededToo many requests
metadata_too_largeMetadata exceeds 4KB limit
project_not_assignedUser not assigned to the target project

Retry Strategy

For 429 responses, read the Retry-After header (in seconds) and wait before retrying. For 5xx responses, use exponential backoff starting at 1 second.

Both SDKs handle retries automatically with configurable limits:

// Node SDK
const keito = new Keito({
  apiKey: process.env.KEITO_API_KEY,
  maxRetries: 3,
  retryDelay: 1000,
});
# Python SDK
client = Keito(
    api_key=os.environ["KEITO_API_KEY"],
    max_retries=3,
    retry_delay=1.0,
)