Skip to main content
Every Nudj API endpoint uses the same error envelope — the tRPC wire format — so clients can share a single error handler across all three APIs.

Envelope

Common status codes

400 — BAD_REQUEST

Zod validation failure on the request body, a path/query parameter, or a required header.
Fix: read the 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.
Fix: see Authentication troubleshooting.

403 — FORBIDDEN

Token is valid but lacks the RBAC permissions for the requested action. Most common on Admin endpoints.
Fix: raise the token’s role (if appropriate), or narrow the request to a community the token has access to.

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 emit Retry-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.

Authentication

401 and 403 scenarios in depth.

Pagination

Common 400 errors on list endpoints.