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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 更新规则

> 更新营销活动规则的类型、值、条件运算符或元数据键。

更新规则的类型、值、条件或元数据键。

有关如何使用条件运算符的更多信息，请访问 [条件运算符参考](https://docs.y.uno/zh-hans/reference/communications-campaigns.md#conditional-operators-reference)。

更多示例请参阅 [创建规则](https://docs.y.uno/zh-hans/reference/communications-campaigns/create-rules.md) endpoint。


## OpenAPI

````yaml openapi/zh-hans/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
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
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: 营销活动标识符（UUID）。
        - in: path
          name: rule_id
          schema:
            type: string
          required: true
          description: 规则标识符（UUID）。
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                rule_type:
                  type: string
                  description: >-
                    新的规则类型（参见[规则类型参考](/zh-hans/reference/communications-campaigns#rule-types-reference)）
                values:
                  type: array
                  items:
                    type: string
                  description: 新的值数组。`UNIQUE_BY_USER` 不需要。
                conditional:
                  type: string
                  description: >-
                    新的比较运算符。`USER_COMMS_PER_DAY` 或 `UNIQUE_BY_USER`
                    不需要。参见[条件运算符参考](/zh-hans/reference/communications-campaigns#conditional-operators-reference)。
                metadata_key:
                  type: string
                  description: >-
                    新的 metadata 键。当 `rule_type` 为 `METADATA` 时必填。要评估的 metadata
                    字段名称。
            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'
        '404':
          description: Not found。此账户下不存在该营销活动或规则。
          content:
            application/json:
              examples:
                Not Found:
                  value:
                    code: NOT_FOUND
                    messages:
                      - Not Found
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: NOT_FOUND
                  messages:
                    type: array
                    items:
                      type: string
                      example: Not Found
components:
  securitySchemes:
    public-api-key:
      type: apiKey
      in: header
      name: public-api-key
    private-secret-key:
      type: apiKey
      in: header
      name: private-secret-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.