Docs
/
/

Update a preference set

Sets preferences within the given preference set. By default, this is a destructive operation and will replace any existing preferences with the preferences given. Use '__persistence_strategy': 'merge' to merge with existing preferences instead. If no object exists in the current environment for the given `:collection` and `:object_id`, Knock will create the object as part of this request. The preference set `:id` can be either `default` or a `tenant.id`. Learn more about [per-tenant preferences](/preferences/tenant-preferences).

Update a preference set

Sets preferences within the given preference set. By default, this is a destructive operation and will replace any existing preferences with the preferences given. Use '__persistence_strategy': 'merge' to merge with existing preferences instead. If no object exists in the current environment for the given :collection and :object_id, Knock will create the object as part of this request. The preference set :id can be either default or a tenant.id. Learn more about per-tenant preferences.

Endpoint

PUT/v1/objects/{collection}/{object_id}/preferences/{id}

Rate limit

Tier 3

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

id
string

Unique identifier for the preference set.

Request body

__persistence_strategy__
enum(string)

Controls how the preference set is persisted. 'replace' will completely replace the preference set, 'merge' will merge with existing preferences.

mergereplace
categories
PreferenceSetRequestCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

channels
PreferenceSetChannels

An object where the key is the channel ID and the values are the preference settings for that channel ID.

commercial_subscribed
boolean

Whether the recipient is subscribed to commercial communications. When false, the recipient will not receive commercial workflow notifications.

workflows
PreferenceSetRequestWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

Returns

A preference set represents a specific set of notification preferences for a recipient. A recipient can have multiple preference sets.

categories
PreferenceSetCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

channels
PreferenceSetChannels

An object where the key is the channel ID and the values are the preference settings for that channel ID.

commercial_subscribed
boolean

Whether the recipient is subscribed to commercial communications. When false, the recipient will not receive commercial workflow notifications.

id
string

Unique identifier for the preference set.

workflows
PreferenceSetWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

New chat