> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qontext.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> List files and folders with cursor pagination and exact-path or parent filters.

File and folder lists use cursor pagination. Search accepts a result limit but does not support paging through further results.

## Read every page

```bash theme={null}
curl --fail-with-body --get https://api.qontext.ai/v1/files \
  -H "Authorization: Bearer $QONTEXT_API_KEY" \
  --data-urlencode "limit=100" \
  --data-urlencode "path_prefix=/support"
```

The response has `object: "list"`, `url`, `data`, `hasMore`, and `nextCursor`.

1. Process the items in `data`.
2. If `hasMore` is `true`, send `nextCursor` as the next request's `cursor`.
3. Keep the same filters and continue until `hasMore` is `false`.

A short or empty page does not establish that the list is complete. Access controls can remove items from a page; use `hasMore` to decide whether to continue.

Treat cursors as opaque strings. Do not construct or parse them. Changing filters requires starting again without a cursor.

## Choose a selector

Use at most one selector per request:

| Selector      | Files                             | Folders                             |
| ------------- | --------------------------------- | ----------------------------------- |
| None          | All readable files                | Root folders                        |
| `path`        | File at the exact path            | Folder at the exact path            |
| `path_prefix` | Files below a folder, recursively | Folders below a folder, recursively |
| `parent_id`   | Files directly in a folder        | Folders directly in a folder        |

An exact path with no matching item returns an empty list. It does not return a resource-not-found error.

`GET /v1/folders` is the one exception: a `parent_id` that names no folder returns `404 folder_not_found`. Every selector on `GET /v1/files`, and the other selectors on `GET /v1/folders`, return an empty list instead.

`limit` defaults to `100` and accepts values from `1` to `1000`. See [List files](/api-docs/files/list-files) and [List folders](/api-docs/folders/list-folders) for the complete parameters.

## Search results

Both searches use the list envelope, but return `hasMore: false` and `nextCursor: null`. The result limit caps one response; it is not a page size for a resumable search.
