# Pagination

This document describes the pagination implementation used across all xMoney API listing endpoints.  All list operations that return multiple resources use the same pagination structure and parameters.

## Pagination response

The API response for listing resources will include a `pagination` object with the following structure:


```json
{
  "code": 200,
  "message": "Success",
  "pagination": {
    "currentPageNumber": 1,
    "totalItemCount": 10,
    "itemCountPerPage": 100,
    "currentItemCount": 10,
    "pageCount": 1
  },
  "data": []
}
```

Here's a breakdown of each field:


```json
{
  "$ref": "#/components/schemas/Pagination",
  "components": {
    "schemas": {
      "Pagination": {
        "type": "object",
        "properties": {
          "currentPageNumber": {
            "description": "The current page number being returned.",
            "type": "integer",
            "default": 1
          },
          "totalItemCount": {
            "description": "The total number of items across all pages.",
            "type": "integer"
          },
          "itemCountPerPage": {
            "description": "The number of items returned per page (as requested).",
            "type": "integer",
            "default": 100
          },
          "currentItemCount": {
            "description": "The number of items in the current response. This might be less than `itemCountPerPage` on the last page.",
            "type": "integer"
          },
          "pageCount": {
            "description": "The total number of pages available.",
            "type": "integer"
          }
        }
      }
    }
  }
}
```

## Pagination parameters

The following query parameters can be used to control pagination:

| Parameter | Description | Default |
|  --- | --- | --- |
| `page` | Specifies the page of results to retrieve. | 1 |
| `perPage` | Controls the number of items returned per page. | 100 |
| `reverseSorting` | Controls the sorting order of results. 0 (oldest to newest), 1 (newest to oldest). | 1 |