# Delete several contacts

`DELETE /api/v1/vaults/{vault}/contacts`

Delete up to 500 contacts of a vault at once, each exactly as deleting it alone would.

Each contact goes as it would one by one: what it took part in is kept, its reminders go quiet and say why, private links onto its page stop opening, and the deletion is written to the account log.

The contact representing you cannot be deleted. It is kept and listed with the reason, and the others are still deleted. No endpoint here brings a contact back today, so treat the deletion as final.

## Parameters

- `vault` (string, required): The vault the contact lives in, named either by the readable name it reports as slug or by its id. Both answer.
- `contacts` (array, required): The ids or the addresses of the contacts of this vault to delete. At most 500.

## Returns

Which contacts were deleted, and which were kept with the reason. A vault belonging to somebody else answers 404. More than 500 contacts answers 422 on contacts, and a contact that is not in the vault answers 422 on its position in the list. A contact already deleted is skipped and appears in neither list. Nothing is deleted when the call is refused.

- `data` (object): What the deletion did.
- `data.type` (string): Always contact_deletion.
- `data.attributes` (object): Who was deleted and who was kept.
- `data.attributes.deleted` (array): The contacts deleted.
- `data.attributes.deleted[]` (string): The id of one of them.
- `data.attributes.kept` (array): The contacts that could not be deleted.
- `data.attributes.kept[]` (object): One of them.
- `data.attributes.kept[].contact` (string): The id of the contact.
- `data.attributes.kept[].reason` (string): Why it was kept, in the language of the account.

## 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/contacts \
  -X DELETE \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "contacts": [
          "c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364"
      ]
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts', {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    contacts: ["c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364"],
  }),
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->delete('https://my.monicahq.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts', [
    'contacts' => ['c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364'],
]);
```

## Response

`200`

```json
{
    "data": {
        "type": "contact_deletion",
        "attributes": {
            "deleted": [
                "c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364"
            ],
            "kept": [
                {
                    "contact": "6f3c1d2e-8a4b-4c5d-9e6f-7a8b9c0d1e2f",
                    "reason": "This is the contact that represents you, and it stays. Everything on the record is written from its point of view."
                }
            ]
        }
    }
}
```
