> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Notification Preferences

> Set the authenticated user's disabled push notification types

Upserts the acting user's push notification preferences. The request **replaces** the whole disabled-types set — send the complete set you want stored, not a delta. Duplicates are collapsed; only valid event type names are accepted.

Requires authentication. **Acting-user-scoped:** an end-user token (`Authorization: Bearer <accessToken>`) writes its own preferences. A service key acts on behalf of a named user via the optional body `userId` — a service key without `userId` is rejected, and an end-user token may not name a different user. Requires the `push` bundle.

## Body Parameters

**disabledTypes** `string[]` *required*

The complete set of event types to disable for push. Each value must be one of the server's exact event type names (see the [event palette](https://docs.sublay.io/v7/notification-preferences.md#the-event-palette)) — unknown names are rejected. Pass `[]` to re-enable everything (all-on).

**userId** `string`

The acting user whose preferences are written. **Service keys only** — a service key must pass it; an end-user token infers it from the auth token and may not name a different user.

## Response

Returns `200` with the stored set (deduplicated).

```json theme={null}
{ "disabledTypes": ["comment-mention"] }
```

## Error Responses

> [accordion] No Credential — 401
>
> Plain-text `Unauthorized`, with no JSON body and no `code`. Returned when the
> request carries no `Authorization` header at all.

> [accordion] Rejected Credential — 403
>
> Plain-text `Forbidden`, with no JSON body and no `code`. Returned when the
> access token is malformed, has the wrong signature, or has **expired** — the
> common case, since access tokens live 30 minutes. Refresh the access token
> and retry.

> [accordion] Acting As Another User — 403
>
> ```json theme={null}
> { "error": "Unauthorized", "code": "notification-preferences/unauthorized" }
> ```
>
> Returned when an end-user token names a `userId` other than its own.

> [accordion] Missing User ID — 400
>
> ```json theme={null}
> { "error": "Missing user ID", "code": "notification-preferences/missing-user-id" }
> ```
>
> Returned when a service key omits the required `userId` (it has no implicit session user).

> [accordion] Invalid Body — 400
>
> ```json theme={null}
> { "error": "...", "code": "notification-preferences/invalid-body" }
> ```
>
> Returned when `disabledTypes` contains a value that is not a recognized event type name.

> [accordion] Bundle Not Installed — 403
>
> ```json theme={null}
> {
>   "code": "database/tables-not-available",
>   "missingTables": ["PushProviderConfigs", "PushDevices", "NotificationPreferences"],
>   "dashboardUrl": "https://…/<projectId>/database"
> }
> ```
>
> Returned when the `push` bundle is not installed for this project.

> [accordion] Bundle Provisioning — 503
>
> ```json theme={null}
> {
>   "code": "database/tables-provisioning",
>   "missingTables": ["PushProviderConfigs", "PushDevices", "NotificationPreferences"],
>   "bundleId": "push"
> }
> ```
>
> Returned while the `push` bundle is mid-install. Retry shortly.

> [accordion] Server Error — 500
>
> ```json theme={null}
> {
>   "error": "Internal server error.",
>   "code": "notification-preferences/server-error"
> }
> ```

**Rate limit:** 50 requests per 5 minutes per IP. Exceeding it returns `429` with a plain-text message and no `code`.

## See Also

* [Get Notification Preferences](https://docs.sublay.io/v7/api-reference/push-notifications/get-preferences.md)
* [`useNotificationPreferences`](https://docs.sublay.io/v7/hooks/push/use-notification-preferences)
* [Notification Preferences & Mute](https://docs.sublay.io/v7/notification-preferences.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.