> For the complete documentation index, see [llms.txt](https://help.bioinsight.illumina.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.bioinsight.illumina.com/connected-analytics/api-access/api-concepts/pagination.md).

# Pagination

## Cursor- versus Offset-based Pagination

Cursor-based pagination is fast, but does not support sorting, while offset-based pagination is slower, but supports sorting. **If no pagination method is selected** in the API call, the sort parameter is used to choose the default pagination.

* When no sorting is set, cursor based pagination will be used by default.
* When sorting is requested, offset-based pagination is used.

### Cursor-based pagination

Uses a pointer to a specific record and then returns the records following this record. It is able to handle data updates without skipping records or displaying them twice and at a faster speed, but can only handle small data jumps. There is also no easy option to sort or no way to skip pages, so if you want page X, all pages leading up to X must also be requested because each page contains the pointer to the next page.

Cursor-based pagination uses the parameter `pageSize` (amount of rows to return) in combination with `pageToken` (the cursor to get subsequent results). The parameter `remainingRecords` shows the number of records after the current cursor which are not shown. `remainingRecords` is an approximation only, as this number can increase or decrease while you are paging because records might be added or removed.

#### **Example**

Suppose a list of projects, with 2 projects returned per page (enter your API key in the YOUR\_API\_KEY part of the expression)

{% code overflow="wrap" fullWidth="false" %}

```
https://ica.illumina.com/ica/rest/api/projects?includeHiddenProjects=false&pageSize=2' \ -H 'accept: application/vnd.illumina.v3+json' \ -H 'X-API-Key: YOUR_API_KEY
```

{% endcode %}

```sh
'https://ica.illumina.com/ica/rest/api/projects?includeHiddenProjects=false&pageSize=2' \
-H 'accept: application/vnd.illumina.v3+json' \
-H 'X-API-Key: YOUR_API_KEY'
```

The response will contain a pointer to the next page `"nextPageToken": "A_STRING_OF_LETTERS_AND_NUMBERS"` You then use that pointer (the string of numbers and letters) to get the next 2 entries by replacing A\_STRING\_OF\_LETTERS\_AND\_NUMBERS by the returned next page token

{% code fullWidth="false" %}

```sh
curl -X 'GET' \
  'https://ica.illumina.com/ica/rest/api/projects?includeHiddenProjects=false&pageToken=A_STRING_OF_LETTERS_AND_NUMBERS_HERE&pageSize=2' \
  -H 'accept: application/vnd.illumina.v3+json' \
  -H 'X-API-Key: YOUR_API_KEY'
```

{% endcode %}

### Offset-based pagination

Returns records based on their position in a table. The data set is divided into pages and the offset parameter is used to determine which page to display. Offset pagination can quickly perform large jumps in data because you do not need to query previous pages and it allows custom sorting. The downside is that offset-based pagination is susceptible to missing records or displaying records twice when there have been updates while it is paginating.

In Platform Core, offset-based pagination is limited to 200.000 rows, and does not guarantee unique results across all pages as data can be updated during pagination.

Offset pagination uses the parameter `pageSize` (amount of rows to return) in combination with `pageOffset` (amount of rows to skip) and `totalItemCount` (The total number of records matching the search criteria). The larger your page size is, the slower the response time.

#### **Example**

`GET /api/projects/{projectId}/analyses` with `pageOffset` to 0. This will return the `totalItemCount`. If you want to sort the results, you can use `reference desc`for descending)

`curl -X 'GET' \'<SERVER>/ica/rest/api/projects/<PROJECT_ID>/analyses?pageOffset=2&pageSize=2&sort=reference%20desc' \ -H 'accept: application/vnd.illumina.v3+json' \ -H 'X-API-Key: <AUTH_KEY>'`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.bioinsight.illumina.com/connected-analytics/api-access/api-concepts/pagination.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
