Skip to main content

API error codes and HTTP status mapping

Every EvalGate error code, its HTTP status, what it means, and how to handle errors in TypeScript and Python with try/catch examples.
When a request fails, EvalGate always returns a JSON object in the same envelope shape — regardless of the HTTP status code. Parsing this envelope lets you handle every error class in a single place.

Error envelope

Every error response has this structure:
string
A machine-readable constant identifying the error class. Use this field for programmatic error handling — never parse message.
string
A human-readable description of what went wrong. Suitable for logs and development debugging; do not display this to end users without filtering.
unknown | null
Optional additional context. For VALIDATION_ERROR, this contains a Zod issues array describing which fields failed and why. null for all other codes.
string
A UUID that uniquely identifies the request on EvalGate’s servers. Include this value in any support ticket — the team can use it to locate the exact request in logs. The same UUID appears in the x-request-id response header.

Error codes and HTTP status mapping

QUOTA_EXCEEDED and NO_ORG_MEMBERSHIP both map to HTTP 403. Distinguish them by the code field, not the status code.

Handling errors in code

When retrying after a 429 RATE_LIMITED response, read the X-RateLimit-Reset header to determine the exact time the window resets, rather than using a fixed sleep duration. The TypeScript SDK handles this automatically with exponential backoff.