IsraelGPT API Docs Get an API key

Errors

Every non-200 response follows the same shape, so you can handle errors generically and branch on code only when you need to.

Shape

{
  "error": {
    "code": "invalid_request",
    "message": "\"messages\" must be a non-empty array.",
    "retry_after_seconds": 12
  }
}

retry_after_seconds is only present on 429. message is meant for a developer reading logs, not for showing to an end user verbatim.

Reference

StatuscodeMeaningRetry?
400invalid_jsonRequest body isn’t valid JSONFix the request, then retry
400invalid_requestA field failed validation (bad type, out-of-range value, empty messages array, etc.) — see message for which oneFix the request, then retry
401missing_api_keyNo Authorization header presentAdd the header, then retry
401invalid_api_keyKey not recognized or has been revokedCheck the key in your dashboard
429rate_limitedPer-key rate limit hitWait retry_after_seconds, then retry
502upstream_unavailableBoth the primary and fallback models failed to respondSafe to retry immediately or with light backoff
503capacity_exceededAccount-wide capacity safeguard is active (see Rate Limits)Retry after a short backoff

What doesn't produce an error

A request that gets safety-intercepted (crisis language, disallowed content) is not an error — it's a normal 200 response with flags.crisis or flags.blocked set and a fixed message in reply. See API Reference. Treat a non-200 status strictly as "something about the request or the service itself failed," not as a content-moderation signal.

5xx vs 4xx

4xx errors mean something about your request needs to change before retrying (bad auth, bad body, rate limit). 5xx errors (502, 503) mean the problem is on the service side and the same request may well succeed on retry — safe to build simple retry logic around, see Examples.