# Undo a merge

`DELETE /api/v1/vaults/{vault}/merges/{merge}`

Put two merged contacts back the way they were.

It replays what the merge recorded, backwards, and brings the absorbed contact back. Everything that moved returns to the contact it came from, a value that was set aside is attached again, and a reminder the merge stopped starts again.

Either the whole thing comes back or nothing does. An undo that cannot be completed is refused before anything is written, so a half-reversed merge is not a state you can reach.

A merge stays undoable while the absorbed contact is retained, and nothing purges one today. A merge that has already been undone, and one whose absorbed contact is gone for good, are both refused.

## Path parameters

- `vault` (uuid, required): The id of the vault the contacts live in. A path that is not a uuid answers 404 without a query being run.
- `merge` (uuid, required): The id of the merge to undo.

## Returns

Nothing at all. A merge in another vault or another account answers 404. One already undone, or one whose absorbed contact is gone, answers 422 and nothing changes.

## Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in `X-RateLimit-Remaining`.

## Request

```sh
curl https://my.monicahq.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/merges/e58c3a17-90d2-4b6e-8f14-7a3c05d9b2e8 \
  -X DELETE \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/merges/e58c3a17-90d2-4b6e-8f14-7a3c05d9b2e8', {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${token}` },
})
```

```php
$response = Http::withToken($token)->delete('https://my.monicahq.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/merges/e58c3a17-90d2-4b6e-8f14-7a3c05d9b2e8');
```

## Response

`204`, with no body.
