#Errors

All errors share a single response shape:

{
  "error": {
    "code":    "invalid_request",
    "message": "Field 'text' must be 1–32,000 characters.",
    "param":   "text",
    "request_id": "req_01HZQ7K8YV9X3R2M5N6P7QABCD"
  }
}
FieldDescription
codeStable, machine-readable identifier. Safe to switch on.
messageHuman-readable description. May change wording over time.
paramThe offending field, when applicable.
request_idInclude this when reporting issues.

#Status codes

StatusCodeWhenWhat to do
400invalid_requestRequired field missing, type mismatch, or value out of range.Fix the request body.
401unauthorizedMissing or invalid API key.Check Authorization header and rotate the key if compromised.
403forbiddenKey doesn't have access to this operation or resource.Verify the key's organisation and scope.
404not_foundThe requested resource (e.g. a stored summary by id) doesn't exist.Check the id; it may have been deleted.
409conflictIdempotency-Key reuse with a different request body.Either reuse the original body or pick a new key.
413payload_too_largeRequest body exceeds the operation's size limit.Split the input or trim it.
415unsupported_media_typeContent-Type is not application/json.Set Content-Type: application/json.
422unprocessableThe request is well-formed but the content can't be processed (e.g. unsupported language).See the message field.
429rate_limitedPer-key rate limit exceeded.Back off — see Rate limits.
500internal_errorAn unexpected error on our side.Retry with backoff. If it persists, report with the request_id.
502bad_gatewayTransient upstream issue.Retry with backoff.
503upstream_unavailableThe underlying model provider is temporarily unreachable.Retry with backoff.
504timeoutThe operation didn't complete within the allotted time.Retry; consider shortening the input.
Always log request_id

When you report an issue, include the request_id from the error response. It's the fastest way for us to find the request in our logs.