Authentication flow
- Sign up or login to obtain an access token
- Include the token in the
Authorizationheader for protected endpoints - The token expires after a set period (typically 24 hours)
Obtaining tokens
Sign up
Create a new user account and receive an access token:Login
Login with existing credentials:Using tokens
Include the access token in theAuthorization header for all protected endpoints:
JavaScript example
Token expiration
Access tokens expire after a configured period. When a token expires, you’ll receive a401 Unauthorized response. You need to login again to obtain a new token.
Authorization levels
The API supports role-based access control with the following roles:- user - Standard user with access to their own resources
- admin - Administrator with elevated permissions
- SUPER_ADMIN - Super administrator with full access
admin role.
Protected endpoints
All endpoints except/api/auth/signup and /api/auth/login require authentication. Some endpoints have additional role requirements:
DELETE /api/users/:id- Requiresadminrole- Artist management - Users can only manage their own active artists unless they’re an admin
Security best practices
- Never share your access tokens
- Store tokens securely (use environment variables or secure storage)
- Implement token refresh logic in your application
- Use HTTPS for all API requests
- Rotate passwords regularly