**版本：202601**

# 更新会员分群

**PUT** `/openapi/2026-01/loyalty/member-groups/:member_group_id`

修改指定会员分群的配置

## 请求

**Path参数**

- `member_group_id` string (required)

  URL 路径中的分群 ID

**application/json**

**请求体 | 示例**

**请求体 (required)**

- `name` string

  分群名称
- `member_condition` object

  会员筛选条件

  - `key` string
  - `operator` string
  - `value` GoogleProtobufValue

    Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values.
  - `extra` object

    会员条件附加配置(时间窗口、分类、商品、地区)

    - `time_range` string

      时间窗口:all / 7d / 30d
    - `categories` object[]

      指定分类,二维数组 \[\["a","a-1"\],\["b"\]\]

      *   Array \[

      - `values` GoogleProtobufValue[]
      *   \]
    - `product_ids` string[]

      指定商品 id 列表
    - `country_and_province` object

      国家+地区:key=国家码,value=地区码列表(\["ALL"\] 表示整国)

      - `property name*` ListValue

        - `values` GoogleProtobufValue[]
  - `relation` string
  - `children` undefined[]
- `idempotency_key` string

  可选幂等键

```json
{
  "name": "string",
  "member_condition": {
    "key": "string",
    "operator": "string",
    "extra": {
      "time_range": "string",
      "categories": [
        {
          "values": [
            null
          ]
        }
      ],
      "product_ids": [
        "string"
      ],
      "country_and_province": {}
    },
    "relation": "string",
    "children": [
      null
    ]
  },
  "idempotency_key": "string"
}
```

## 响应

**200**

OK

**application/json**

**数据结构 | 示例**

**数据结构**

- `code` string

  错误码
- `message` string

  错误信息
- `data` object

  更新会员分群响应

  - `member_group_id` string
  - `name` string
  - `is_real_time` boolean
  - `member_count` int64
  - `created_at` string
  - `updated_at` string
  - `member_condition` object

    会员筛选条件表达式(递归树)

    - `key` string
    - `operator` string
    - `value` GoogleProtobufValue

      Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values.
    - `extra` object

      会员条件附加配置(时间窗口、分类、商品、地区)

      - `time_range` string

        时间窗口:all / 7d / 30d
      - `categories` object[]

        指定分类,二维数组 \[\["a","a-1"\],\["b"\]\]

        *   Array \[

        - `values` GoogleProtobufValue[]
        *   \]
      - `product_ids` string[]

        指定商品 id 列表
      - `country_and_province` object

        国家+地区:key=国家码,value=地区码列表(\["ALL"\] 表示整国)

        - `property name*` ListValue

          - `values` GoogleProtobufValue[]
    - `relation` string
    - `children` undefined[]

```json
{
  "code": "string",
  "message": "string",
  "data": {
    "member_group_id": "string",
    "name": "string",
    "is_real_time": true,
    "member_count": 0,
    "created_at": "string",
    "updated_at": "string",
    "member_condition": {
      "key": "string",
      "operator": "string",
      "extra": {
        "time_range": "string",
        "categories": [
          {
            "values": [
              null
            ]
          }
        ],
        "product_ids": [
          "string"
        ],
        "country_and_province": {}
      },
      "relation": "string",
      "children": [
        null
      ]
    }
  }
}
```
