The Nudj Platform APIs support two authentication header schemes. Both are verified by the same tRPC auth middleware (Documentation Index
Fetch the complete documentation index at: https://docs.nudj.cx/llms.txt
Use this file to discover all available pages before exploring further.
apps/api/trpc/init.ts) and both work on every endpoint — pick whichever suits your client.
Authorization: Bearer <token>— the modern, revocable, RBAC-scoped path. Recommended for new integrations.x-api-token: <token>— the legacy alias. Still fully supported.
Bearer prefix from either header before verifying the signature, so the two paths are equivalent at the signature layer.
Authorization: Bearer
Recommended for new integrationsRBAC-scoped, per-token revocation. Jump to Authorization: Bearer.
x-api-token
Legacy aliasLong-lived JWT. Jump to x-api-token.
Authorization: Bearer
Bearer tokens are the modern auth path introduced across NUDJ-4411 / NUDJ-4819 / NUDJ-5354. They carry atype claim, support per-community RBAC scoping, and are verified against a revocation cache on every request — revoking one takes effect within seconds.
Get a Bearer token
Open Developer Settings
Generate a token
Click Generate New Token. Pick a role (Viewer / Moderator / Manager / Admin / SuperAdmin) and optionally scope it to a specific community.
Use in requests
Per-API support
| API | Authorization: Bearer | x-api-token | Declared in OpenAPI spec |
|---|---|---|---|
| Integration | ✅ | ✅ | Both |
| Admin | ✅ | ✅ | Both |
| Analytics | ✅ | ✅ (runtime) | Bearer only |
x-api-token
Get a token
Use the same Developer Settings page as above. Legacy tokens have notype claim and cannot be revoked individually — they remain valid until their expiry.
Use in requests
Bearer prefix on the value is accepted:
Revoke a Bearer token
Bearer tokens can be revoked individually via the Admin API:API base URLs
Each organisation has its own subdomain:{api-type} is one of admin, integration, or analytics.
| Organisation | Subdomain | Admin API URL |
|---|---|---|
| Development | nudjdev | https://nudjdev.nudj.cx/api/v2/admin |
| Staging | nudjstaging | https://nudjstaging.nudj.cx/api/v2/admin |
| Your Org | yourcompany | https://yourcompany.nudj.cx/api/v2/admin |
/domains endpoints.
Testing authentication
Error responses
401 Unauthorized
- Missing or invalid token
- Expired token
- Token issued for a different organisation than the subdomain being requested
- Incorrect header format
403 Forbidden
- Token lacks the required RBAC role
- Token scoped to a different community than the one the endpoint targets
- Endpoint requires a higher tier (admin vs moderator vs viewer)
Other headers you may need
| Header | Purpose | See |
|---|---|---|
x-language | Request translated response bodies in a specific locale | Internationalization |
x-user-access-token | User-level auth on embed/widget flows | API link user authentication |
x-admin-user-access-token | Per-user RBAC when proxying through the admin app | OAuth/SSO integration |
Security best practices
- Store in secret managers — use env vars or a secret store, never source control.
- Rotate regularly — especially when team members change.
- Scope minimally — use the least-privilege RBAC role the token actually needs.
- Revoke compromised Bearer tokens — don’t wait for them to expire.
- Use server-side requests only — the APIs are not CORS-enabled for browser origins.
Troubleshooting
Token is being rejected
Token is being rejected
- Verify no extra whitespace or line breaks.
- Confirm the token hasn’t been revoked.
- Ensure you’re hitting the correct subdomain — tokens are org-scoped.
Getting 404 errors
Getting 404 errors
- Verify the full path including
/api/v2/. - Check the API type (admin vs integration vs analytics).
- Confirm the endpoint exists in the API reference.
Local development not working
Local development not working
- API runs on
https://localhost:3000with a self-signed cert — use--insecureorNODE_TLS_REJECT_UNAUTHORIZED=0. - Confirm MongoDB is running and the org exists in the dev database.
Need user-linked authentication?
OAuth Integration
Configure OIDC so users can sign in via your existing auth provider.
API Link User Token
Auto-sign authenticated users into Nudj using JWT tokens.
Developer Settings
Access your API credentials and configuration.

