> ## 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}
POST /api/v1/alerts/incidents/{id}/snooze
DELETE /api/v1/alerts/incidents/{id}/snooze
```

`POST` 把进行中的事件暂缓 `duration_secs` 秒。`open` 的事件先以调用者的身份确认。暂缓期间事件不发通知、不升级；过了 `snoozed_until`，事件回到 `open`，负责人收到一条升级通知，`escalation.reason` 是 `snooze_ended`。对暂缓中的事件再调用一次，会重新设定结束时间。

`DELETE` 立即结束暂缓，事件保持 `acknowledged`。两个调用都需要 `alerts.incidents.acknowledge`，`DELETE` 没有请求体。

**请求体**

| 字段 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `duration_secs` | integer | 是 | 60（1 分钟）到 604800（7 天）。 |

```bash cURL theme={null}
curl -X POST http://localhost:5080/api/v1/alerts/incidents/$INCIDENT_ID/snooze \
  -H "authorization: Bearer $MS_TOKEN" \
  -H "content-type: application/json" \
  -d '{"duration_secs": 3600}'
```

响应是更新后的事件，各字段说明见[列出事件](https://docs.molesignal.com/zh-Hans/api/alerting/list-incidents.md)。

```json 200 theme={null}
{
  "id": "3KEDNEyqouYJeBDTLTMTBui7XHW",
  "org_id": "<organization-id>",
  "rule_id": "3KEDBLvTYO6DnWi8H9S9MNLpPT7",
  "escalation_policy_id": "<policy-id>",
  "status": "acknowledged",
  "severity": "critical",
  "summary": "High error rate · checkout",
  "fingerprint": "2b7f5329675de7077c74ffa2646a36cd3adf16f80f523270332894d1ff630632",
  "current_step": 0,
  "current_loop": 0,
  "current_step_started_at": 1790000300000000,
  "assignees": [
    "<user-id>"
  ],
  "labels": {
    "service": "checkout"
  },
  "annotations": {},
  "trace_ids": [],
  "host_ids": [],
  "affected_services": [
    "checkout"
  ],
  "created_at": 1790000000000000,
  "acknowledged_at": 1790000120000000,
  "acknowledged_by": "<user-id>",
  "resolved_at": null,
  "resolved_by": null,
  "team_id": "<team-id>",
  "routing": {
    "reason": "default"
  },
  "snoozed_until": 1790003720000000,
  "snoozed_by": "<user-id>",
  "assignees_pinned": false,
  "severity_set_by": null,
  "merged_into": null,
  "dispatch_round": 0,
  "dispatch_reason": "step",
  "revision": 5
}
```

**错误**

| 状态码 | 原因 |
| - | - |
| `400` | `duration_secs` 小于 60 或大于 604800。 |
| `403` | Token 缺少 `alerts.incidents.acknowledge`，或无权访问这个事件。 |
| `404` | 事件不存在。 |
| `409` | 事件已恢复或已并入别的事件，或者更新时事件一直在变；重试即可。 |


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