# Pagination

## Pagination

The CAMS API uses cursor based pagination using the following query parameters:

* `after` A cursor for use in pagination. `after` is the token of the last item retrieved from the previous page. By placing the `after` token in the argument, you are requesting the list *after* that cursor.
* `limit` A string representation of an integer that defines the maximum number of list items to return in the response. The maximum `limit` allowed is dependent on the server's maximum setting.

#### Paginated Responses <a href="#paginated-responses" id="paginated-responses"></a>

Not all queries are paginated. Those which are will return a response with the following format: {items: \[ Items ],after: "c3f7d835-795d-4ce3-ac1b-2b1e288be8b0",totalCount: 100,}

* `items` The items are the data in the current page
* `after` This field in the response can be used directly in place of the `after` query parameter to retrieve the next page of data in the list. It will correlate directly to the token of the last item in the list
* `totalCount` The `totalCount` field is the total number of items in the entire data set

**Last page**

If the `after` field returned in the query is `null`, this means you have retrieved the last page in the data set, and no more items are available.

**Filters and Sorting**

Note that the pages in a list only correlate to one another should the filters and sorting remain the same for all queries. Should either change, the paging process will likely need to be restarted.
