For the complete documentation index, see llms.txt. Any page on this site can be fetched as Markdown by appending .md to its URL.

Introduction

Error Handling

A consistent error envelope and HTTP status codes across the API.

The API uses conventional HTTP status codes and returns a consistent JSON error envelope so clients can handle failures programmatically.

Error envelope

Every error response has the same shape:

{
    "error": {
        "code": "VALIDATION_ERROR",
        "message": "A human-readable explanation of what went wrong.",
        "details": [{ "path": "body.name", "message": "Required" }]
    }
}
FieldDescription
error.codeA stable, machine-readable error code (see below).
error.messageA human-readable description. Do not parse this.
error.detailsOptional. Field-level issues, present for validation errors.

Branch on the HTTP status code and error.code — never on error.message.

Status codes

StatusMeaning
400 Bad RequestThe request was malformed.
401 UnauthorizedAuthentication is missing or invalid.
403 ForbiddenThe token is valid but not permitted to do this.
404 Not FoundThe resource does not exist.
409 ConflictThe request conflicts with the current state.
422 Unprocessable EntityThe request was understood but could not be processed.
429 Too Many RequestsYou have been rate limited; retry later.
500 Internal Server ErrorAn unexpected error occurred.
502 Bad GatewayAn upstream provider returned an error.
503 Service Unavailable / 504 Gateway TimeoutThe service was unavailable or timed out.

Error codes

CodeTypical status
VALIDATION_ERROR400 / 422
UNAUTHORIZED401
FORBIDDEN403
NOT_FOUND404
CONFLICT409
RATE_LIMITED429
INTERNAL_ERROR500
UPSTREAM_ERROR502 / 503 / 504

UPSTREAM_ERROR covers every upstream provider failure: a bad response (502), an unavailable service (503), and a gateway timeout (504). Branch on the HTTP status code when you need to tell these apart.

On this page