Error Reference

Complete reference for all error codes, HTTP status codes, and troubleshooting steps for Cencori API errors.

Error Response Format

All errors follow a consistent JSON format:

error-response.json

HTTP Status Codes

StatusMeaningTypical Cause
200OKRequest succeeded
400Bad RequestInvalid parameters or malformed request
401UnauthorizedMissing or invalid API key
403ForbiddenSecurity violation or tier restriction
404Not FoundResource doesn't exist
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer-side error
503Service UnavailableProvider is down or overloaded

Common Error Codes

INVALID_API_KEY

401

The provided API key is invalid, expired, or revoked.

Solutions:

  • Verify the key is correct
  • Check if the key has been revoked
  • Generate a new key from the dashboard
  • Ensure no whitespace in the key

SECURITY_VIOLATION

403

Request blocked due to security filters (PII detection, prompt injection, harmful content).

Solutions:

  • Review incident in dashboard for details
  • Remove sensitive data from request
  • Sanitize user input before sending
  • Check for prompt injection patterns

RATE_LIMIT_EXCEEDED

429

Too many requests in a short time period.

Solutions:

  • Implement exponential backoff
  • Check rate limit headers
  • Upgrade your tier for higher limits
  • Batch requests where possible

INSUFFICIENT_CREDITS

403

Your organization has run out of credits.

Solutions:

  • Top up credits in dashboard
  • Enable auto-recharge
  • Monitor credit balance

TIER_RESTRICTED

403

The requested feature or provider requires a paid subscription.

Solutions:

  • Upgrade to a paid tier
  • Use Gemini models (free tier)
  • Contact sales for enterprise access

INVALID_MODEL

400

The specified model is not supported or doesn't exist.

Solutions:

PROVIDER_ERROR

503

The AI provider (OpenAI, Anthropic, etc.) returned an error or is unavailable.

Solutions:

  • Retry after a short delay
  • Try a different provider/model
  • Check provider status pages
  • Report persistent issues to support

Error Handling Best Practices

error-handling.ts

Rate Limit Headers

When rate limited, check these response headers:

HeaderDescription
X-RateLimit-LimitMaximum requests per time window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when limit resets
Retry-AfterSeconds to wait before retrying