[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Ffolders\u002Fpurge":3,"docs-tabs-entities\u002Ffolders\u002Fpurge":6},{"content":4,"lastmod":5},"## Permanently delete folder\n\n`POST \u002Fv1\u002Ffolders\u002F:id\u002Fpurge`\n\nIrreversibly deletes a folder and all its contents, bypassing the Bitrix24 trash. The method accepts both a folder in storage and a folder that is already in the trash. To be able to bring the folder back, move it to the trash instead.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `id` (path) | number | yes | Folder ID. List: `GET \u002Fv1\u002Ffolders?parentId=X`. Folders in the trash do not appear in the list — save the `id` before moving the folder to the trash. The storage root folder cannot be deleted |\n\nNo request body.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffolders\u002F10741\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\u002Ffolders\u002F10741\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\u002Ffolders\u002F10741\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('Folder permanently deleted:', body.data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ffolders\u002F10741\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('Folder permanently deleted:', body.data.id)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | `true` — the folder is permanently deleted |\n| `data.id` | number | ID of the deleted folder |\n| `data.purged` | boolean | Always `true` |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 10741,\n    \"purged\": true\n  }\n}\n```\n\n## Error response example\n\n400 — the folder is the storage root:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"The storage root folder cannot be permanently deleted.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_ID` | `id` is not a positive integer |\n| 400 | `INVALID_PARAMS` | The folder is the storage root. The request is rejected before it reaches Bitrix24 |\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 for the folder in Bitrix24 |\n| 404 | `ENTITY_NOT_FOUND` | No folder with this `id`, including on a repeated permanent deletion |\n| 422 | `DISK_DELETE_REFUSED` | Bitrix24 refused the deletion. Tree deletion is not atomic: part of the contents may already be deleted — re-read the folder via [`GET \u002Fv1\u002Ffolders\u002F:id`](\u002Fdocs\u002Fentities\u002Ffolders\u002Fget) |\n| 422 | `BITRIX_ERROR` | Bitrix24 refused the deletion; the reason is in `message` |\n| 429 | `RATE_LIMITED` | Request rate limit exceeded — wait 1-2 seconds and retry |\n| 502 | `DISK_OUTCOME_UNKNOWN` | The connection to Bitrix24 dropped after the delete request was sent. The outcome is unknown and the request was not retried. Re-read the folder: a `404` response means the folder is deleted |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 was unavailable while the folder was being read; the delete request was not sent |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**The whole tree is deleted.** All nested folders and files are irreversibly deleted together with the folder, including those in the trash.\n\n**Permissions are checked only on the folder itself.** Nested folders and files are deleted without a separate permission check on each of them.\n\n**Batch calls.** Permanent deletion is not available in [`POST \u002Fv1\u002Fbatch`](\u002Fdocs\u002Fbatch) — call it as a separate request.\n\n## See also\n\n- [Delete folder](\u002Fdocs\u002Fentities\u002Ffolders\u002Fdelete)\n- [Restore folder](\u002Fdocs\u002Fentities\u002Ffolders\u002Frestore)\n- [Get a folder](\u002Fdocs\u002Fentities\u002Ffolders\u002Fget)\n- [Folders](\u002Fdocs\u002Fentities\u002Ffolders)\n","2026-10-15",{},1795415252453]