Settings API
The Settings API manages system configuration, feature flags, and organizational settings.
Overview
| Procedure | Type | Auth | Description |
|---|---|---|---|
settings.getAll | Query | Yes | Get all settings |
settings.getByCategory | Query | Yes | Get settings by category |
settings.update | Mutation | Admin | Update settings |
settings.reset | Mutation | Admin | Reset to defaults |
settings.getPublic | Query | No | Get public settings |
settings.getFeatureFlags | Query | No | Get feature flags |
Settings Categories
| Category | Description |
|---|---|
general | General application settings |
email | Email/SMTP configuration |
notifications | Notification preferences |
map | Map display settings |
retention | Data retention policies |
security | Security settings |
Procedures
settings.getAll
Get all settings grouped by category.
Type: Query Auth Required: Yes
Response
typescript
{
general: {
language: string;
theme: string;
siteName: string;
timezone: string;
dateFormat: string;
timeFormat: string;
maintenanceMode: boolean;
logo: string | null;
favicon: string | null;
};
email: {
smtpServer: string;
smtpPort: number;
smtpUser: string;
smtpPassword: string;
smtpSecure: boolean;
emailFrom: string;
emailFooter: string;
};
notifications: {
emailNotifications: boolean;
pushNotifications: boolean;
smsNotifications: boolean;
};
map: {
defaultZoom: number;
defaultLat: number;
defaultLng: number;
mapboxToken: string;
};
retention: {
eventRetentionDays: number;
logRetentionDays: number;
};
security: {
sessionTimeout: number;
maxLoginAttempts: number;
lockoutDuration: number;
mfaEnabled: boolean;
};
}Example
bash
curl -X GET "https://api.itms.solutions/trpc/settings.getAll" \
-H "Authorization: Bearer YOUR_TOKEN"settings.getByCategory
Get settings for a specific category.
Type: Query Auth Required: Yes
Input
typescript
{
category: "general" | "email" | "notifications" | "map" | "retention" | "security";
}settings.update
Update settings (admin only).
Type: Mutation Auth Required: Admin
Input
typescript
{
general?: {
language?: string;
theme?: string;
siteName?: string;
timezone?: string;
dateFormat?: string;
timeFormat?: string;
maintenanceMode?: boolean;
logo?: string;
favicon?: string;
};
email?: {
smtpServer?: string;
smtpPort?: number;
smtpUser?: string;
smtpPassword?: string;
smtpSecure?: boolean;
emailFrom?: string;
emailFooter?: string;
};
notifications?: {
emailNotifications?: boolean;
pushNotifications?: boolean;
smsNotifications?: boolean;
};
map?: {
defaultZoom?: number;
defaultLat?: number;
defaultLng?: number;
mapboxToken?: string;
};
retention?: {
eventRetentionDays?: number;
logRetentionDays?: number;
};
}Response
typescript
{
success: boolean;
}Example
bash
curl -X POST "https://api.itms.solutions/trpc/settings.update" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-d '{
"json": {
"general": {
"siteName": "My Traffic System",
"timezone": "Europe/London"
}
}
}'settings.reset
Reset settings to defaults (admin only).
Type: Mutation Auth Required: Admin
Input
typescript
{
category?: "general" | "email" | "notifications" | "map" | "retention" | "security";
// If not specified, resets all settings
}settings.getPublic
Get public settings for frontend configuration. No authentication required.
Type: Query Auth Required: No
Response
typescript
{
siteName: string;
language: string;
theme: string;
timezone: string;
dateFormat: string;
timeFormat: string;
maintenanceMode: boolean;
logo: string | null;
favicon: string | null;
defaultZoom: number;
defaultLat: number;
defaultLng: number;
}Example
bash
curl -X GET "https://api.itms.solutions/trpc/settings.getPublic"settings.getFeatureFlags
Get feature flags for the application.
Type: Query Auth Required: No
Response
typescript
{
dashboard: { enabled: boolean; description: string };
sensors: { enabled: boolean; description: string };
reports: { enabled: boolean; description: string };
analytics: { enabled: boolean; description: string };
incidents: { enabled: boolean; description: string };
traffic: { enabled: boolean; description: string };
locations: { enabled: boolean; description: string };
users: { enabled: boolean; description: string };
settings: { enabled: boolean; description: string };
realtime: { enabled: boolean; description: string };
}Default Values
General Settings
| Setting | Default | Description |
|---|---|---|
language | en | UI language |
theme | light | Color theme |
siteName | Smart City TVMS | Application name |
timezone | Asia/Almaty | Default timezone |
dateFormat | DD/MM/YYYY | Date format |
timeFormat | 24h | Time format |
maintenanceMode | false | Maintenance mode |
Email Settings
| Setting | Default | Description |
|---|---|---|
smtpPort | 587 | SMTP port |
smtpSecure | true | Use TLS |
emailFrom | noreply@itms.solutions | Sender email |
Map Settings
| Setting | Default | Description |
|---|---|---|
defaultZoom | 12 | Default map zoom |
defaultLat | 43.238949 | Default latitude (Almaty) |
defaultLng | 76.945465 | Default longitude |
Retention Settings
| Setting | Default | Description |
|---|---|---|
eventRetentionDays | 90 | Days to keep events |
logRetentionDays | 30 | Days to keep logs |
Security Settings
| Setting | Default | Description |
|---|---|---|
sessionTimeout | 24 | Session timeout (hours) |
maxLoginAttempts | 5 | Max failed logins |
lockoutDuration | 30 | Lockout duration (minutes) |
mfaEnabled | false | Multi-factor auth |