> ## 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.

# Merge incidents

> Merge other active incidents into one main incident.

```http theme={null}
POST /api/v1/alerts/incidents/{id}/merge
```

Merges the incidents in `source_ids` into the incident `{id}`. Each merged incident records the main one
in `merged_into` and, from then on, sends no notifications, does not escalate, and is left out of
[List incidents](https://docs.molesignal.com/en-US/api/alerting/list-incidents.md) and the insights; it stays active, so its rule or
source opens no new incident for it. Resolving the main incident resolves the merged ones; a merged
incident that recovers first is noted on the main incident's
[timeline](https://docs.molesignal.com/en-US/api/alerting/incident-timeline.md). Incidents merged earlier into a merged incident move
to the main one. A merge cannot be undone.

The main incident and every merged one must be active and not merged themselves. The main incident's own
ID and repeated IDs in `source_ids` are ignored. The call requires `alerts.incidents.escalate` on the main
incident.

**Body**

| Field | Type | Required | Notes |
| - | - | - | - |
| `source_ids` | array | Yes | 1 to 50 IDs of the incidents to merge in. |

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

The response is the main incident. [List incidents](https://docs.molesignal.com/en-US/api/alerting/list-incidents.md) describes every field.

```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": false,
  "severity_set_by": null,
  "merged_into": null,
  "dispatch_round": 0,
  "dispatch_reason": "step",
  "revision": 4
}
```

**Errors**

| Status | Cause |
| - | - |
| `400` | `source_ids` names no other incident, or more than 50. |
| `403` | The token lacks `alerts.incidents.escalate`, or the incident is out of the token's reach. |
| `404` | The main incident or one of `source_ids` does not exist. |
| `409` | The main incident or one of `source_ids` has recovered or was merged into another, or an incident kept changing while it was being updated; retry. |


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