> ## Documentation Index
> Fetch the complete documentation index at: https://developer-staging.secfix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Read long lists one page at a time with cursors.

Every list endpoint returns one page of `results` and a `pageInfo` object. To get another page, send
a cursor from `pageInfo`. Cursors are opaque strings: don't parse, build, or edit them. Send back
exactly what the API returned.

## Query parameters

| Parameter | Description | Default |
| - | - | - |
| `pageSize` | Results per page, from 1 to 100. | 25 |
| `pageCursor` | `pageInfo.endCursor` for the next page, or `pageInfo.startCursor` for the previous page. Leave it out for the first page. | — |

## Cursors are tied to your filters

A cursor works only for the list and the filters it came from. Send it with the same filter parameters
as the request that returned it. A cursor sent with other filters, to another list, or after any edit
returns `400 validation_failed` on `pageCursor`.

When you change filters, start again from the first page.

## Response

```json theme={null}
{
  "results": [ /* ... */ ],
  "pageInfo": {
    "hasNextPage": true,
    "hasPreviousPage": true,
    "startCursor": "AgEAAAX0bYb1Q0AAJDNmMWM5YTJlLTk0YjEtNGQ3Mi1hN2Q4LTEyMzQ1Njc4OWFiYw",
    "endCursor": "AgAAAAX0bYb1Q0AAJDNmMWM5YTJlLTk0YjEtNGQ3Mi1hN2Q4LTEyMzQ1Njc4OWFiYw",
    "pageCount": 25,
    "totalCount": 312
  }
}
```

| Field | Description |
| - | - |
| `hasNextPage` | `true` if another page follows this one. |
| `hasPreviousPage` | `true` if a page comes before this one. |
| `endCursor` | Cursor for the next page. Left out when there is no next page. |
| `startCursor` | Cursor for the previous page. Left out when the page is empty and no page comes before it. |
| `pageCount` | Number of results on **this** page. |
| `totalCount` | Number of results that match your filters on **all** pages, at the time of the request. |

`totalCount` doesn't depend on `pageCursor` or `pageSize`. It stays the same on every page unless
results are added or removed while you page. If nothing changes, the `pageCount` values of all pages
add up to `totalCount`.

Results come in a stable order, so paging stays consistent when results are added or removed between
requests.

## Read every page

Get the first page. Then, while `pageInfo.hasNextPage` is `true`, send `pageInfo.endCursor` as
`pageCursor`:

```bash theme={null}
# first page
curl "https://api.secfix.com/v1/inventory/assets?pageSize=50" \
  -H "Authorization: Bearer $TOKEN"

# next page
curl "https://api.secfix.com/v1/inventory/assets?pageSize=50&pageCursor=AgAA..." \
  -H "Authorization: Bearer $TOKEN"
```

When `hasNextPage` is `false`, there is no `endCursor` and you have read every result.

To go back one page, send `pageInfo.startCursor` as `pageCursor`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.