[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Ffiles\u002Fpurge":3,"docs-tabs-entities\u002Ffiles\u002Fpurge":6},{"content":4,"lastmod":5},"## Permanently delete file\n\n`POST \u002Fv1\u002Ffiles\u002F:id\u002Fpurge`\n\nDeletes a file irreversibly, bypassing the Bitrix24 trash: the method accepts both a file in a folder and a file that is already in the trash. To be able to bring the file back, move it to the trash instead.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `id` (path) | number | yes | File ID. List: `GET \u002Fv1\u002Ffiles?folderId=X`. Trashed files do not appear in the list — save the `id` before moving the file to the trash |\n\nNo request body is sent.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F10751\u002Fpurge\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F10751\u002Fpurge\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F10751\u002Fpurge', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n  },\n})\nconst body = await res.json()\nif (!body.success) throw new Error(body.error.code)\nconsole.log('File permanently deleted:', body.data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffiles\u002F10751\u002Fpurge', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\nconst body = await res.json()\nif (!body.success) throw new Error(body.error.code)\nconsole.log('File permanently deleted:', body.data.id)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | `true` — the file is permanently deleted |\n| `data.id` | number | ID of the deleted file |\n| `data.purged` | boolean | Always `true` |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 10751,\n    \"purged\": true\n  }\n}\n```\n\n## Error response example\n\n404 — the file does not exist, including on a repeated permanent deletion:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Could not find entity with id '10751'.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_ID` | `id` is not a positive integer |\n| 401 | `TOKEN_MISSING` | The key's portal has no authorization tokens |\n| 403 | `SCOPE_DENIED` | The key lacks the `disk` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode, and deletion changes portal data |\n| 403 | `BITRIX_ACCESS_DENIED` | The key owner has no permissions on the file in Bitrix24 |\n| 404 | `ENTITY_NOT_FOUND` | No file with this `id`, including on a repeated permanent deletion |\n| 422 | `DISK_DELETE_REFUSED` | Bitrix24 refused to delete the file: the file is locked or protected |\n| 422 | `BITRIX_ERROR` | Bitrix24 refused to delete the file; the reason is in `message` |\n| 429 | `RATE_LIMITED` | Rate limit exceeded — wait 1-2 seconds and retry |\n| 502 | `DISK_OUTCOME_UNKNOWN` | The connection to Bitrix24 dropped after the deletion was sent. The outcome is unknown and the request was not retried. Re-read the file via [`GET \u002Fv1\u002Ffiles\u002F:id`](\u002Fdocs\u002Fentities\u002Ffiles\u002Fget): a `404` response means the file is deleted |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 was unavailable while the file was being read; the deletion was not sent |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**What is deleted along with the file.** All versions of the file, its public link, attachments of this file in tasks, chats, CRM fields and comments, and links to the file in other storages.\n\n**Batch calls.** Permanent deletion is not part of [`POST \u002Fv1\u002Fbatch`](\u002Fdocs\u002Fbatch) — call it as a separate request.\n\n## See also\n\n- [Delete file](\u002Fdocs\u002Fentities\u002Ffiles\u002Fdelete)\n- [Restore file](\u002Fdocs\u002Fentities\u002Ffiles\u002Frestore)\n- [Get file](\u002Fdocs\u002Fentities\u002Ffiles\u002Fget)\n- [Files](\u002Fdocs\u002Fentities\u002Ffiles)\n","2026-10-15",{},1795415249042]