Paginate through REST API file results
Walk numeric REST file pages from page 1 through total_pages, respect the 10–500 page-size bounds, and prevent duplicate processing during changes.
Last reviewed
File listings use numeric offset pages. There is no continuation token, cursor, or next-page value to save from GET /api/files.

Request and response
Call GET /api/files?workspace_id=wks_…&folder_id=fld_…&page=1&per_page=100. Omit folder_id for workspace root. page defaults to 1; per_page defaults to 100 and is clamped from 10 through 500. Page numbers are capped at 10,000,000, fractions are floored, and malformed values fall back safely.
The response contains folders, paged files, breadcrumbs, resolved workspace_id and folder_id, can_lock, can_hide, folder_view_only, and pagination.
Steps
- Freeze the workspace, folder, filter, search, and sort inputs for the traversal, and choose a
per_pagevalue between 10 and 500. - Request
page=1, requireok:true, and recordpagination.page,per_page,total_files, andtotal_pages. - Process each element of
filesby its stableid; treat thefoldersarray as directory context rather than part of the file-page count. - Increment the numeric page and repeat the identical query until the returned page equals
pagination.total_pages. - Deduplicate file ids and avoid concurrent uploads, moves, or deletes when the run must represent one stable export.
- Reconcile the number of unique processed ids with the visible result set, retaining any 403, 404, 429, or 503 page failure for recovery.
Paging details
pagination.total_files counts files, not folders. total_pages is at least 1 even when no files match. Because this is limit/offset paging, mutations during the run can shift rows between pages; id-based deduplication prevents double processing but cannot recreate a historical snapshot.
The endpoint supports response ETags. A conditional request can return HTTP 304 when the serialized listing is unchanged.
Use a Read only or Full access key with REST enabled and a role holding access_files. Upload only is refused with This credential's scope is 'upload' and cannot perform GET /api/files. Folder-anchored keys cannot use this REST route.
Expected result
The client visits pages 1 through total_pages, processes every visible file id once for the chosen query, and never waits for a continuation field the API does not return.

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.