detail field you can show to a person:
X-Error-Code response header with a stable, machine-readable code. Branch on that header, never on the detail text, which can change.
Status codes
Validation errors
A422 lists every invalid field, so you can fix them all at once:
loc gives where the problem is (query, path or body) and the field name.
Error codes
Retry strategy
Retry
Retry
429 and 5xx. Wait for Retry-After when present, otherwise back off exponentially (1 s, 2 s, 4 s…) and give up after a few attempts.Do not retry
Do not retry
400, 401, 403, 404, 409 and 422. The same request will fail again until you change it, the key, or the account.Writes that time out
Writes that time out
If a
POST times out, read the resource back before sending it again. Creating a prompt or launching an audit twice spends quota twice.