Appearance
Authentication & tokens
Plemuz has four kinds of caller. Each signed-in kind is its own world with its own signing key and token audience, so a token from one world is refused in every other.
| Caller | How | Audience | Access token lifetime | Paths |
|---|---|---|---|---|
| Guest | No Authorization header | none | none | Public reads anywhere |
| User | POST /v1/auth/sign-in, /auth/verify-email, /auth/oidc | plemuz-app | 15 min | Everything except /v1/org and /v1/staff |
| Organization user | Organization sign-in | plemuz-org | 15 min | /v1/org/… only |
| Staff | POST /v1/staff/auth/login + MFA | plemuz-staff | 10 min | /v1/staff/… only |
| Realtime | Issued for a signed-in user | plemuz-realtime | 15 min | Socket.IO namespaces only |
Send tokens as Authorization: Bearer <token>. Access tokens are ES256 JWTs (typ: at+jwt, issuer https://api.plemuz.com). Public keys are at /.well-known/jwks.json, with kid rotation. Treat tokens as opaque in clients: they carry only who and which session, and everything else (roles, plan, verification tier) is read on each request.
Guests
No header means guest. Guests can browse the catalogue, search, view public profiles, open share links and hear 15-second previews. Anything personal answers 401 UNAUTHENTICATED with a sign_in action.
A bad token is not a guest
A header that doesn't verify is an error (AUTH_TOKEN_INVALID or AUTH_TOKEN_EXPIRED), never a silent fall back to the guest experience. Refresh and retry instead of dropping the header.
Users
- Sign up:
POST /auth/sign-upwith{ email, password }, thenPOST /auth/verify-emailwith the 6-digit code and yourdevice. The sign-up answer is the same whether or not the email exists, so accounts can't be discovered. - Sign in:
POST /auth/sign-inwith{ email, password, device }, orPOST /auth/oidcfor Google and Apple. - Result:
{ user, tokens: { accessToken, refreshToken, tokenType: "Bearer", expiresIn } }. - Refresh:
POST /auth/refreshwith{ refreshToken }. Refresh tokens rotate on every use; presenting an old one is treated as theft and ends the session. - Sign out:
POST /auth/sign-out(this session) or/auth/sign-out-everywhere. Sessions are checked on every request, so sign-out takes effect before the token expires. - Step-up: sensitive account and money changes ask for a fresh code (
POST /me/reauth-code); a refusal carriesAUTH_PROOF_REQUIRED.
The device object ({ key, platform, name?, appVersion? }) binds the session to an install. Messaging and calls need a registered device.
Creator profiles
Creators are users. One account can own several creator profiles (artist, DJ, producer, podcaster), managed through /me/profiles. Studio routes check the caller's studio role on the profile (owner, manager and others), read fresh on every request. See Studio.
Organizations
Labels and publishers sign in as organization users. Their tokens work only under /v1/org, and their role in the organization is read per request, so a role change applies at once.
Staff
Staff sign in at /v1/staff/auth/login and must complete MFA. Staff tokens last 10 minutes and work only under /v1/staff. Permissions such as catalog:moderate or payouts:approve are checked per route, and every staff action is written to the audit log. Some actions need a second person (ACCESS_SEPARATION_OF_DUTIES).
Realtime tokens
Sockets authenticate with a separate realtime token in the handshake (auth: { token }) and renew it on the open connection with auth:refresh. See Realtime.
Errors you'll see
| Code | Status | What to do |
|---|---|---|
UNAUTHENTICATED | 401 | Sign in. |
AUTH_TOKEN_EXPIRED | 401 | Refresh, then retry once (retryable: true). |
AUTH_TOKEN_INVALID | 401 | Sign in again. |
AUTH_REFRESH_INVALID | 401 | Sign in again. |
AUTH_INVALID_CREDENTIALS | 401 | Show the title; don't say which field was wrong. |
AUTH_TOO_MANY_ATTEMPTS | 429 | Wait (wait action). |
AUTH_ACCOUNT_DEACTIVATED | 403 | Offer reactivation. |
FORBIDDEN, ACCESS_DENIED | 403 | The caller is signed in but may not do this. |