Access key authentication
The access key is the simplest way to authenticate. Set a key inconfig.yml under server.access_key, then pass it in every request as either a Bearer token or an X-Access-Key header. No registration or login step is required.
access_key_enabled: false in config.yml:
User account authentication
User accounts let multiple people access a MonoRelay instance with individual credentials. Each user logs in and receives a JWT token that they include in API requests.Register an account
Send aPOST request to /api/auth/register with a username, email address, and password. The password must be at least 8 characters.
The first user to register automatically becomes a super admin with full administrative privileges.
Log in
Send aPOST request to /api/auth/login with your username and password.
access_token in the response is a JWT that expires after 24 hours (expires_in is in seconds).
Use the token in API requests
Include the token in theAuthorization header as a Bearer token on every subsequent request.
Troubleshooting
401 Unauthorized
A401 Unauthorized response means the request either had no credentials or the credentials were rejected. Common causes: