Preferences
The Preference system allows users to control which notifications they receive and through which channels. The PreferenceController at /api/v1/preferences manages per-user, per-channel notification preferences.
Get User Preferences
Endpoint: GET /api/v1/preferences/tenant/{tenantId}/user/{userId}
curl http://localhost:8085/api/v1/preferences/tenant/550e8400-e29b-41d4-a716-446655440000/user/user-001 \
-H "Authorization: Bearer ${TOKEN}"Response:
{
"tenantId": "550e8400-...",
"userId": "user-001",
"emailEnabled": true,
"smsEnabled": false,
"pushEnabled": true,
"slackEnabled": true,
"inAppEnabled": true,
"categories": {
"alerts": { "email": true, "push": true, "slack": true },
"reports": { "email": true, "push": false, "slack": false },
"billing": { "email": true, "push": false, "slack": false },
"marketing": { "email": false, "push": false, "slack": false }
},
"quietHours": {
"enabled": true,
"start": "22:00",
"end": "08:00",
"timezone": "America/New_York"
}
}Update Preferences
Endpoint: PUT /api/v1/preferences/tenant/{tenantId}/user/{userId}
curl -X PUT http://localhost:8085/api/v1/preferences/tenant/550e8400-e29b-41d4-a716-446655440000/user/user-001 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{
"emailEnabled": true,
"smsEnabled": false,
"pushEnabled": true,
"slackEnabled": true,
"inAppEnabled": true
}'Reset Preferences to Defaults
Endpoint: DELETE /api/v1/preferences/tenant/{tenantId}/user/{userId}
curl -X DELETE http://localhost:8085/api/v1/preferences/tenant/550e8400-e29b-41d4-a716-446655440000/user/user-001 \
-H "Authorization: Bearer ${TOKEN}"