> ## 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/sources/{id}
```

整体写回一个[告警来源](https://docs.molesignal.com/zh-Hans/alerting/sources.md)的设置，需要 `alerts.sources.manage`。字段同[新建告警来源](https://docs.molesignal.com/zh-Hans/api/alerting/create-source.md)；类型不能改，带了 `kind` 时须与原来相同。Token 不变，改 Token 用[轮换 Token](https://docs.molesignal.com/zh-Hans/api/alerting/rotate-source-token.md)。不带 `home_cluster` 时接收集群不变。已开的事件保持原来的升级策略和标签。

```bash cURL theme={null}
curl -X PUT http://localhost:5080/api/v1/alerts/sources/$SOURCE_ID \
  -H "authorization: Bearer $MS_TOKEN" \
  -H "content-type: application/json" \
  -d '{"name": "Production Prometheus", "enabled": false, "escalation_policy_id": "default", "severity": "error"}'
```

响应是修改后的来源，不带 `token`。

**错误**

| 状态码 | 原因 |
| - | - |
| `400` | 字段不对，或改了类型。 |
| `403` | Token 缺少 `alerts.sources.manage`。 |
| `404` | 来源不存在。 |


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