> ## 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.

# Category and Channel within Category

> API to update user preferences for a specific notification category.



## OpenAPI

````yaml PATCH /v1/user/{distinct_id}/preference/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/user/{distinct_id}/preference/category/{category_slug}/:
    patch:
      summary: Category and Channel within Category
      description: API to update user preferences for a specific notification category.
      operationId: update-user-preference-category
      parameters:
        - name: distinct_id
          in: path
          description: distinct_id of the user whose preferences should be fetched
          schema:
            type: string
          required: true
        - name: tenant_id
          in: query
          description: to fetch user preferences for a particular tenant
          schema:
            type: string
        - 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
        - name: locale
          in: query
          description: >
            Locale code (e.g., `es`, `fr`, `de`, `ja`, `es-AR`) to fetch
            translated category and section names and descriptions.  When
            provided, the API returns category and section names and
            descriptions in the specified language if translations are
            available.  If a translation is missing for the requested locale,
            the system automatically falls back in this order: `locale-region`
            (e.g., `es-AR`) → `locale` (e.g., `es`) → `en` (English - always
            available).
          schema:
            type: string
          example: es
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                preference:
                  type: string
                  description: >-
                    choose one of the options: `opt_in` if the user has allowed
                    notification in this category and `opt_out` if user wants to
                    discontinue notification in this category
                  default: opt_in
                opt_out_channels:
                  type: array
                  description: >-
                    Add array of channels if user wants to unsubscribe from
                    particular channels in this category. Add channels as
                    `email`, `sms`, `whatsapp`, `androidpush`, `inbox`,
                    `iospush`, `slack`, `webpush`
                  items:
                    type: string
                opt_in_channels:
                  type: array
                  description: >-
                    You can either pass opt_out_channels when user opts out from
                    a channel in the category or opt_in_channels when user opts
                    in to a channel in the category. Add channels as `email`,
                    `sms`, `whatsapp`, `androidpush`, `inbox`, `iospush`,
                    `slack`, `webpush`
                  items:
                    type: string
      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
                    original_preference: opt_in
                    preference: opt_in
                    is_editable: true
                    channels:
                      - channel: email
                        preference: opt_in
                        is_editable: true
                      - channel: ms_teams
                        preference: opt_in
                        is_editable: true
                      - channel: slack
                        preference: opt_in
                        is_editable: true
              schema:
                type: object
                properties:
                  name:
                    type: string
                    example: Status Update Alert
                  category:
                    type: string
                    example: status-update-alert
                  description:
                    type: string
                    example: Send me updates when account status changes
                  original_preference:
                    type: string
                    description: default preference of the category
                    example: opt_in
                  preference:
                    type: string
                    description: final user preference of the category
                    example: opt_in
                  is_editable:
                    type: boolean
                    description: >-
                      false for categories where default preference is set to
                      can't unsubscribe
                    example: true
                  channels:
                    type: array
                    items:
                      type: object
                      properties:
                        channel:
                          type: string
                          example: email
                        preference:
                          type: string
                          enum:
                            - opt_in
                            - opt_out
                          example: opt_in
                        is_editable:
                          type: boolean
                          example: true
        '404':
          description: 404 - Not Found
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: 404
                    message: category '_category_slug_' not found
              schema:
                type: object
                description: error code and message detailing the error
      deprecated: false
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: cURL
          label: Update User Category Preference - Opt Out Channel
          source: >
            curl -X PATCH
            "https://hub.suprsend.com/v1/user/user123/preference/status-update-alert/"
            \
              --header 'Authorization: Bearer __YOUR_API_KEY__' \
              --header 'Content-Type: application/json' \
              --data '{
                "preference": "opt_in",
                "opt_out_channels": ["email", "slack"]
              }'
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).