**版本：202601**

# 更新主题自定义模板

**PATCH** `/openapi/2026-01/themes/:theme_id/theme-templates/:template_id`

更新已有模板的绑定关系（商品、专辑）。`relations` 会整体覆盖现有绑定，传空数组或不传都会解除全部绑定。

## 请求

**Path参数**

- `theme_id` string (required)

  模板所属主题 ID
- `template_id` string (required)

  要更新的主题模板 ID

**application/json**

**请求体 | 示例**

**请求体 (required)**

- `type` string (required)

  模板类型，取值之一：`product`、`collection`、`product_coll`、`page`
- `relations` string[]

  该模板完整的绑定列表（商品 / 专辑 ID）。整体**覆盖**现有绑定，不做合并。传空数组、或完全不传该字段，都会解除全部绑定；只是想保持原绑定时，也必须把完整列表原样回传
- `selected_all` int32

  是否按 `front_query_params` 全选绑定（而不是在 `relations` 中逐个列出）：0 = 否（默认），1 = 是。取 1 时，目标对象集由 `front_query_params` 圈定
- `front_query_params` object

  `selected_all` = 1 时用于圈定目标对象集的筛选条件；其它情况忽略

  - `search_keyword` string

    圈定目标对象集时的关键词过滤条件；仅在 `selected_all` = 1 时生效
  - `collection_id` string

    圈定目标对象集时的专辑过滤条件；仅在 `selected_all` = 1 时生效

```json
{
  "type": "string",
  "relations": [
    "string"
  ],
  "selected_all": 0,
  "front_query_params": {
    "search_keyword": "string",
    "collection_id": "string"
  }
}
```

## 响应

**200**

OK

**application/json**

**数据结构 | 示例**

**数据结构**

- `code` string

  错误码
- `message` string

  错误信息
- `data` object

  - `` object

```json
{
  "code": "string",
  "message": "string",
  "data": {}
}
```
