Protocol
Failures should change behavior
Treat HTTP status and the stable error category as control flow. Human-readable messages are for diagnostics and can improve without becoming part of an integration contract.
Authentication and authority
401means the credential is missing, malformed, expired, or revoked. Stop and obtain a valid key.403means the credential is valid but the operation or required scope is unavailable. Do not retry unchanged.404on a/v1/workspaces/{workspaceSlug}/…route whose workspace the credential cannot reach means the address is wrong, not that a scope is missing: check that the path carries the workspace slug fromGET /v1/whoami, not its id. A scope is named in a403only for a workspace the credential reaches.402is an account or workspace billing boundary. Surface the billing action to the responsible payer rather than rotating credentials.
The stable 402 code identifies which boundary stopped the request. subscription_required means
the account lacks a current entitlement. workspace_paused means an authorized data-plane request
reached a paused workspace and can proceed after the workspace is resumed by paying. Model requests
use subscription_inactive when that same workspace-servicing state blocks the model gateway; it is
not an account-entitlement code.
Incomplete workspace setup
409 onboarding_required is a lifecycle refusal, not a missing capability or expired login.
Follow its onboardingUrl through the workspace onboarding handoff.
Wait for the owner to complete setup, then reread workspace state before retrying. Do not use a
generic conflict retry loop or replace a valid key to get around onboarding.
Workspace availability
503 {"error":"workspace_vm_unavailable"} means the workspace exists but its machine is not
answering yet, for example while it restarts after an update. It usually clears within a minute
or two. Retry with bounded backoff; nothing on your side needs to change. A workspace that stays
unreachable becomes 503 {"error":"workspace_unhealthy"}, which waiting alone does not resolve.
Collection cursors
400 {"error":"invalid_cursor"} means an opaque collection cursor is malformed or belongs to a
different workspace, filter set, ordering, or collection. Restart the walk without that cursor;
retrying the same value cannot make progress. Other malformed query inputs remain
400 {"error":"invalid_request"}.
Backpressure
The general authenticated API ceiling returns 429 with both a Retry-After header and the stable
body below. Wait for that interval, add bounded jitter, and preserve the original operation's retry
safety. A faster retry loop only consumes more refused requests in the same fixed window.
{
"error": "rate_limited",
"retryAfterSeconds": 42
}An operation may also declare a stricter, purpose-built limit with its own error body or headers.
Follow that endpoint's reference in addition to the general ceiling; do not assume every 429 has
the general shape.
Unknown failures
For 5xx and network failures, retain the request correlation information your client has, use
bounded exponential backoff, and check whether the operation declares idempotent behavior before
replaying a write. Never parse a proxy-generated HTML error as the API's JSON schema.