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

# Get Preference Category

> Retrieve the current preference category for a workspace



## OpenAPI

````yaml GET /v1/{workspace}/preference_category/
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/{workspace}/preference_category/:
    get:
      summary: Get Preference Category
      description: Retrieve the current preference category for a workspace
      operationId: get-category
      parameters:
        - in: path
          name: workspace
          required: true
          schema:
            type: string
          description: Workspace slug (staging, production, etc.)
          example: my-workspace
        - in: query
          name: mode
          required: true
          schema:
            type: string
            enum:
              - live
              - draft
          description: >-
            Mode to retrieve categories. Use 'live' for active categories or
            'draft' for current draft.
          example: draft
      responses:
        '200':
          description: Successfully retrieved preference category
          content:
            application/json:
              schema:
                type: object
                properties:
                  $schema:
                    type: string
                    description: JSON schema reference for preference category structure
                    example: >-
                      https://schema.suprsend.com/preference_category/v1/schema.json
                  root_categories:
                    type: array
                    description: Array of root preference categories
                    items:
                      type: object
                      properties:
                        root_category:
                          type: string
                          description: >-
                            The root category classification for the preference
                            category
                          example: system
                        sections:
                          type: array
                          description: >-
                            Array of sections within the preference category.
                            Can be empty if not yet configured.
                          items:
                            type: object
                            properties:
                              name:
                                type: string
                                description: Name of the section
                                example: Account Updates
                              description:
                                type: string
                                description: >-
                                  Description of what notifications this section
                                  covers
                                example: Important account-related notifications
                              tags:
                                type: array
                                description: >-
                                  Tags to organize and filter sections. Use
                                  lowercase, hyphenated values.
                                items:
                                  type: string
                              categories:
                                type: array
                                description: >-
                                  Array of categories within this section. Can
                                  be empty if not yet configured.
                                items:
                                  type: object
                                  properties:
                                    category:
                                      type: string
                                      description: Unique identifier for the category
                                      example: password-reset
                                    name:
                                      type: string
                                      description: Display name for the category
                                      example: Password Reset
                                    description:
                                      type: string
                                      description: >-
                                        Description of what notifications this
                                        category covers
                                    default_preference:
                                      type: string
                                      description: >-
                                        Default preference setting for this
                                        category
                                      example: opt_in
                                    default_mandatory_channels:
                                      type: array
                                      description: >-
                                        Channels that are mandatory for this
                                        category
                                      items:
                                        type: string
                                      example:
                                        - email
                                    default_opt_in_channels:
                                      type: array
                                      nullable: true
                                      description: >-
                                        Opt-in channels set to have selective
                                        opt-in channels instead of all channels
                                        when channel preference is opt_in or
                                        cant_unsubscribe.
                                      items:
                                        type: string
                                      example: null
                                    tags:
                                      type: array
                                      description: >-
                                        Tags to organize and filter categories.
                                        Use lowercase, hyphenated values (e.g.,
                                        "user-management", "payment-alerts").
                                      items:
                                        type: string
                                        pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                  version_no:
                    type: integer
                    description: Version number field as an identifier to track the version
                    example: 1
                  status:
                    type: string
                    description: Current status of the preference category
                    enum:
                      - draft
                      - active
                  validation_result:
                    type: object
                    description: Result of validating the preference category
                    properties:
                      is_valid:
                        type: boolean
                        description: >-
                          true if the preference category is valid, false if
                          there are errors
                      errors:
                        type: array
                        description: Array of error messages when validation fails
                        items:
                          type: string
              example:
                $schema: https://schema.suprsend.com/preference_category/v1/schema.json
                root_categories:
                  - root_category: system
                    sections: []
                  - root_category: transactional
                    sections:
                      - name: Task Updates
                        categories:
                          - category: tagged-to-me
                            name: Tagged to Me
                            description: >-
                              Status Update or mentions on tasks assigned by me
                              or tagged to me
                            default_preference: opt_in
                  - root_category: promotional
                    sections:
                      - name: Product Updates
                        categories:
                          - category: newsletter
                            name: Newsletter
                            default_preference: opt_out
                version_no: 15
                status: draft
                validation_result:
                  is_valid: false
                  errors:
                    - >-
                      it seems some subcategories have been deleted in this
                      version, on which active workflows are configured. missing
                      subcategories: ["chapter-added" "forecast"
                      "onboarding-guide" "training-new"]
        '401':
          description: ServiceToken not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 401
                  message:
                    type: string
                    example: ServiceToken not found
              example:
                code: 401
                message: ServiceToken not found
        '404':
          description: Workspace not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 404
                  message:
                    type: string
                    example: 'workspace not found for slug/uid: workspace'
              example:
                code: 404
                message: 'workspace not found for slug/uid: workspace'
      security:
        - ServiceTokenAuth: []
      servers:
        - url: https://management-api.suprsend.com
      x-codeSamples:
        - lang: cURL
          label: Get Category
          source: >
            curl -X GET
            "https://management-api.suprsend.com/v1/{workspace}/preference_category/"
            \
              --header "Authorization: ServiceToken {token}" \
              --header "Content-Type: application/json"
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.
    ServiceTokenAuth:
      type: apiKey
      in: header
      name: ServiceToken <token>
      description: >-
        You can get Service Token from [SuprSend dashboard -> Account Settings
        -> Service
        Tokens](https://app.suprsend.com/en/account-settings/service-tokens)
        section.

````