> ## 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}/reassign
```

把进行中的事件交给别人。请求体用 `kind` 指明交给谁：

* `users`：`user_ids` 里的人（组织成员，1 到 10 个）成为负责人，并收到一条升级通知，`escalation.reason` 是 `reassigned`。事件回到 `open`，当前这一级重新开始计算确认超时；仍没人确认时照常升级到下一级。
* `team`：交给 `team_id` 这个团队，改用团队的值班策略，团队没设时用名为 `default` 的策略，从第一个适用的级别重新开始。
* `policy`：改用 `escalation_policy_id` 这条策略，从第一个适用的级别重新开始，团队不变。

三种情况下事件都回到 `open`，暂缓随之结束，这一步记在[时间线](https://docs.molesignal.com/zh-Hans/api/alerting/incident-timeline.md)上。该调用需要 `alerts.incidents.update`。

**请求体**

| 字段 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `kind` | string | 是 | `users`、`team` 或 `policy`。 |
| `user_ids` | array | `users` 时必填 | 1 到 10 个组织成员的用户 ID。 |
| `team_id` | string | `team` 时必填 | 团队。 |
| `escalation_policy_id` | string | `policy` 时必填 | 升级策略。 |

```bash cURL theme={null}
curl -X POST http://localhost:5080/api/v1/alerts/incidents/$INCIDENT_ID/reassign \
  -H "authorization: Bearer $MS_TOKEN" \
  -H "content-type: application/json" \
  -d '{"kind": "users", "user_ids": ["<user-id>"]}'
```

响应是更新后的事件，各字段说明见[列出事件](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": "open",
  "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": null,
  "acknowledged_by": null,
  "resolved_at": null,
  "resolved_by": null,
  "team_id": "<team-id>",
  "routing": {
    "reason": "default"
  },
  "snoozed_until": null,
  "snoozed_by": null,
  "assignees_pinned": true,
  "severity_set_by": null,
  "merged_into": null,
  "dispatch_round": 1,
  "dispatch_reason": "reassigned",
  "revision": 4
}
```

**错误**

| 状态码 | 原因 |
| - | - |
| `400` | `user_ids` 为空、超过 10 个或含有组织外的用户；或团队没有值班策略、也没有 `default` 策略；或策略里没有适用于事件严重度的级别。 |
| `403` | Token 缺少 `alerts.incidents.update`，或无权访问这个事件。 |
| `404` | 事件不存在。 |
| `409` | 事件已恢复或已并入别的事件，或者更新时事件一直在变；重试即可。 |


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