Update Notification Settings
Updates the notification settings of the platform.
HTTP Request
PATCH/api/settings/notifications
Authorization
Authorization
- Required: Yes
- Permission: Staff or Admin
- Authentication: Token authentication
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| notifications_sms_notifier | Integer | No | ID of the SMS notifier to use (nullable) - `PATCH` request body must include this field |
| notifications_sms_notifier_data | Object | No | SMS notifier details with `id` and `name` fields - `GET` request will return this field |
| notifications_email_notifier | Integer | No | ID of the email notifier to use (nullable) - `PATCH` request body must include this field |
| notifications_email_notifier_data | Object | No | Email notifier details with `id` and `name` fields - `GET` request will return this field |
| notifications_otp_code_len | Integer | No | Length of OTP codes (default: 5) |
| notifications_otp_ttl | Integer | No | OTP code time-to-live in seconds (default: 120) |
Notifier Data Object Structure
Both notifications_sms_notifier_data and notifications_email_notifier_data contain:
| Field | Type | Required | Description |
|---|---|---|---|
| id | Integer | No | Notifier ID |
| name | String | No | Notifier display name |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Update notification settings
4response = requests.patch('http://www.example.com/api/settings/notifications',
5 headers={'Authorization': 'Token <your_api_key>'},
6 json={
7 "notifications_sms_notifier": 1,
8 "notifications_email_notifier": 2,
9 "notifications_otp_code_len": 6,
10 "notifications_otp_ttl": 180,
11 "notifications_sms_notifier_data": {
12 "id": 1,
13 "name": "Twilio SMS"
14 },
15 "notifications_email_notifier_data": {
16 "id": 2,
17 "name": "SendGrid Email"
18 }
19 }
20)
21print(response.json())1# Update notification settings
2curl -X PATCH "http://www.example.com/api/settings/notifications" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
3 "notifications_sms_notifier": 1,
4 "notifications_email_notifier": 2,
5 "notifications_otp_code_len": 6,
6 "notifications_otp_ttl": 180,
7 "notifications_sms_notifier_data": {"id": 1, "name": "Twilio SMS"},
8 "notifications_email_notifier_data": {"id": 2, "name": "SendGrid Email"}
9}'Status Codes
| Code | Description |
|---|---|
| 200 | Request logs retrieved successfully |
| 400 | Bad request — invalid query parameters |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| notifications_sms_notifier | Integer | ID of the SMS notifier to use (nullable) - `PATCH` request body must include this field |
| notifications_sms_notifier_data | Object | SMS notifier details with `id` and `name` fields - `GET` request will return this field |
| notifications_email_notifier | Integer | ID of the email notifier to use (nullable) - `PATCH` request body must include this field |
| notifications_email_notifier_data | Object | Email notifier details with `id` and `name` fields - `GET` request will return this field |
| notifications_otp_code_len | Integer | Length of OTP codes (default: 5) |
| notifications_otp_ttl | Integer | OTP code time-to-live in seconds (default: 120) |
Notifier Data Object Structure
Both notifications_sms_notifier_data and notifications_email_notifier_data contain:
| Field | Type | Description |
|---|---|---|
| id | Integer | Notifier ID |
| name | String | Notifier display name |