Move a file to Deleted items through the API
Trash a file idempotently with trash_only, verify it in the deleted listing, and avoid a second bare DELETE that permanently erases every version.
Last reviewed
Use DELETE /api/files/:id?trash_only=1 when automation intends a recoverable delete. The safeguard makes repeated delivery harmless. A bare DELETE is state-dependent: it trashes a live file, but permanently purges an already trashed file.

Before you start
- Use a full-access API key. The workspace role needs
delete_own_filesfor the caller’s files ordelete_any_filefor other owners’ files. - Record the file ID, name, version count, and current parent before deletion.
- Deleted items continue to consume storage until permanent purge. Purge is irreversible.
Steps
- Read the target metadata and confirm the ID belongs to the intended workspace. Stop if it is already deleted unless the job explicitly handles that state.
- Send
DELETE /api/files/file_id?trash_only=1with the bearer key. Keeppermanent=1out of the request; the two flags must not be combined. - Accept
{ "ok": true, "permanent": false }for the first trash action. A repeated safe request may return{ "ok": true, "already_trashed": true }. - Query
GET /api/files?deleted=1and locate the same ID. Its absence from the normal listing alone is insufficient evidence because filters and pagination can also hide an item. - Store the trash receipt with the job record. Do not issue an unqualified second DELETE as a generic retry because the server would interpret the trashed state as permission to purge.
- If permanent removal is explicitly approved, send
DELETE /api/files/file_id?permanent=1and verify disappearance from the deleted listing. Treat that action and all versions as unrecoverable.

Expected result
The safe request moves a live file to Deleted items, and repeating it reports already_trashed instead of purging. Storage usage falls only after a separately requested permanent deletion.
Troubleshooting
The file is not in the deleted listing. Check pagination, workspace, and the response status before retrying.
The request returns 403. Confirm full key scope, ownership permission, and lock rules.
A bare DELETE response was lost. Inspect both normal and deleted listings before any new call. Never use an unqualified retry against an item that might already be trashed.
Related guides
Was this helpful?
Loading helpfulness results…
Voting saves a necessary ballot cookie for up to 180 days so you can change your answer.
Questions and replies
Ask about the steps in this guide. Questions are reviewed before publication.
Keep account details, credentials and private files out of public questions. Use private support for those.
Loading questions…
Sign in to your Dosya account to ask a question.