> ## 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 Tenant Default Preference

> API to update tenant default preferences for a specific notification category.



## OpenAPI

````yaml PATCH /v1/tenant/{tenant_id}/category/{category_slug}/
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/tenant/{tenant_id}/category/{category_slug}/:
    patch:
      summary: Update Tenant Default Preference
      description: >-
        API to update tenant default preferences for a specific notification
        category.
      operationId: update-brand-default-preference
      parameters:
        - name: tenant_id
          in: path
          description: >-
            unique identifier of the brand/tenant you want to update default
            preferences for
          schema:
            type: string
          required: true
        - name: category_slug
          in: path
          description: >-
            notification category slug. You can get this from Notification
            Categories page on SuprSend dashboard -> Settings page
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                preference:
                  type: string
                  description: >-
                    set `**opt_in**` to turn on notifications on all or selected
                    channels by default, `**opt_out**` to turn-off notifications
                    by default, `**cant_unsubscribe**`if you do not want users
                    to completely opt-out from this category.
                  enum:
                    - opt_in
                    - opt_out
                    - cant_unsubscribe
                visible_to_subscriber:
                  type: boolean
                  description: >-
                    set it `false` to hide a category from user's preference
                    page
                mandatory_channels:
                  type: array
                  description: >-
                    Add mandatory channels that the user can't unsubscribe from
                    if preference is `cant_unsubscribe`.
                  items:
                    type: string
                    enum:
                      - email
                      - sms
                      - whatsapp
                      - androidpush
                      - inbox
                      - iospush
                      - slack
                      - webpush
                      - ms_teams
                opt_in_channels:
                  type: array
                  nullable: true
                  description: >-
                    Add channels that should be opted-in by default when
                    preference is either `On` or `Can't Unsubscribe`. Set to
                    null or do not pass this parameter to set all channels as
                    opted-in. In case of `Can't Unsubscribe`, mandatory channels
                    are opted-in by default.
                  items:
                    type: string
                    enum:
                      - email
                      - sms
                      - whatsapp
                      - androidpush
                      - inbox
                      - iospush
                      - slack
                      - webpush
                      - ms_teams
                blocked_channels:
                  type: array
                  nullable: true
                  description: >-
                    Pass channels which are not applicable for the tenant. This
                    setting will apply to all categories and user will not be
                    able to opt-in to these channels for the tenant.
                  items:
                    type: string
                    enum:
                      - email
                      - sms
                      - whatsapp
                      - androidpush
                      - inbox
                      - iospush
                      - slack
                      - webpush
                      - ms_teams
      responses:
        '202':
          description: '202'
          content:
            application/json:
              examples:
                Result:
                  value:
                    name: Status Update Alert
                    category: status-update-alert
                    description: Send me updates when account status changes
                    root_category: transactional
                    default_preference: opt_in
                    default_mandatory_channels: null
                    default_opt_in_channels:
                      - email
                      - sms
                    visible_to_subscriber: true
                    preference: opt_in
                    mandatory_channels: null
                    opt_in_channels: null
                    blocked_channels: null
              schema:
                type: object
                properties:
                  name:
                    type: string
                    description: preference category name
                  category:
                    type: string
                    description: >-
                      unique preference category slug. You can get it by
                      clicking on category name on SuprSend dashboard ->
                      preference page
                  description:
                    type: string
                    description: description of the notification category
                  root_category:
                    type: string
                    description: root category this sub-category belongs to
                    example: transactional
                  default_preference:
                    type: string
                    enum:
                      - cant_unsubscribe
                      - opt_in
                      - opt_out
                    description: >-
                      default preference of the category set while updating the
                      category.
                  default_mandatory_channels:
                    type: array
                    description: >-
                      default mandatory channels set while updating the category
                      in case default preference is can't unsubscribe
                    items:
                      type: string
                  default_opt_in_channels:
                    type: array
                    nullable: true
                    description: >-
                      default opt-in channels set to have selective opt-in
                      channels instead of all channels while updating the
                      category.
                    items:
                      type: string
                  opt_in_channels:
                    type: array
                    nullable: true
                    description: opt-in channels overridden for this tenant.
                    items:
                      type: string
                  visible_to_subscriber:
                    type: boolean
                    description: >-
                      set it `false` to hide a category from user's preference
                      page
                  preference:
                    type: string
                    enum:
                      - opt_in
                      - opt_out
                    description: preference setting overridden for this tenant.
                  blocked_channels:
                    type: array
                    description: >-
                      channels which are opted-out across all categories for
                      this tenant.
                    items:
                      type: string
                      enum:
                        - email
                        - sms
                        - whatsapp
                        - androidpush
                        - inbox
                        - iospush
                        - slack
                        - webpush
                        - ms_teams
        '404':
          description: '404'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: 404
                    message: tenant 'brand/tenant_id' not found
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 404
                  message:
                    type: string
                    example: tenant 'brand/tenant_id' not found
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: cURL
          label: Update Tenant Default Preference
          source: >
            curl -X PATCH
            "https://hub.suprsend.com/v1/tenant/brand_id/preference/status-update-alert/"
            \
              --header 'Authorization: Bearer __YOUR_API_KEY__' \
              --header 'Content-Type: application/json' \
              --data '{
                "preference": "opt_in",
                "visible_to_subscriber": true
              }'
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.

````

Built with [Mintlify](https://mintlify.com).