Skip to content

Create a notification preference

Platform module

POST/notification-preferencesnotificationPreferences.create

A per-kind, per-channel notification preference. Creates a notification preference. Requires `Idempotency-Key`; a replay returns the original response. The organization is derived from the credential or the parent row, never from the body.

  • Requires the capability me.notifications.write.
  • OAuth scopes: me.
  • Send an Idempotency-Key header. A replay with the same key returns the original response.
  • Error statuses: 400, 401, 409, 422, 429. Errors are RFC 9457 problem details.

Request body: NotificationPreferenceCreate

notificationPreferences.create: NotificationPreferenceCreate
FieldTypeRequiredDescription
channel"In App" | "Email" | "SMS" | "Push"YesDelivery channel.
enabledbooleanYesWhether the channel is on for the kind.
membership_idstring (uuid)YesIdentifier of the membership whose preference this is; preferences are per org.
category_codestringYesNotification category.Constraints: pattern ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$
{
  "channel": "In App",
  "enabled": true,
  "membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "category_code": "approvals"
}

Response 201: NotificationPreference

notificationPreferences.create: NotificationPreference
FieldTypeRequiredDescription
idstring (uuid)YesIdentifier of the notification preference.
created_atstring (date-time)YesWhen the row was created.
updated_atstring (date-time)YesWhen the row was last updated.
channel"In App" | "Email" | "SMS" | "Push"YesDelivery channel.
enabledbooleanYesWhether the channel is on for the kind.
membership_idstring (uuid)YesIdentifier of the membership whose preference this is; preferences are per org.
category_codestringYesNotification category.Constraints: pattern ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$
{
  "id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "created_at": "2026-10-08T14:30:00Z",
  "updated_at": "2026-10-08T14:30:00Z",
  "channel": "In App",
  "enabled": true,
  "membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "category_code": "approvals"
}

Code samples

curl -X POST "$XOS_BASE_URL/notification-preferences" \
  -H "Authorization: Bearer $XOS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"channel":"In App","enabled":true,"membership_id":"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f","category_code":"approvals"}'
const { data } = await xos.notificationPreferences.create({
    "channel": "In App",
    "enabled": true,
    "membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
    "category_code": "approvals"
  });
response = xos.notification_preferences.create({"channel": "In App", "enabled": True, "membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f", "category_code": "approvals"})
xos notification-preferences create --data '{"channel":"In App","enabled":true,"membership_id":"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f","category_code":"approvals"}'