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

# Update a CSAT rule



## OpenAPI

````yaml patch /v1/csat/rules/{id}
openapi: 3.0.0
info:
  title: Thena Platform
  description: The Thena Platform API description
  version: 1.0.0
  contact: {}
servers:
  - url: https://platform.thena.ai
    description: Platform
  - url: http://localhost:8000
    description: Local
security:
  - ApiKey: []
tags: []
paths:
  /v1/csat/rules/{id}:
    patch:
      tags:
        - CSAT
      summary: Update a CSAT rule
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCsatRuleDto'
      responses:
        '200':
          description: Success - CSAT rule updated successfully
          content:
            application/json:
              example:
                data:
                  ok: true
                  data:
                    id: e4d2a5b1-9c3f-4c8d-b1a2-3e4f5a6b7c8d
                    name: Updated High Priority Ticket Survey
                    description: Updated description for high priority ticket surveys
                    isActive: false
                    priority: 10
                    allFilters:
                      ticket:
                        standardFields:
                          - field: status
                            operator: '='
                            value: closed
                        customFields: []
                      account:
                        standardFields: []
                        customFields: []
                      contact:
                        standardFields: []
                        customFields: []
                    anyFilters:
                      ticket:
                        standardFields:
                          - field: priority
                            operator: '='
                            value: high
                        customFields: []
                      account:
                        standardFields: []
                        customFields: []
                      contact:
                        standardFields: []
                        customFields: []
                    triggerConfig:
                      enabled: true
                      deliveryChannel: email
                      delayInMinutes: 5
                    feedbackConfig:
                      enabled: true
                      feedbackType: thumbs
                      includeCommentField: false
                      brandingColor: '#dc2626'
                    createdAt: '2023-08-01T12:00:00Z'
                    updatedAt: '2023-08-02T14:30:00Z'
                status: true
                message: CSAT rule updated successfully
                timestamp: '2025-07-15T11:38:09.817Z'
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              example:
                statusCode: 400
                message: Validation failed
                error: Bad Request
        '401':
          description: Unauthorized
          content:
            application/json:
              example:
                statusCode: 401
                message: Unauthorized
                error: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                statusCode: 403
                message: Forbidden
                error: Forbidden
        '404':
          description: CSAT rule not found
          content:
            application/json:
              example:
                statusCode: 404
                message: CSAT rule with ID rule123 not found
                error: Not Found
        '429':
          description: Too many requests!
        '500':
          description: Internal Server Error
          content:
            application/json:
              example:
                statusCode: 500
                message: Internal Server Error
                error: Internal Server Error
        '503':
          description: Service Unavailable
          content:
            application/json:
              example:
                statusCode: 503
                message: Service Unavailable
                error: Service Unavailable
components:
  schemas:
    UpdateCsatRuleDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the CSAT rule
          example: High Priority Ticket Survey
        description:
          type: string
          description: Description of the CSAT rule
          example: Sends CSAT surveys to customers with high priority tickets
        isActive:
          type: boolean
          description: Whether the rule is active
          example: true
        allFilters:
          description: Filters where ALL conditions must be met
          allOf:
            - $ref: '#/components/schemas/FilterDto'
        anyFilters:
          description: Filters where ANY condition can be met
          allOf:
            - $ref: '#/components/schemas/FilterDto'
        triggerConfig:
          description: Configuration for when and how the CSAT survey is triggered
          allOf:
            - $ref: '#/components/schemas/TriggerConfigDto'
        feedbackConfig:
          description: Configuration for the CSAT survey appearance and behavior
          allOf:
            - $ref: '#/components/schemas/FeedbackConfigDto'
        priority:
          type: number
          description: Priority of the CSAT rule
          example: 1
    FilterDto:
      type: object
      properties:
        ticket:
          description: Ticket filters
          allOf:
            - $ref: '#/components/schemas/EntityFilterDto'
        account:
          description: Account filters
          allOf:
            - $ref: '#/components/schemas/EntityFilterDto'
        contact:
          description: Contact filters
          allOf:
            - $ref: '#/components/schemas/EntityFilterDto'
    TriggerConfigDto:
      type: object
      properties:
        triggerType:
          type: string
          enum:
            - always
            - random
          description: 'Type of trigger: always send or randomly send'
          example: always
        randomPercentage:
          type: number
          description: Percentage of tickets to randomly select for CSAT (10% or 20%)
          enum:
            - 10
            - 20
          example: 10
        triggerEvent:
          type: string
          enum:
            - ticket_resolved
            - ticket_closed
            - time_after_response
          description: Event that triggers the CSAT survey
          example: ticket_resolved
        delayMinutes:
          type: number
          description: Delay in minutes after the trigger event
          example: 30
          minimum: 0
      required:
        - triggerType
    FeedbackConfigDto:
      type: object
      properties:
        enabled:
          type: boolean
          description: Whether this feedback configuration is enabled
          example: true
        feedbackType:
          type: string
          enum:
            - star
            - thumbs
          description: 'Type of feedback: star rating or thumbs up/down'
          example: star
        customTitle:
          type: string
          description: Custom title for the CSAT survey
          example: How was your experience?
        customMessage:
          type: string
          description: Custom message for the CSAT survey
          example: Please rate your satisfaction with our support.
        customThankYouMessage:
          type: string
          description: Custom thank you message displayed after survey completion
          example: Thank you for your feedback!
        includeCommentField:
          type: boolean
          description: Whether to include a comment field in the survey
          example: true
        commentFieldLabel:
          type: string
          description: Label for the comment field
          example: Additional Comments
        commentFieldPlaceholder:
          type: string
          description: Placeholder text for the comment field
          example: Please share any additional feedback here...
        brandingColor:
          type: string
          description: Hex color code for survey branding
          example: '#3366CC'
        deliveryChannel:
          type: string
          description: Delivery channel for the survey
          example: email
      required:
        - enabled
        - feedbackType
        - includeCommentField
    EntityFilterDto:
      type: object
      properties:
        standardFields:
          description: Standard field filters
          example:
            - field: status
              operator: '='
              value: open
          type: array
          items:
            $ref: '#/components/schemas/StandardFilterDto'
        customFields:
          description: Custom field filters
          example:
            - field: custom_CFLLXQWWY4Z
              customFieldId: CFLLXQWWY4Z
              operator: '='
              value: Value
          type: array
          items:
            $ref: '#/components/schemas/CustomFieldFilterDto'
    StandardFilterDto:
      type: object
      properties:
        field:
          type: string
          description: Field name
          example: status
        operator:
          type: string
          description: Operator
          enum:
            - '='
            - '!='
            - '>'
            - <
            - '>='
            - <=
            - contains
            - not_contains
            - in
            - not_in
            - is_empty
            - is_not_empty
          example: '='
        value:
          type: object
          description: Filter value
          example: open
    CustomFieldFilterDto:
      type: object
      properties:
        field:
          type: string
          description: Field name
          example: custom_CFLLXQWWY4Z
        customFieldId:
          type: string
          description: ID of the custom field
          example: CFLLXQWWY4Z
        operator:
          type: string
          description: Operator
          enum:
            - '='
            - '!='
            - '>'
            - <
            - '>='
            - <=
            - contains
            - not_contains
            - in
            - not_in
            - is_empty
            - is_not_empty
          example: '='
        value:
          type: object
          description: Filter value
          example: This is a custom field value
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Enter your API key '

````