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

# Update Rule

Updates a rule's type, values, conditional, or metadata key.

Visit the [conditional operators reference](/reference/communications-campaigns#conditional-operators-reference) for more information on how to use them.

See the [create rules](/reference/create-rules) endpoint for more examples.


## OpenAPI

````yaml openapi/communications-campaigns/update-rule.json PATCH /campaigns/{campaign_id}/rules/{rule_id}
openapi: 3.0.0
info:
  version: 1.0.0
  title: Communications Campaigns
servers:
  - url: https://api-sandbox.y.uno/v1
security:
  - public-api-key: []
    private-secret-key: []
paths:
  /campaigns/{campaign_id}/rules/{rule_id}:
    patch:
      operationId: patch_campaigns-campaign-id-rules-rule-id
      parameters:
        - in: path
          name: campaign_id
          schema:
            type: string
          required: true
          description: The campaign identifier (UUID).
        - in: path
          name: rule_id
          schema:
            type: string
          required: true
          description: The rule identifier (UUID).
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                rule_type:
                  type: string
                  description: >-
                    New rule type (see [Rule Types
                    Reference](/reference/communications-campaigns#rule-types-reference))
                values:
                  type: array
                  items:
                    type: string
                  description: New values array. Not required for `UNIQUE_BY_USER`.
                conditional:
                  type: string
                  description: >-
                    New comparison operator. Not required for
                    `USER_COMMS_PER_DAY` or `UNIQUE_BY_USER`. See [Conditional
                    Operators
                    Reference](/reference/communications-campaigns#conditional-operators-reference).
                metadata_key:
                  type: string
                  description: >-
                    New metadata key. Required when `rule_type` is `METADATA`.
                    The metadata field name to evaluate.
            examples:
              Basic Example:
                summary: Basic Example
                value:
                  values:
                    - DECLINED
                    - REJECTED
                  conditional: ONE_OF
      responses:
        '200':
          description: ''
          content:
            application/json:
              examples:
                OK:
                  summary: OK
                  value:
                    data:
                      id: f1e2d3c4-b5a6-7890-abcd-ef1234567890
                      rule_type: PAYMENT_STATUS
                      values:
                        - DECLINED
                      conditional: EQUAL
                      metadata_key: null
                      status: ACTIVE
                      created_at: '2025-07-01T12:05:00Z'
                      updated_at: '2025-07-01T12:05:00Z'
components:
  securitySchemes:
    public-api-key:
      type: apiKey
      in: header
      name: public-api-key
    private-secret-key:
      type: apiKey
      in: header
      name: private-secret-key

````