Users
Preferences

Update user preference set

Changed on

Updates a complete preference set for a user. 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.

put/v1/users/{user_id}/preferences/{id}

Request

  • Base URL: https://api.knock.app
  • URL: https://api.knock.app/v1/users/{user_id}/preferences/{id}
  • Auth: HTTP bearer

Path parameters

user_idstring required

The unique identifier of the user.

idstring required
Example:default

Unique identifier for the preference set.

Request body

__persistence_strategy__'merge' | 'replace'

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

Example request

{
  "__persistence_strategy__": "merge",
  "categories": {
    "marketing": false,
    "transactional": {
      "channel_types": {
        "email": false
      }
    }
  },
  "channel_types": {
    "email": true
  },
  "channels": {
    "2f641633-95d3-4555-9222-9f1eb7888a80": {
      "conditions": [
        {
          "argument": "US",
          "operator": "equal_to",
          "variable": "recipient.country_code"
        }
      ]
    },
    "aef6e715-df82-4ab6-b61e-b743e249f7b6": true
  },
  "commercial_subscribed": true,
  "workflows": {
    "dinosaurs-loose": {
      "channel_types": {
        "email": false
      }
    }
  }
}

Response

OK

idstring required

Unique identifier for the preference set.

Example response

{
  "categories": {
    "marketing": false,
    "transactional": {
      "channel_types": {
        "email": false
      }
    }
  },
  "channel_types": {
    "email": true,
    "push": false,
    "sms": {
      "conditions": [
        {
          "argument": "US",
          "operator": "equal_to",
          "variable": "recipient.country_code"
        }
      ]
    }
  },
  "commercial_subscribed": true,
  "id": "default",
  "workflows": null
}

Changes

    • breaking

      the request property became not nullable

    • breaking

      the request property type changed from boolean to no type

    • breaking

      the response's property type changed from boolean to no type for status

    • info

      added subschema #1 subschema #3 to the request property anyOf list

    • info

      added subschema #1 subschema #3 to the response property anyOf list for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////////// response property for the response status

    • warning

      added the new not_contains_all enum value to the ////// response property for the response status

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////

    • info

      added the new not_contains_all enum value to the request property //////

    • info

      added the new not_contains_all enum value to the request property //////

    • info

      added the new not_contains_all enum value to the request property //////

    • info

      added the new not_contains_all enum value to the request property //////

    • info

      added the new not_contains_all enum value to the request property //////

    • info

      added the new not_contains_all enum value to the request property //////

    • info

      added the new not_contains_all enum value to the request property //////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////////

    • info

      added the new not_contains_all enum value to the request property //////