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

# Update User Full Preference

> API to update user preferences across all channels and categories with translated names and descriptions in the response.



## OpenAPI

````yaml PATCH /v1/user/{distinct_id}/preference/
openapi: 3.1.1
info:
  title: SuprSend API
  description: APIs supported on suprsend platform
  version: 1.2.2
servers:
  - url: https://hub.suprsend.com
security:
  - sec0: []
  - BearerAuth: []
paths:
  /v1/user/{distinct_id}/preference/:
    patch:
      summary: Update User Full Preference
      description: >-
        API to update user preferences across all channels and categories with
        translated names and descriptions in the response.
      operationId: update-user-full-preference
      parameters:
        - name: distinct_id
          in: path
          description: distinct_id of the user whose preferences should be updated
          schema:
            type: string
          required: true
        - name: tenant_id
          in: query
          description: to update user preferences for a particular tenant
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                channel_preferences:
                  type: array
                  description: >-
                    Use this to update channel level user preferences. Set
                    `is_restricted - true` if the channel is opted_out by the
                    user. This will only send critical notifications to the user
                    which can't be opted out
                  items:
                    type: object
                    properties:
                      channel:
                        type: string
                        description: >-
                          Add channel as `email`, `inbox`, `sms`, `whatsapp`,
                          `androidpush`, `slack`, `iospush`, `webpush`
                      is_restricted:
                        type: boolean
                        description: >-
                          set `is_restricted = true` if user wants to receive
                          notification in mandatory categories on this channel.
                          Mandatory categories are `can't unsubscribe`
                          categories and the above channel is added as
                          `mandatory channel` in that category
                categories:
                  type: array
                  description: >-
                    Use this to update user preference across categories and
                    channels inside a category.
                  items:
                    type: object
                    properties:
                      category:
                        type: string
                        description: notification category slug
                      preference:
                        type: string
                        enum:
                          - opt_in
                          - opt_out
                        description: >-
                          set `opt_in` to turn on notifications on all or
                          selected channels, `opt_out` to turn-off notifications
                      opt_out_channels:
                        type: array
                        description: >-
                          List of channels to opt-out from this category. Only
                          applicable when preference is `opt_in`
                        items:
                          type: string
                      opt_in_channels:
                        type: array
                        description: >-
                          List of channels to opt-in for this category. Only
                          applicable when preference is `opt_in`
                        items:
                          type: string
            examples:
              Update Preferences:
                value:
                  channel_preferences:
                    - channel: email
                      is_restricted: false
                  categories:
                    - category: _category_slug_
                      preference: opt_in
                      opt_out_channels: []
                      opt_in_channels: []
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    sections:
                      - name: null
                        slug: null
                        subcategories:
                          - name: Promotion de remboursement
                            category: refund-promotion
                            description: mises à jour
                            original_preference: null
                            preference: opt_in
                            is_editable: false
                            channels:
                              - channel: email
                                preference: opt_in
                                is_editable: false
                              - channel: inbox
                                preference: opt_in
                                is_editable: false
                    channel_preferences:
                      - channel: email
                        is_restricted: false
                      - channel: inbox
                        is_restricted: false
              schema:
                type: object
                properties:
                  sections:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          nullable: true
                        slug:
                          type: string
                          nullable: true
                        description:
                          type: string
                          nullable: true
                        tags:
                          type: array
                          nullable: true
                          items:
                            type: string
                        subcategories:
                          type: array
                          items:
                            type: object
                            properties:
                              name:
                                type: string
                              category:
                                type: string
                              description:
                                type: string
                                nullable: true
                              tags:
                                type: array
                                nullable: true
                                items:
                                  type: string
                              effective_tags:
                                type: array
                                nullable: true
                                items:
                                  type: string
                              original_preference:
                                type: string
                                nullable: true
                                enum:
                                  - opt_in
                                  - opt_out
                                  - cant_unsubscribe
                              preference:
                                type: string
                                enum:
                                  - opt_in
                                  - opt_out
                                  - cant_unsubscribe
                              is_editable:
                                type: boolean
                              channels:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    channel:
                                      type: string
                                    preference:
                                      type: string
                                      enum:
                                        - opt_in
                                        - opt_out
                                    is_editable:
                                      type: boolean
                  channel_preferences:
                    type: array
                    items:
                      type: object
                      properties:
                        channel:
                          type: string
                        is_restricted:
                          type: boolean
        '404':
          description: '404'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: 404
                    message: 'user [distinct_id: ''user1''] not found'
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 404
                  message:
                    type: string
                    example: 'user [distinct_id: ''user1''] not found'
      deprecated: false
      security:
        - BearerAuth: []
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where <token>
        is your auth token.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API_Key
      description: >-
        Pass as `Bearer <API_KEY>`. Get API Key from SuprSend dashboard
        Developers -> API Keys section.

````