Skip to main content

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

FieldTypeRequiredDescription
notifications_sms_notifierIntegerNoID of the SMS notifier to use (nullable) - `PATCH` request body must include this field
notifications_sms_notifier_dataObjectNoSMS notifier details with `id` and `name` fields - `GET` request will return this field
notifications_email_notifierIntegerNoID of the email notifier to use (nullable) - `PATCH` request body must include this field
notifications_email_notifier_dataObjectNoEmail notifier details with `id` and `name` fields - `GET` request will return this field
notifications_otp_code_lenIntegerNoLength of OTP codes (default: 5)
notifications_otp_ttlIntegerNoOTP code time-to-live in seconds (default: 120)

Notifier Data Object Structure Both notifications_sms_notifier_data and notifications_email_notifier_data contain:

FieldTypeRequiredDescription
idIntegerNoNotifier ID
nameStringNoNotifier display name

Example Requests

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())

Status Codes

CodeDescription
200Request logs retrieved successfully
400Bad request — invalid query parameters
401Unauthorized — authentication required
403Forbidden — insufficient permissions
500Internal server error

Response Fields

FieldTypeDescription
notifications_sms_notifierIntegerID of the SMS notifier to use (nullable) - `PATCH` request body must include this field
notifications_sms_notifier_dataObjectSMS notifier details with `id` and `name` fields - `GET` request will return this field
notifications_email_notifierIntegerID of the email notifier to use (nullable) - `PATCH` request body must include this field
notifications_email_notifier_dataObjectEmail notifier details with `id` and `name` fields - `GET` request will return this field
notifications_otp_code_lenIntegerLength of OTP codes (default: 5)
notifications_otp_ttlIntegerOTP code time-to-live in seconds (default: 120)

Notifier Data Object Structure

Both notifications_sms_notifier_data and notifications_email_notifier_data contain:

FieldTypeDescription
idIntegerNotifier ID
nameStringNotifier display name