# Delete a folder

`DELETE /api/v1/vaults/{vault}/knowledge/folders/{folder}`

Delete a folder of a vault's Knowledge, moving its notes and lists to another folder or deleting them with it.

Name another folder of the same vault as move_to to keep the notes and lists. Without it they are deleted for good with the folder.

The last folder of a vault cannot be deleted, and is refused with 422 and “The last folder cannot be deleted. Knowledge needs at least one.”

The change is written to the account log.

## Parameters

- `vault` (string, required): The vault, named either by the readable name it reports as slug or by its id. A vault of another account answers 404.
- `folder` (uuid, required): The id of the folder. A folder of another vault or of another account answers 404.
- `move_to` (uuid, optional): The id of another folder of the vault, to move the notes and lists to. A folder of another vault answers 404, and the folder being deleted answers 422.

## Returns

Nothing. A folder of another vault or of another account answers 404.

## 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/dunder-mifflin/knowledge/folders/c6f13a58-4e92-4b07-a1d3-5f8e2c9b7a60 \
  -X DELETE \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "move_to": "2b7e4c91-0d5a-4f38-9c16-8e3a7f1b5d24"
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/vaults/dunder-mifflin/knowledge/folders/c6f13a58-4e92-4b07-a1d3-5f8e2c9b7a60', {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    move_to: '2b7e4c91-0d5a-4f38-9c16-8e3a7f1b5d24',
  }),
})
```

```php
$response = Http::withToken($token)->delete('https://my.monicahq.com/api/v1/vaults/dunder-mifflin/knowledge/folders/c6f13a58-4e92-4b07-a1d3-5f8e2c9b7a60', [
    'move_to' => '2b7e4c91-0d5a-4f38-9c16-8e3a7f1b5d24',
]);
```

## Response

`204`

```json
[]
```
