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
| Field | Type | Required | Description |
|---|---|---|---|
| channel | "In App" | "Email" | "SMS" | "Push" | Yes | Delivery channel. |
| enabled | boolean | Yes | Whether the channel is on for the kind. |
| membership_id | string (uuid) | Yes | Identifier of the membership whose preference this is; preferences are per org. |
| category_code | string | Yes | Notification 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
| Field | Type | Required | Description |
|---|---|---|---|
| id | string (uuid) | Yes | Identifier of the notification preference. |
| created_at | string (date-time) | Yes | When the row was created. |
| updated_at | string (date-time) | Yes | When the row was last updated. |
| channel | "In App" | "Email" | "SMS" | "Push" | Yes | Delivery channel. |
| enabled | boolean | Yes | Whether the channel is on for the kind. |
| membership_id | string (uuid) | Yes | Identifier of the membership whose preference this is; preferences are per org. |
| category_code | string | Yes | Notification 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"}'