Settings API
Settings API
User preferences and configuration key-value store.
Settings Scopes
Settings operate at different scopes with cascading resolution:
| Scope | Description | Permission |
|---|---|---|
system |
Server-wide defaults (read-only) | Requires restart to change |
global |
Shared across all tenants (tn_id=0) | Admin only |
tenant |
User-specific settings | Owner |
Permission Levels
| Level | Access |
|---|---|
system |
Non-changeable (compile-time) |
admin |
Requires SADM role |
user |
Any authenticated user |
Resolution Order
When retrieving a setting value, the system resolves in this order:
- Tenant-specific value (if exists)
- Global value (if exists)
- System default
Endpoints
List Settings
GET /api/settingsGet all settings for the authenticated user.
Authentication: Required
Response:
{
"data": [
["theme", "dark"],
["language", "en"],
["notifications", "true"]
]
}Get Setting
GET /api/settings/:nameGet a specific setting value.
Example:
const theme = await api.settings.name('theme').get()Update Setting
PUT /api/settings/:nameSet or update a setting value.
Request:
await api.settings.name('theme').put('dark')Usage
// Get all settings
const settings = await api.settings.get()
// Get specific setting
const theme = await api.settings.name('theme').get()
// Update setting
await api.settings.name('theme').put('light')
await api.settings.name('fontSize').put(16)
await api.settings.name('notifications').put(true)Common Settings
theme- UI theme preferencelanguage- User languagefontSize- Text sizenotifications- Enable/disable notificationsdarkMode- Dark mode preference