> ## 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 object preferences for a specific notification category.



## OpenAPI

````yaml PATCH /v1/object/{object_type}/{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/object/{object_type}/{id}/preference/category/{category_slug}/:
    patch:
      summary: Category and Channel within Category
      description: API to update object preferences for a specific notification category.
      operationId: object-preference-category
      parameters:
        - name: tenant_id
          in: query
          description: to fetch user preferences for a particular tenant
          schema:
            type: string
        - name: object_type
          in: path
          description: >-
            Used to group similar objects together. Give plural namespace like
            teams, organizations, and roles.
          schema:
            type: string
          required: true
        - name: id
          in: path
          description: Unique identifier of the object in your system
          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: >-
                    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
                digest_schedule:
                  type: object
                  nullable: true
                  description: >
                    Object's preferred digest schedule for this category. Set to
                    `null` to fall back to tenant's default.
                  properties:
                    id:
                      type: string
                      description: ID of the selected digest schedule option
                    time:
                      type: string
                      description: >-
                        Override time if applicable and edit_policy is
                        `editable`. Format: HH:MM
                    dtstart:
                      type: string
                      format: date-time
                      description: >-
                        Override start date if applicable and edit_policy is
                        `editable`
                    weekdays:
                      type: array
                      description: >-
                        Override weekdays if applicable and edit_policy is
                        `editable`
                      items:
                        type: string
                        enum:
                          - mo
                          - tu
                          - we
                          - th
                          - fr
                          - sa
                          - su
                    monthdays:
                      type: array
                      description: >-
                        Override monthdays if applicable and edit_policy is
                        `editable`
                      items:
                        type: object
                        properties:
                          pos:
                            description: >-
                              Position in the month (1-31; use a negative value
                              to count from the end).
                            type: integer
                          day:
                            description: >-
                              Optional day of the week (su, mo, tu, we, th, fr,
                              sa).
                            type: string
                properties:
                  type: array
                  description: >-
                    Override values for category condition properties. Only
                    properties with edit_policy `editable` can be overridden.
                    The datatype of value must match the property's
                    `value_type`.
                  items:
                    type: object
                    properties:
                      key:
                        type: string
                        description: Property key identifier
                      value:
                        description: Override value for the property
      responses:
        '202':
          description: '202'
          content:
            application/json:
              examples:
                Result:
                  value:
                    name: Weekly Activity Digest
                    category: weekly-activity-digest
                    description: Summary of recent activity in your workspace
                    tags:
                      - digest
                      - activity
                    effective_tags:
                      - digest
                      - activity
                    original_preference: opt_in
                    preference: opt_in
                    is_editable: true
                    channels:
                      - channel: email
                        preference: opt_in
                        is_editable: true
                    digest_schedule_options:
                      options:
                        - id: instant
                          label: Instant
                          frequency: instantly
                          is_default: false
                          is_user_selected: false
                        - id: daily-summary
                          label: Daily summary at 9:00 AM
                          frequency: daily
                          interval: 1
                          time:
                            edit_policy: editable
                            default_value: '09:00'
                            value: ''
                          is_default: true
                          is_user_selected: false
                        - id: weekly-on-weekdays
                          label: >-
                            Every week on Mon–Fri · time set by recipient
                            (default: 9:00 AM)
                          frequency: weekly_mo2fr
                          interval: 1
                          time:
                            edit_policy: editable
                            default_value: '09:00'
                            value: '10:00'
                          weekdays:
                            edit_policy: locked
                            default_value:
                              - mo
                              - tu
                              - we
                              - th
                              - fr
                            value:
                              - mo
                              - tu
                              - we
                              - th
                              - fr
                          is_default: false
                          is_user_selected: true
                    digest_schedule:
                      id: weekly-on-weekdays
                      label: >-
                        Every week on Mon–Fri · time set by recipient (default:
                        9:00 AM)
                      frequency: weekly_mo2fr
                      interval: 1
                      time: '10:00'
                      weekdays:
                        - mo
                        - tu
                        - we
                        - th
                        - fr
                      is_default: false
                      is_user_selected: true
                    properties:
                      - key: threshold
                        label: Minimum activity count
                        value_type: string
                        default_value: '100'
                        is_optional: false
                        edit_policy: editable
                        is_overridden: true
                        value: '500'
              schema:
                type: object
                properties:
                  name:
                    type: string
                    description: preference category name
                    example: Weekly Activity Digest
                  category:
                    type: string
                    description: unique preference category slug
                    example: weekly-activity-digest
                  description:
                    description: Description of the notification category.
                    type: string
                    example: Summary of recent activity in your workspace
                  tags:
                    type: array
                    nullable: true
                    items:
                      type: string
                  effective_tags:
                    type: array
                    nullable: true
                    items:
                      type: string
                  original_preference:
                    type: string
                    enum:
                      - opt_in
                      - opt_out
                    description: default preference of the category
                    example: opt_in
                  preference:
                    type: string
                    enum:
                      - opt_in
                      - opt_out
                    description: final 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
                  digest_schedule_options:
                    type: object
                    nullable: true
                    description: All available digest schedule options for this category
                    properties:
                      options:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              description: Unique identifier of the digest schedule option.
                              type: string
                            label:
                              description: Display label shown to the recipient.
                              type: string
                            frequency:
                              description: >-
                                Frequency of the digest schedule (instantly,
                                hourly, daily, weekly, weekly_mo2fr, monthly).
                              type: string
                            interval:
                              description: >-
                                Recurrence multiplier for the frequency (for
                                example, every 2 weeks).
                              type: integer
                            time:
                              description: >-
                                Time of day to send the digest, with its edit
                                policy and value.
                              type: object
                              properties:
                                edit_policy:
                                  description: >-
                                    `editable` means the value can be
                                    overridden; `locked` means it is fixed.
                                  type: string
                                default_value:
                                  description: Default value applied when not overridden.
                                  type: string
                                value:
                                  type: string
                                  nullable: true
                            weekdays:
                              description: >-
                                Days of the week to send on (for weekly
                                frequency), with edit policy and value.
                              type: object
                              properties:
                                edit_policy:
                                  description: >-
                                    `editable` means the value can be
                                    overridden; `locked` means it is fixed.
                                  type: string
                                default_value:
                                  description: Default value applied when not overridden.
                                  type: array
                                  items:
                                    type: string
                                value:
                                  type: array
                                  nullable: true
                                  items:
                                    type: string
                            monthdays:
                              description: >-
                                Days of the month to send on (for monthly
                                frequency), with edit policy and value.
                              type: object
                              properties:
                                edit_policy:
                                  description: >-
                                    `editable` means the value can be
                                    overridden; `locked` means it is fixed.
                                  type: string
                                default_value:
                                  description: Default value applied when not overridden.
                                  type: array
                                  items:
                                    type: object
                                value:
                                  type: array
                                  nullable: true
                                  items:
                                    type: object
                            dtstart:
                              description: >-
                                Start datetime from which the recurring schedule
                                is calculated, with edit policy and value.
                              type: object
                              properties:
                                edit_policy:
                                  description: >-
                                    `editable` means the value can be
                                    overridden; `locked` means it is fixed.
                                  type: string
                                default_value:
                                  description: Default value applied when not overridden.
                                  type: string
                                value:
                                  type: string
                                  nullable: true
                            is_default:
                              description: Whether this option is the default selection.
                              type: boolean
                            is_user_selected:
                              type: boolean
                  digest_schedule:
                    type: object
                    nullable: true
                    description: The currently active digest schedule selection
                    properties:
                      id:
                        description: Unique identifier of the digest schedule option.
                        type: string
                      label:
                        description: Display label shown to the recipient.
                        type: string
                      frequency:
                        description: >-
                          Frequency of the digest schedule (instantly, hourly,
                          daily, weekly, weekly_mo2fr, monthly).
                        type: string
                      interval:
                        description: >-
                          Recurrence multiplier for the frequency (for example,
                          every 2 weeks).
                        type: integer
                      time:
                        description: >-
                          Time of day to send the digest, with its edit policy
                          and value.
                        type: string
                      weekdays:
                        description: >-
                          Days of the week to send on (for weekly frequency),
                          with edit policy and value.
                        type: array
                        items:
                          type: string
                      monthdays:
                        description: >-
                          Days of the month to send on (for monthly frequency),
                          with edit policy and value.
                        type: array
                        items:
                          type: object
                      is_default:
                        description: Whether this option is the default selection.
                        type: boolean
                      is_user_selected:
                        type: boolean
                  properties:
                    type: array
                    nullable: true
                    description: Category condition properties with overrides
                    items:
                      type: object
                      properties:
                        key:
                          description: >-
                            Property key identifier, referenced in workflows as
                            `$category.properties.<key>`.
                          type: string
                        label:
                          description: Display label shown to the recipient.
                          type: string
                        value_type:
                          description: Data type of the property value.
                          type: string
                        default_value:
                          description: Default value applied when not overridden.
                          type: string
                        is_optional:
                          description: Whether this property is optional.
                          type: boolean
                        edit_policy:
                          description: >-
                            `editable` means the value can be overridden;
                            `locked` means it is fixed.
                          type: string
                          enum:
                            - locked
                            - editable
                        is_overridden:
                          type: boolean
                        value:
                          description: Overridden value, if any
        '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: Object Preference Category - Opt Out Channel
          source: >
            curl -X PATCH
            "https://hub.suprsend.com/v1/object/departments/engineering/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.

````