The error envelope
Every non-2xx response uses the same shape. Onlyerror is always present; the remaining
fields appear when they add something useful.
string
A stable machine-readable code, for example
insufficient_scope. Branch on this, not on
the human-readable text.string
A human-readable explanation, safe to log.
string
A shorter human-readable summary, present on some responses.
object
Additional structured context — for validation failures, typically the offending fields.
string
On
403, the scope this endpoint needs.array
On
403, the scopes your token actually holds.Status codes
A
404 does not always mean the record is absent — responses are scoped to what the
acting user may see, so a record outside their permissions is indistinguishable from one
that does not exist.Worked examples
404 Tenant Unknown — before you get any further
404 Tenant Unknown — before you get any further
A plain-text
Tenant Unknown body, rather than the JSON envelope above, means the request
never reached the API. The zivio-tenant-id header is missing or does not match a Zivio
organisation, and it is checked before your token is.Your token and scopes are not the problem here. See
Identifying your organisation.401 — expired token
401 — expired token
401 means the credentials
or the Authorization header are wrong, not the token’s age.403 — missing scope
403 — missing scope
projects:read. See
Scopes.422 — wrong state for the action
422 — wrong state for the action
Workflow endpoints reject actions that do not apply to the record’s current state. For
example, submitting a project that is not in
draft, or one that fails publish
validation.Some 422 responses are actionable rather than fatal: POST /projects/{id}/submit
returns error: approver_selection_required together with an approver_selection array
listing each step’s eligible approvers, so you can re-submit with approvers populated.Handling errors well
- Branch on the
errorcode, never onerror_descriptionwording. - Retry
401once after refreshing the token. Do not retry403or422— they need a different token or a different payload. - Log
error,error_descriptionanddetailstogether;detailsusually names the exact field at fault.

