Pagination
All top-level API endpoints have support for bulk fetches via "list" API methods.
Some endpoints will return data in a paginated list. A paginated response will look similar to this:
1
{
2
"data": [
3
//...
4
],
5
"links": {
6
"first": "https://yourwebsite.com/account/api/users?page=1",
7
"last": "https://yourwebsite.com/account/api/users?page=1",
8
"prev": null,
9
"next": null
10
},
11
"meta": {
12
"current_page": 1,
13
"from": 1,
14
"last_page": 1,
15
"path": "http://yourwebsite.com/account/api/users",
16
"per_page": 15,
17
"to": 15,
18
"total": 15
19
}
20
}
Copied!
As per the example above, each paginated response will have the data array, which contains all the items from the specific page, a links object with full URLs for fetching first, last, prev and next pages, and the meta object which contains all the info about the resource you are paginating.
Some endpoints allow you to specific number of records that you want to receive per page. To achieve that you can append the per_page=X parameter to the URL of the request. For example, if you want to request 50 users per page, the URL parameters should look like the following:
1
/users?per_page=50
Copied!
Pagination limit is set to 100 for most resources which means that you cannot request more than 100 records per page. If you provide a larger number, it will be ignored and 100 records per page will be returned.
To request a different page, just append the page=X parameter to the URL. For our customers example above, you can get the second page like following:
1
/users?per_page=50&page=2
Copied!
Last modified 10mo ago
Copy link