Error Codes

Every error response from the Kwery API returns a consistent JSON body and an appropriate HTTP status code.

Error response format

{
  "error": "error_code",
  "message": "Human-readable description.",
  "required_tier": "pro",
  "upgrade_url": "https://kwery.xyz/pricing"
}

The required_tier and upgrade_url fields are only present on plan_required errors.

Rate limit responses

Rate-limited responses include a Retry-After header with the number of seconds to wait before retrying.

HTTP/1.1 429 Too Many Requests
Retry-After: 12
Content-Type: application/json

{
  "error": "rate_limit_exceeded",
  "message": "Rate limit exceeded. Retry after 12 seconds."
}

Reference table

HTTP StatusCodeDescriptionWhat to do
401invalid_api_keyMissing, malformed, or unknown keyCheck key, regenerate in Dashboard
401api_key_revokedKey revoked or expiredCreate new key
402credits_exhaustedMonthly credits depletedUpgrade or wait for reset
403account_suspendedAccount suspended/deletedContact support
403plan_requiredEndpoint/feature locked for your tierUpgrade plan
429rate_limit_exceededRPM or RPH exceededRespect Retry-After, implement backoff
400invalid_paramBad query parameterCheck values and docs
500internal_errorServer errorRetry with backoff

Handling errors

  1. Parse the error field to determine the error type programmatically.
  2. For 429 responses, always respect the Retry-After header and implement exponential backoff.
  3. For 402 responses, call GET /v1/limits with your key in the X-API-Key header (free, no credit cost) to check remaining credits.
  4. For 500 errors, retry up to 3 times with exponential backoff before alerting.