↑↓ to navigate ↵ to open Esc to close Search by Algolia

You are reading the documentation of FileRun 2026.4.0, which is not released yet. It is subject to change, so do not use it for planning. Read this page for FileRun 2026.3.0

API: Managing the trash

Available since FileRun 2026.3.0.

Target URL (restore) /api.php/Drive/files/trash/item/restore
Target URL (delete permanently) /api.php/Drive/files/trash/item/delete
Target URL (empty) /api.php/Drive/files/trash/empty
Required scope delete
HTTP Method POST
Output format JSON

Since FileRun 2026.4.0, the trash is covered by the account permission to delete files (delete_files), which opening the trash and restoring an item require. Deleting an item permanently and emptying the trash require the permission to delete permanently (delete_permanently) as well. Before, the trash was covered by the permission to make changes.

Trash item paths

An item in the trash is identified by the id of its trash record, in a path of the form /ROOT/TRASH/1234. The trash keeps the original name of an item, so several trashed items can share the same name. Only the record id tells them apart. There are two ways to obtain the path of a trashed item:

  • the response of the delete endpoint carries it as trash_path;
  • the listing of /ROOT/TRASH carries it as the relativePath of each item.

An item deleted inside a shared drive goes to the trash of the drive, /ROOT/DRIVES_TRASH/{id}, where {id} is the id of the drive, so its path has the form /ROOT/DRIVES_TRASH/{id}/1234. Only the members whose role in the drive is drive_manager can open that trash ("Only a manager of the shared drive can open its trash!").

The endpoints refuse a path which names no trash record ("Trash item not found!"), a path outside the trash ("The item is not inside the trash folder!") and a trash record of another account ("Trash item belongs to another user!").

Restoring an item

Parameter Type Required Description
path string Yes The trash path of the item, see above.

The item is moved back to the folder it was deleted from, together with its contents when it is a folder. If that folder no longer exists, the item is placed in the home folder of the account, or at the top of the shared drive it was deleted from. The response carries the FileRun path the item was restored to as restored_path.

If the original name is taken by another item in the meantime, the restoration is refused and the item stays in the trash.

Deleting an item permanently

Parameter Type Required Description
path string Yes The trash path of the item, see above.

The item is removed for good, together with its contents when it is a folder. There is no way back afterwards.

Emptying the trash

Parameter Type Required Description
path string No The trash to empty: /ROOT/TRASH, the trash of the account (the default), or /ROOT/DRIVES_TRASH/{id}, the trash of a shared drive. Since FileRun 2026.4.0.

Every item in that trash is removed for good. A path which is not a trash folder is refused ("The path is not a trash folder!"). The response carries the number of removed items as deleted_count.