# Restore an item of the trash

`PUT /api/v1/vaults/{vault}/trash/{kind}/{item}/restoration`

Bring one item back where it was, with everything deleted at the same time as it. A person or a group gets back the reminders their deletion stopped.

An item deleted with a person or a group still in the trash answers 422 on item, saying to restore them first. So does a relationship or a membership whose other end is in the trash, and a record whose type was deleted from the account settings.

## Path parameters

- `vault` (string, required): The vault the trash belongs to, named either by the readable name it reports as slug or by its id.
- `kind` (string, required): The kind of the item, as the list gives it: contact, entity, group, relationship, life-event, reminder, group-membership, group-note or group-file.
- `item` (uuid, required): The id of the item, as the list gives it. One not in the trash of this vault, or belonging to another account, answers 404.

## Returns

What came back.

- `data` (object): The item.
- `data.type` (string): Always trash_item. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.
- `data.id` (string): The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.
- `data.attributes` (object): Everything the record holds.
- `data.attributes.kind` (string): What the item is.
- `data.attributes.title` (string): What the item is called.
- `data.attributes.restored_with` (array): What came back with it, one entry per kind. Empty when nothing did.
- `data.attributes.restored_with[]` (object): One kind that came back.
- `data.attributes.restored_with[].kind` (string): The kind of what came back.
- `data.attributes.restored_with[].count` (integer): How many items of that kind came back.

## 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://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/trash/contact/7c2e9a41-5b8d-4f63-a1e0-3d94b6f2c815/restoration \
  -X PUT \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/trash/contact/7c2e9a41-5b8d-4f63-a1e0-3d94b6f2c815/restoration', {
  method: 'PUT',
  headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->put('https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/trash/contact/7c2e9a41-5b8d-4f63-a1e0-3d94b6f2c815/restoration');
```

## Response

`200`

```json
{
    "data": {
        "type": "trash_item",
        "id": "7c2e9a41-5b8d-4f63-a1e0-3d94b6f2c815",
        "attributes": {
            "kind": "contact",
            "title": "Jan Levinson",
            "restored_with": [
                {
                    "kind": "relationship",
                    "count": 1
                }
            ]
        }
    }
}
```
