Overview
The Users API allows you to manage user accounts, preferences, plugins, and account deletion.
All user endpoints are prefixed with /api/user.
Get User Info
Retrieve current user information:
GET /api/user
Authorization: Bearer <token>
Response
User role (e.g., user, admin)
Account creation timestamp
{
"id": "user123",
"email": "[email protected]",
"name": "John Doe",
"username": "johndoe",
"role": "user",
"avatar": "/avatars/user123.png",
"provider": "local",
"createdAt": "2024-01-01T00:00:00Z"
}
Update User Plugins
Update user plugin preferences:
POST /api/user/plugins
Authorization: Bearer <token>
Content-Type: application/json
{
"plugins": [
"web-search",
"calculator"
]
}
Request Body
Array of enabled plugin identifiers
Response
Returns the updated user object with plugin preferences.
Delete User Account
Permanently delete the user account and all associated data:
DELETE /api/user/delete
Authorization: Bearer <token>
Response
{
"message": "User account deleted successfully"
}
This endpoint:
- Requires the user to have account deletion permissions (configurable)
- Deletes all conversations, messages, files, and settings
- Cannot be undone
Email Verification
Verify Email
Verify email address with token from verification email:
POST /api/user/verify
Content-Type: application/json
{
"userId": "user123",
"token": "verification-token"
}
User ID from verification email
Verification token from email
Response
{
"message": "Email verified successfully"
}
Resend Verification Email
Request a new verification email:
POST /api/user/verify/resend
Content-Type: application/json
{
"email": "[email protected]"
}
Email address to send verification to
Note: This endpoint has rate limiting to prevent abuse.
Terms of Service
Get Terms Status
Check if user has accepted current terms:
GET /api/user/terms
Authorization: Bearer <token>
Response
Whether user has accepted current terms
Version of terms accepted
{
"termsAccepted": true,
"termsVersion": "1.0",
"acceptedAt": "2024-01-01T00:00:00Z"
}
Accept Terms
Accept terms of service:
POST /api/user/terms/accept
Authorization: Bearer <token>
Response
{
"message": "Terms accepted",
"termsAccepted": true
}
User Settings
User-specific settings are managed through the /api/user/settings endpoints.
See the settings routes for detailed documentation on:
- Theme preferences
- Language settings
- Notification preferences
- Display options
Account Balance
Get user account balance (for credit-based systems):
GET /api/balance
Authorization: Bearer <token>
Response
{
"balance": 100.00,
"currency": "USD",
"tokenBalance": 50000
}
User Avatar
Upload or update user avatar:
POST /api/files/images/avatar
Authorization: Bearer <token>
Content-Type: multipart/form-data
--boundary
Content-Disposition: form-data; name="file"; filename="avatar.png"
Content-Type: image/png
[binary image data]
--boundary--
Request
Image file (PNG, JPEG, WebP)
Response
{
"url": "/avatars/user123.png",
"filepath": "/uploads/avatars/user123.png"
}
Error Responses
Unauthorized
{
"error": "Unauthorized",
"message": "You must be logged in to access this resource"
}
HTTP Status: 401
Account Deletion Disabled
{
"error": "Forbidden",
"message": "Account deletion is disabled"
}
HTTP Status: 403
Invalid Verification Token
{
"error": "Invalid or expired verification token"
}
HTTP Status: 400
Rate Limited
{
"error": "Too many requests",
"message": "Please wait before requesting another verification email"
}
HTTP Status: 429
TypeScript Types
import type { TUser } from 'librechat-data-provider';
interface TUser {
id: string;
email: string;
name: string;
username?: string;
role: string;
avatar?: string;
provider?: string;
plugins?: string[];
createdAt: string;
emailVerified?: boolean;
termsAccepted?: boolean;
}