> For the complete documentation index, see [llms.txt](https://dev.ucommerce.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.ucommerce.net/readme/headless/pagination.md).

# Pagination

`HTTPGET` endpoints have:

* `maxItems` optional parameter to act as a limit for how many results should be returned.
  * The default value is 250
* `nextPagingToken` in the response that can be used in subsequent requests to get the next results page.
  * As long as `nextPagingToken` differs from null, there are more results available.
  * When null, the last page of results has been reached.
  * To request a previous page, the client should keep track of previously requested paging tokens.

## Example

### Request

```bash
curl -D- -X GET <baseUrl>/api/v1/countries?maxItems=3 \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
```

### Response

```json
{
    "countries": [
        {
            "cultureCode": "da-DK",
            "id": "0c53f836-9601-ec11-837b-64bc58542c92",
            "name": "Denmark"
        },
        {
            "cultureCode": "de-DE",
            "id": "1153f836-9601-ec11-837b-64bc58542c92",
            "name": "Germany"
        },
        {
            "cultureCode": "en-GB",
            "id": "0f53f836-9601-ec11-837b-64bc58542c92",
            "name": "Great Britain"
        }
    ],
    "nextPagingToken": "M3wzfGRjMDZlZGYxLTQ2MGQtNGVlZC1hMzMxLWJjNWYwMzI4NDlkNHxGYWxzZQ=="
}
```

## Next Page

```bash
curl -D- -X GET <baseUrl>/api/v1/countries?maxItems=3&nextPagingToken=M3wzfGRjMDZlZGYxLTQ2MGQtNGVlZC1hMzMxLWJjNWYwMzI4NDlkNHxGYWxzZQ== \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
```

## Error Handling

| Error            | Description                                    |
| ---------------- | ---------------------------------------------- |
| BadRequest (400) | Paging token does not match the current query; |


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ucommerce.net/readme/headless/pagination.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
