Pagination

Endpoints which return a list of objects follow a common pagination pattern.

Common Standard: Page Based

The common pagination our endpoints follow is page-based. The default number of elements per page is 50, and the maximum allowed is 1000.

Request

When making a GET request, you can specify the following query parameters to control the response:

  • page - specify the desired page number
  • page_size - determine the number of records per page
    For example, the following request would return 30 results, skipping the first 30 on page 1:

GET /orders?page=2&page_size=30

Response

In case of a GET API return a collection of datas, the response will include a pagination object which contains the following details:

  • current_page - the page number you want to begin the search from
  • total_page - the maximum number of objects to be returned from the query
  • total_records - the total number of objects

The structure of the GET reponse is:

    
    {
        "data": [...],
        "pagination": {
            "current_page": 2,
            "total_page": 30,
            "total_records": 250
        }
    }

You should attempt to retrieve the calculated number of pages BUT stop retrieving new pages when the results array is empty.


Did this page help you?