Overview
The Settings API provides endpoints for managing user account settings including profile information, password changes, currency/language preferences, and AI feature toggles.All settings endpoints require session-based authentication and operate on the authenticated user’s account.
Authentication
All endpoints require session-based authentication via the@api_login_required decorator.
Update Profile
Update the user’s display name. Endpoint:POST /api/settings/profile
Request Body
The user’s full name. Cannot be empty.
Example Request
Response
Error Responses
400 - Empty Name
400 - Empty Name
500 - Server Error
500 - Server Error
Update Password
Change the user’s password with current password verification. Endpoint:POST /api/settings/password
Request Body
The user’s current password for verification
The new password
Confirmation of the new password (must match
newPassword)Example Request
Response
Error Responses
400 - Missing Fields
400 - Missing Fields
400 - Password Mismatch
400 - Password Mismatch
401 - Incorrect Current Password
401 - Incorrect Current Password
Update Preferences
Update currency and language preferences. Endpoint:POST /api/settings/preferences
Request Body
Currency code (e.g., “VND”, “USD”, “EUR”)
Language code (e.g., “vi”, “en”)
Example Request
Response
Update AI Settings
Enable or disable AI-powered features including transaction categorization and dashboard insights. Endpoint:POST /api/settings/ai
Request Body
True to enable AI features, false to disable
Example Request
Response
Impact of AI Settings
When AI suggestions are disabled (ai_suggestions=0):
- The
/api/dashboard-insightsendpoint returns a disabled status - AI-powered transaction categorization may be restricted
- Chatbot functionality may be limited
The AI settings are stored as an integer in the database:
1 for enabled, 0 for disabled. The API converts the boolean true/false values to 1/0 automatically.Implementation Reference
The Settings API is implemented inapp/routes/settings.py:
settings.py
Database Schema
User settings are stored in thethietlapnguoidung table:
models.py
Related Endpoints
- Authentication API - Password changes require current password verification
- AI Services API - AI features can be toggled via settings
- User Guide - User-facing settings documentation
