Switch one notification channel on or off
const url = 'https://work.optidata.cloud/api/notifications/preferences';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"app_id":1,"notification_key":"drive.share.permission_created","channel":"email","is_enabled":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://work.optidata.cloud/api/notifications/preferences \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "app_id": 1, "notification_key": "drive.share.permission_created", "channel": "email", "is_enabled": false }'Enables or disables a single channel of a single notification. The response is deliberately minimal — the rest of the tree is unchanged, so there is nothing to resynchronise.
An app that does not expose notification preferences, or a notification
or channel the tenant cannot address, is rejected with 422 on the
matching field.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The app that emits the notification.
Locale used for any validation message.
Examples
{ "app_id": 1, "notification_key": "drive.share.permission_created", "channel": "email", "is_enabled": false}Responses
Section titled “ Responses ”The preference was stored.
Minimal acknowledgement returned by several write operations.
object
Example
{ "success": true}Missing, malformed or expired authentication key.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The request body or query string failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examples
{ "message": "The name field is required.", "errors": { "name": [ "The name field is required." ] }}Rate limit exceeded. Retry after the window resets.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "Too Many Attempts."}