Distinguish unavailable and unauthorized API files
Interpret file 404 and 403 responses without probing unrelated identifiers, leaking a hidden resource, or mistaking a permissions failure for deletion.
Last reviewed
A file request can return 404 to avoid disclosing a resource, so status alone cannot prove whether a record was deleted. Diagnose only identifiers your integration already received legitimately.

What each response can mean
For GET /api/files/:id, 404 File not found covers an unknown or unresolvable id, a file hidden from this requester, and a WordPress-site key aimed outside its site folder. That shared answer prevents existence disclosure.
A resolved file can return 403 Access denied when its workspace membership is missing. Other 403 bodies identify a narrower cause: You don't have access to the files page, This file is outside the folder you're confined to, a structured folder_locked result, workspace-pin mismatch, or API-key scope and surface rejection.
Steps
- Start with a file id previously returned to the same integration and note the expected workspace, folder, and key identity.
- Confirm that the credential is complete, unexpired, allowed on the REST API surface, and not anchored to a folder.
- Compare its workspace pin with the known file workspace and check that the current member still belongs there.
- Request
GET /api/files/:id, retaining the exact status and redacted error body rather than collapsing both into “missing.” - For 403, resolve the named scope, surface, pin, role, confinement, or lock rule; for 404, check trusted application state and the Dosya UI instead of probing adjacent ids.
- Retry the known id only after correcting the relevant condition, then treat a continuing privacy-preserving 404 as unavailable to that caller.
Safe client behavior
Do not enumerate guessed file_… values to distinguish the cases. A hidden file deliberately behaves as absent. A folder-anchored ordinary API key is refused on all REST file requests before this handler, even when its anchor contains the file; use WebDAV or S3 for that credential design.
The structured locked response is HTTP 403 with error:"folder_locked", its folder_id, and lock_mode:"full_lock". It gives a caller with legitimate access enough information to follow the unlock flow while a hidden file remains a 404.
Expected result
The client preserves privacy by treating 404 as unavailable, surfaces precise 403 causes to an authorized operator, and never uses unrelated identifiers to infer whether private data exists.

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.