Unlink a folder's subtree before deleting it.
POST/api/v1/folders/{folder_id}/prune-subtreefolders:delete
Documents filed in the folder or its subfolders and also in a folder outside are unlinked from the subtree and stay (unlinked_document_ids). Documents filed only inside keep their filing and are returned (exclusive_document_ids) to delete with batch_delete_documents. folder_ids lists the folder and every folder under it, deepest first, to delete with delete_folder once empty. Needs Delete Folders and sight of every folder in the subtree (409 otherwise). Documents you cannot read are counted, not named.
| Scope | folders:delete |
| Asynchronous | No |
| MCP tool | prune_folder_subtree |
| Portal permissions | delete_folders |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
folder_id | path | string | Required | |
Docwize-Version | header | string (date) | Optional | |
Idempotency-Key | header | string | Optional | max 255 |
Responses
| Status | Description | Body |
|---|---|---|
200 | Success. | application/json FolderPruneResult |
400 | invalid_version | application/problem+json Problem |
401 | token_expired, unauthenticated | application/problem+json Problem |
403 | forbidden, insufficient_scope, token_owner_inactive | application/problem+json Problem |
404 | not_found | application/problem+json Problem |
405 | method_not_allowed | application/problem+json Problem |
406 | not_acceptable | application/problem+json Problem |
409 | conflict, idempotency_in_progress | application/problem+json Problem |
421 | wrong_region | application/problem+json Problem |
422 | idempotency_key_reused, validation_failed | application/problem+json Problem |
500 | internal_error | application/problem+json Problem |
503 | tenant_unavailable, unavailable | application/problem+json Problem |
504 | timeout | application/problem+json Problem |
Errors
The problem codes this operation can answer with. Each code links to its page.
Schemas
FolderPruneResult
| Field | Type | Required | Description |
|---|---|---|---|
exclusive_document_ids | array of string | Required | Documents readable by you that are filed only inside the subtree, still filed there: delete them, then the folders. |
folder_ids | array of string | Required | The folder and every folder under it, deepest first. |
hidden_documents | integer | Required | Documents of the subtree you cannot read, filed only inside it or unlinked: counted, not named. ≥ -2147483648; ≤ 2147483647 |
removed_filings | integer | Required | How many filings (document in folder) were removed, documents you cannot read included. ≥ -2147483648; ≤ 2147483647 |
unlinked_document_ids | array of string | Required | Documents readable by you that are also filed outside the subtree and were unlinked from it. |