Trash or restore a file
trash_fileMove a Google Drive file or folder to the trash to delete it reversibly, or restore it later. Trashed items stay recoverable for about 30 days until auto-purge.
Instructions
action=trash moves a file (or folder, with everything inside) to the Drive trash; action=restore brings it back. Trashing is REVERSIBLE — the file stays recoverable until the trash auto-purges it after ~30 days — and is the safe default whenever a user asks to 'delete' something: only use delete_file_forever when they explicitly want it gone beyond recovery. Trashed files disappear from search_files unless include_trashed=true. Only the owner (or a shared-drive member with the right role) can trash; restore puts the file back at its old parent. Returns id, name, trashed and explicitlyTrashed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | trash = move to the trash (reversible); restore = take it back out. | |
| file_id | Yes | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files too. |