## Permanently delete file

`POST /v1/files/:id/purge`

**Permanently deletes the object, bypassing trash.** Accepts live and trashed objects. To keep the option to restore, use `DELETE /v1/files/:id`.

## Parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | yes | Positive safe integer |

Key scope: `disk`. No body required.

## curl

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/files/42/purge" -H "X-Api-Key: YOUR_API_KEY"
```

## JavaScript

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/files/42/purge", {
  method: "POST",
  headers: { "X-Api-Key": "YOUR_API_KEY" },
});
const data = await response.json();
```

## Response

```json
{
  "success": true,
  "data": {
    "id": 42,
    "purged": true
  }
}
```

## Errors

400 INVALID_ID / INVALID_PARAMS; 401 TOKEN_MISSING; 403 SCOPE_DENIED / BITRIX_ACCESS_DENIED / WRITE_BLOCKED_READONLY_KEY; 404 ENTITY_NOT_FOUND; 422 BITRIX_ERROR / DISK_DELETE_REFUSED; 429; 502 DISK_OUTCOME_UNKNOWN / BITRIX_UNAVAILABLE; 503.

A READONLY key cannot perform this action. A missing object and a repeated successful purge return 404.

## Known behavior

Deletes all file versions, public links, attachments in tasks, chats, CRM fields and comments, and linked copies in other storages.

Only `deletedType != 0` indicates trash: `deletedAt` and `deletedBy` are not cleared after restoration. Writes are never automatically retried. A network interruption leaves the outcome unknown: read the object before retrying. Batch does not support these dedicated actions.

Bitrix24: `disk.file.delete`.

## See also

- [DELETE](/docs/entities/files/delete)
- [Restore](/docs/entities/files/restore)
