> For the complete documentation index, see [llms.txt](https://helpdocs.ycloud.com/partner-center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://helpdocs.ycloud.com/partner-center/technology-development-partnern/mu-ban-tong-bu.md).

# 模板同步

## 一、接口信息

### 1. 请求方式：

```hurl
curl -X POST 'https://api.ycloud.com/v2/whatsapp/templates/{wabaId}/sync' \
-H 'X-API-Key: {{YOUR-API-KEY}}'
```

### 2. 请求参数：

#### 路径参数

| 参数名    | 类型     | 必填 | 说明                           |
| ------ | ------ | -- | ---------------------------- |
| wabaId | String | 是  | WhatsApp Business Account ID |

#### 请求头参数

| 参数名       | 类型     | 必填 | 说明                         |
| --------- | ------ | -- | -------------------------- |
| X-API-KEY | String | 是  | Your YCloud accout API key |

### 3. **响应参数**

#### 成功响应（200 OK）

```json
{
  "wabaId": "string",
  "message": "string"
}
```

参数信息：

| 字段名     | 类型     | 说明                           |
| ------- | ------ | ---------------------------- |
| wabaId  | String | WhatsApp Business Account ID |
| message | String | 同步状态说明信息                     |

响应示例：

```json
{
  "wabaId": "123456789012345",
  "message": "Template sync has been triggered. It may take a few minutes to complete. If templates were recently migrated to this WABA on Meta, the system will automatically retry for up to 30 minutes."
}
```

## 二、接口说明：

### 1. 权限验证

* 本接口仅限技术开发伙伴使用
* 仅限已绑定至YCloud的WABA使用

### 2. 频率限制

此接口有双层频率限制，即WABA级别限制与租户级别限制

#### WABA 限制

* 时间窗口：10 分钟
* 限制规则：每个WABA在时间窗口内只能触发一次同步请求
* 错误提示："Template sync for this WABA was recently triggered. Please try again later."

#### 租户限制

* 时间窗口：1 小时
* 最大请求数：20次
* 规则限制：每个租户在时间窗口内最多可发起20次同步请求
* 错误提示："Too many template sync requests from the tenant. Please try again later."

### 3. 自动重试

在Meta 平台返回空模板列表时，系统会自动重试：

* 最大重试次数：3次
* 重试间隔：5分钟 -> 10分钟 -> 15分钟
* 总重试时长：30分钟

### 4. 错误码

| 403 | FORBIDDEN           | 仅 TP 合作伙伴可使用此 API   |
| --- | ------------------- | ------------------- |
| 403 | FORBIDDEN           | WABA 未绑定到 YCloud 账户 |
| 429 | TOO\_MANY\_REQUESTS | 超过 WABA 级别频率限制      |
| 429 | TOO\_MANY\_REQUESTS | 超过租户级别频率限制          |
