Envelope
| Field | Description |
|---|---|
message | Free-text description. Safe to surface in developer-facing logs. Don’t surface verbatim to end users — messages aren’t localised. |
code | Stable tRPC error code — e.g. UNAUTHORIZED, FORBIDDEN, NOT_FOUND, BAD_REQUEST, INTERNAL_SERVER_ERROR. |
data.httpStatus | The HTTP status code of the response. Mirrors the response status line. |
data.path | Name of the endpoint procedure that rejected the request. Useful for log correlation. |
Common status codes
400 — BAD_REQUEST
Zod validation failure on the request body, a path/query parameter, or a required header.
message — it names the offending field. Re-check your request shape against the endpoint’s schema.
401 — UNAUTHORIZED
Token missing, malformed, expired, or issued for a different organisation’s subdomain.
403 — FORBIDDEN
Token is valid but lacks the RBAC permissions for the requested action. Most common on Admin endpoints.
404 — NOT_FOUND
No entity matches the request — wrong id, wrong organisation, or the entity has been deleted.
409 — CONFLICT
The request would break a uniqueness constraint or violates current state (e.g. trying to claim a reward already claimed, re-use a one-time code, or register a duplicate domain).
500 — INTERNAL_SERVER_ERROR
An unexpected runtime error. The response body surfaces the tRPC code but the detailed stack trace is logged server-side and not returned.
Response-validation errors can also surface as 500. If the API returns data that fails its own output schema (historically this has happened on a few integration endpoints when new enum values are rolled out), clients receive a generic 500 rather than a typed failure. If you consistently hit a 500 on a previously-working endpoint, file a bug — it’s very likely a schema regression rather than a runtime fault.
Client handling pattern
Retries
The APIs don’t emitRetry-After headers, but 5xx responses (500, 502, 503) are always safe to retry with exponential backoff. Do not blindly retry 4xx — those are request-shape errors and will fail identically a second time.
Related
Authentication
401 and 403 scenarios in depth.
Pagination
Common 400 errors on list endpoints.

