Pagination

All top-level API resources have support for bulk fetches via "list" API methods. For instance, you can list accounts (wallets), exchange operations, payment orders, deposits and withdrawals. These list API methods share a common structure, taking parameters shown in the following table:

ParameterTypeExplanation
dateFrom/createdFromstring (date)Start date to filter records. Only returns records created on or after this date.
dateTo/createdTostring (date)End date to filter records. Only returns records created on or before this date.
pageintThe page number you want to retrieve.
sizeintThe number of items (or results) per page.
pagedboolSpecifies whether the response should be paginated. When set to false, the page and size parameters are ignored.

📘

paged

Certain endpoints allow pagination, though they may not all use the paged parameter. When paged is unavailable, but page and size are present, the results will be paginated by default.

The response of a list API method represents a single page in a reverse chronological stream of objects. If you do not specify dateFrom or dateTo, you will receive the first page of this stream, containing the newest objects.

page and size explained

The logic is that each page represents a chunk of the results. By specifying page and size, you’re telling the API where to start in the list of results and how many items to retrieve in that chunk:

  • The API calculates the starting point by: starting point = page * size.
  • Then, it retrieves size number of results from that starting point.

Example:

GET /public/accounts/?page=2&paged=true&size=2

Here we use GET /public/accounts/ endpoint with specified query parameters:

  • page=2
  • paged=true
  • size=2

Response:

{
    "content": [
        {
            "id": "5a6d01e6-5a1c-4057-b288-8d8b9bfb4dd4",
            "currencyCode": "XAU",
            "label": null,
            "hideIfEmpty": false,
            "balance": "0",
            "totalBalance": "0",
            "availableBalance": "0",
            "reservedAmount": "0",
            "reservedBalance": "0",
            "sortIndex": 5,
            "cryptoAddress": null,
            "message": null,
            "iban": null,
            "isNew": false,
            "isCurrencyNewlySupported": false,
            "currencyName": "Gold",
            "hideBalance": false,
            "ibanInfo": null
        },
        {
            "id": "99c32b52-665f-43d6-8e6d-badf8a670936",
            "currencyCode": "DASH",
            "label": null,
            "hideIfEmpty": false,
            "balance": "0",
            "totalBalance": "0",
            "availableBalance": "0",
            "reservedAmount": "0",
            "reservedBalance": "0",
            "sortIndex": 6,
            "cryptoAddress": null,
            "message": null,
            "iban": null,
            "isNew": false,
            "isCurrencyNewlySupported": false,
            "currencyName": "DASH",
            "hideBalance": false,
            "ibanInfo": null
        }
    ],
    "pageable": {
        "sort": {
            "sorted": false,
            "empty": true,
            "unsorted": true
        },
        "pageSize": 2,
        "pageNumber": 2,
        "offset": 4,
        "paged": true,
        "unpaged": false
    },
    "totalPages": 28,
    "totalElements": 56,
    "last": false,
    "number": 2,
    "size": 2,
    "numberOfElements": 2,
    "sort": {
        "sorted": false,
        "empty": true,
        "unsorted": true
    },
    "first": false,
    "empty": false
}

In the response, as we can see two accounts have been retrieved. Based on the specified formula, fifth and sixth instance with sortIndex: 5 and sortIndex: 6 were shown.