Skip to content

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.

CallerHowAudienceAccess token lifetimePaths
GuestNo Authorization headernonenonePublic reads anywhere
UserPOST /v1/auth/sign-in, /auth/verify-email, /auth/oidcplemuz-app15 minEverything except /v1/org and /v1/staff
Organization userOrganization sign-inplemuz-org15 min/v1/org/… only
StaffPOST /v1/staff/auth/login + MFAplemuz-staff10 min/v1/staff/… only
RealtimeIssued for a signed-in userplemuz-realtime15 minSocket.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-up with { email, password }, then POST /auth/verify-email with the 6-digit code and your device. The sign-up answer is the same whether or not the email exists, so accounts can't be discovered.
  • Sign in: POST /auth/sign-in with { email, password, device }, or POST /auth/oidc for Google and Apple.
  • Result: { user, tokens: { accessToken, refreshToken, tokenType: "Bearer", expiresIn } }.
  • Refresh: POST /auth/refresh with { 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 carries AUTH_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 ​

CodeStatusWhat to do
UNAUTHENTICATED401Sign in.
AUTH_TOKEN_EXPIRED401Refresh, then retry once (retryable: true).
AUTH_TOKEN_INVALID401Sign in again.
AUTH_REFRESH_INVALID401Sign in again.
AUTH_INVALID_CREDENTIALS401Show the title; don't say which field was wrong.
AUTH_TOO_MANY_ATTEMPTS429Wait (wait action).
AUTH_ACCOUNT_DEACTIVATED403Offer reactivation.
FORBIDDEN, ACCESS_DENIED403The caller is signed in but may not do this.

Plemuz API v2