# Pagination

Most of the actions that list multiple records, have common interface for paginating them.

## Pagination params

Following query params allow to control the returned results lists.

| Key             | Type    | Description                                             |
|-----------------|---------|---------------------------------------------------------|
| page_no         | integer | Number of results page (default: 1)
| per_page        | integer | Number of results that should be returned per request (default: depends on the endpoint) |

## PaginationInfo object

The paginated response along with returned records will also contains also a PaginationInfo object.

It contains information about paginated records list. May be used to traverse the list.

| Key             | Type    | Description                                             |
|-----------------|---------|---------------------------------------------------------|
| total_count     | integer | Number of all available results                         |
| per_page        | integer | Number of results returned per request                  |
| total_pages     | integer | Number of all available pages                           |
| current_page    | integer |                                                         |
| next_page       | integer | Next available page (`null` when it's a last page)      |
| prev_page       | integer | Previous available page (`null` when it's a first page) |
| is_first_page   | boolean |                                                         |
| is_last_page    | boolean |                                                         |
| is_out_of_range | boolean | Is given `per_page` param out of range?                 |

### Example

Example API response containing records and PaginationInfo object:

```json
{
  "records": [
    // (...)
  ],
  "pagination_info": {
    "total_count": 2050,
    "per_page": 1000,
    "total_pages": 3,
    "current_page": 1,
    "next_page": 2,
    "prev_page": null,
    "is_first_page": true,
    "is_last_page": false,
    "is_out_of_range": false
  }
}
```