Skip to main content
When a call fails, the API answers with an error body. Read its code to learn what happened, and its retryable to learn whether to send the call again.

The error body

Errors use one envelope:
Branch on error.code and error.retryable, not on the status alone. One status can have several causes. A 503 can be a brief failure on our side, or a model this server will not serve.
  • retryable: true means a later attempt may succeed. It does not mean an earlier attempt did no work.
  • details names the rejected fields of a 422.
  • When the response has a Retry-After header, wait that long before you try again.
Retry an error only when its retryable is true, and send the same body with the same Idempotency-Key. Retries and idempotency explains when to retry, and how a key stops a call from running twice. Quote the X-Request-ID response header when you write to help@sqwish.ai about a call.

What does this status code mean?

A 422 also covers text that holds a NUL character or half of a UTF-16 surrogate pair. A string cut in the middle of an emoji can leave half a pair. A 504 doesn’t prove that the server stopped, or that nothing was charged. So save the Idempotency-Key before the first attempt, and resend the call with it (After a lost response).

Error codes

These codes each need handling of their own. Each row says what happened and what to do.