User Management API Documentation
Base Path
/user
Endpoints
User Login
Request Body
{
username: string, // Username
password: string // Password
}
Note
- Rate limit: 100 requests per 15 minutes
User Logout
Update User Information
Request Body
{
username: string, // Username
password: string // Password
}
Get User Information
Two-Factor Authentication
Initialize Two-Factor
Activate Two-Factor
Request Body
{
code: string // Verification code
}
Deactivate Two-Factor
PUT /two-factor/deactivate
Two-Factor Login
Request Body
{
code: string, // Verification code
username: string, // Username
password: string // Password
}
Two-factor login is limited to 20 requests per 15 minutes.
Login Log
IP Blacklist
Use GET /ip-blacklist to list blocked addresses, PUT /ip-blacklist to block an address, and DELETE /ip-blacklist to unblock it. PUT and DELETE take a JSON body:
ip is required and accepts a single IPv4 or IPv6 address. CIDR ranges are not accepted.
Notification Settings
Get Notification Settings
Update Notification Settings
Initialization
Initialize User Information
Request Body
{
username: string, // Username
password: string // Password
}
Initialize Notification Settings
Update Avatar
Request Body
- Content-Type:
multipart/form-data
- Field:
avatar (file)
- One file, at most 5 MiB. Supports PNG, JPEG, GIF, WebP and AVIF; the extension must match the MIME type.
Error Handling
- All endpoints follow unified error handling mechanism
- Successful responses return
{ code: 200, data: ... }
- Error logging is handled by Winston logger
Notes
- Parameter validation using celebrate/Joi
- File uploads handled by multer
- Avatar filenames generated using UUID
- Some features are restricted in demo environment