POST /api/auth/login
Authenticates a user with their username and password credentials. Supports two-factor authentication (TOTP) when enabled for the user.Request Body
The user’s username (trimmed, minimum 1 character)
The user’s password (trimmed, minimum 1 character)
TOTP code for two-factor authentication. Required if the user has TOTP enabled and this is a second login request.
Headers
Optional client identifier for tracking the source of the request
Response
The authenticated user object (only returned on successful login)
Indicates that TOTP is enabled for this user. When
true, the client should prompt for a TOTP code and make a second request with the code parameter.Rate Limiting
This endpoint is rate limited to 2 requests per second.Authentication Flow
- Initial request: Send username and password
- TOTP enabled: If the user has TOTP enabled, the response will be
{ "totp": true } - Second request: Make another request with the same credentials plus the
codeparameter - Success: Returns the user object and establishes a session
Error Responses
400 Bad Request- Invalid username or password400 Bad Request- Invalid code (when TOTP code is incorrect)429 Too Many Requests- Rate limit exceeded