Permanently Delete File
Permanently Delete File
Once a file has been moved to the trash, it will stay in the trash for 30
days by default before being purged. Administrators of Business or
Enterprise accounts can alter the purge window. If you wish to permanently
delete the file from the trash before the purge window expires, make a DELETE
request to /files/:file_id/trash
using the trashed file's ID
.
cURL
curl -i -X DELETE "https://api.box.com/2.0/files/12345/trash" \
-H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.trashedFiles.deleteTrashedFileById(file.id);
Python Gen
client.trashed_files.delete_trashed_file_by_id(file.id)
.NET Gen
await client.TrashedFiles.DeleteTrashedFileByIdAsync(fileId: file.Id);
Swift Gen (Beta)
try await client.trashedFiles.deleteTrashedFileById(fileId: file.id)
Java
String fileID = "87398";
BoxTrash trash = new BoxTrash(api);
trash.deleteFile(fileID);
Python
file_to_delete = client.file(file_id='11111')
client.trash().permanently_delete_item(file_to_delete)
print('The file was deleted from trash!')
.NET
await client.FilesManager.PurgeTrashedAsync("11111");
Node
client.files.deletePermanently('11111')
.then(() => {
// deletion succeeded — no value returned
});