The envelope
code is stable and machine-readable. error is for humans and its wording may
change between releases — matching on it will break.
The distinctions worth handling
Several pairs share a status code but call for opposite responses. That is precisely why the codes exist.429 carries Retry-After. Honour the header rather than guessing. Rate limits
are keyed per key with a workspace-wide ceiling above them, so one noisy key
cannot starve the rest of a workspace.Retries, and the one code that means “you already did this”
conflict (409) is what an Idempotency-Key answers with when the retry is not
a retry:
A failed call does not hold its key: it delivered nothing and charged nothing, so
retrying it genuinely retries.
upstream_unavailable and rate_limited are the two codes worth retrying
unchanged. A failure to verify a credential against a store we could not reach
is reported as the former (with Retry-After), never as unauthorized — the
fault is ours and it clears.Validation detail
Aninvalid_request from a schema failure carries the field-level detail in
details, so you can point at the offending key rather than diffing your payload
against the reference by hand.