API Reference

Errors

Error response format, status codes, rate limits, and retry guidance

Every API error response uses this envelope:

{
  "error": {
    "type": "validation_error",
    "code": "missing_document_url",
    "message": "document_url is required and must be a string",
    "request_id": "req_abc123def456"
  }
}

Error Types

TypeStatusMeaning
authentication_error401Missing, invalid, expired, or revoked key
authorization_error403Key is valid but lacks the required scope
validation_error400Invalid body, path, query, or idempotency use
not_found404Resource does not exist for the organization
billing_error402Live billing or live usage gate blocked
precondition_error428Required legal or setup precondition missing
rate_limit_error429Per-key rate limit exceeded
internal_error500Unexpected Klarefi server error

Rate Limits

Authenticated success responses include:

HeaderDescription
X-RateLimit-LimitMaximum requests per minute
X-RateLimit-RemainingRemaining requests in the window
X-RateLimit-ResetEpoch seconds when the window resets

When the limit is exceeded, Klarefi returns 429 rate_limit_error and may include Retry-After.

Retry Guidance

Retry 429 responses after the rate-limit reset. Retry network failures with the same idempotency key. Do not blindly retry 400, 401, 403, 404, 402, or 428 responses; those require a request or account-state change.

On this page