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

# 修改路由规则

> 整体写回一条告警路由规则。

```http theme={null}
PUT /api/v1/alerts/routing/rules/{id}
```

整体写回一条[路由规则](https://docs.molesignal.com/zh-Hans/alerting/routing.md#路由规则)，需要 `alerts.routing.manage`。字段同[新建路由规则](https://docs.molesignal.com/zh-Hans/api/alerting/create-routing-rule.md)，没带的可选字段回到默认值。规则的位置不变，改顺序用[调整顺序](https://docs.molesignal.com/zh-Hans/api/alerting/reorder-routing-rules.md)。已经开启的事件不受影响。

```bash cURL theme={null}
curl -X PUT http://localhost:5080/api/v1/alerts/routing/rules/$RULE_ID \
  -H "authorization: Bearer $MS_TOKEN" \
  -H "content-type: application/json" \
  -d '{"name": "Payments in production", "enabled": false, "target": {"kind": "team", "team_id": "<team-id>"}}'
```

响应是修改后的规则。

**错误**

| 状态码 | 原因 |
| - | - |
| `400` | 字段不对，或去向的团队或策略不存在。 |
| `403` | Token 缺少 `alerts.routing.manage`。 |
| `404` | 规则不存在，或属于其他组织。 |
| `422` | 缺少 `name` 或 `target`，或取值无法识别。响应为纯文本。 |


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