## Delete folder

`DELETE /v1/folders/:id`

Deletes a folder. The deletion is soft — the folder is moved to the Bitrix24 trash along with all its contents. A deleted folder cannot be restored via the API.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Folder ID. List: `GET /v1/folders` |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/folders/9301" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/folders/9301" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/folders/9301', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

if (res.status === 204) {
  console.log('Folder deleted')
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/folders/9301', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

if (res.status === 204) {
  console.log('Folder deleted')
}
```

## Response

On successful deletion, HTTP status `204 No Content` is returned with an empty body. Success is signaled by the response code, not the content.

## Response example

```
HTTP/1.1 204 No Content
```

## Error response example

404 — folder not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Could not find entity with id '999999'."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | No folder with the specified `id` |
| 403 | `SCOPE_DENIED` | The API key does not have the `disk` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured portal tokens |

For the full list of common API errors, see [Errors](/docs/errors).

## Known specifics

Deletion marks the folder as deleted and moves it to the trash without erasing it physically. Immediately after deletion, the record is still accessible via `GET /v1/folders/:id` with the `deletedType` field equal to `3` — in the trash. The deleted folder remains in Bitrix24 until the final cleanup.

## See also

- [Create folder](/docs/entities/folders/create)
- [Get folder](/docs/entities/folders/get)
- [Rename folder](/docs/entities/folders/update)
- [Folders](/docs/entities/folders)
