# Pagination
For endpoints with List requests, the API returns 50 objects per page. You need to navigate through pages if you want to get the full list of objects
Pagination parameter can be added as below
page: defines which page you want to access and is added as a parameterpage=page_numberin the request
For each list request, the API will return list of requested objects with pagination details
Important Note:
List /orders have different pagination mechanism, which is explained in the List /orders request
If you try to paginate /orders using the page parameter, you will be limited to 10 pages max, the API will stop returning orders after the 10th page
# Pagination Details
Sample
"links": {
"first": "URL/api/customers?page=1",
"last": "URL/api/customers?page=3",
"prev": "URL/api/customers?page=1",
"next": "URL/api/customers?page=3"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 3,
"path": "URL/api/customers",
"per_page": 50,
"to": 50,
"total": 120
}
| Field Name | Description |
|---|---|
links.first | Link of the first page of the requested object |
links.last | Link of the last page of the requested object |
links.prev | Link of the previous page of the requested object, e.g. if you are in page 2 currently then this link will be for page 1. If no previous page, this field will be null |
links.next | Link of the next page of the requested object, e.g. if you are in page 2 currently then this link will be for page 3. If no next page, this field will be null |
meta.current_page | The current page returned in the response |
meta.from | The count of the first object in the current page. If selected page is empty, this will be null |
meta.last_page | The last available page that has data |
meta.path | The API path for the current page |
meta.per_page | How many objects are returned per page |
meta.to | The count of the last object in the current page. If selected page is empty, this will be null |
meta.total | Total number of available objects in this endpoint |
If page is not defined in the request, the API will return the first page
# Pagination Sample
You have 120 customers in the system, using GET URL/api/customers:
- If page is not defined in the request
GET URL/api/customers
API Response
"links": {
"first": "URL/api/customers?page=1",
"last": "URL/api/customers?page=3",
"prev": null,
"next": "URL/api/customers?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 3,
"path": "URL/api/customers",
"per_page": 50,
"to": 50,
"total": 120
}
- If page is defined as page 1
GET URL/api/customers?page=1
API Response
"links": {
"first": "URL/api/customers?page=1",
"last": "URL/api/customers?page=3",
"prev": null,
"next": "URL/api/customers?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 3,
"path": "URL/api/customers",
"per_page": 50,
"to": 50,
"total": 120
}
- If page is defined as page 2
GET URL/api/customers?page=2
API Response
"links": {
"first": "URL/api/customers?page=1",
"last": "URL/api/customers?page=3",
"prev": "URL/api/customers?page=1",
"next": "URL/api/customers?page=3"
},
"meta": {
"current_page": 2,
"from": 51,
"last_page": 3,
"path": "URL/api/customers",
"per_page": 50,
"to": 100,
"total": 120
}
- If page is defined as page 3
GET URL/api/customers?page=3
API Response
"links": {
"first": "URL/api/customers?page=1",
"last": "URL/api/customers?page=3",
"prev": "URL/api/customers?page=2",
"next": null
},
"meta": {
"current_page": 3,
"from": 101,
"last_page": 3,
"path": "URL/api/customers",
"per_page": 50,
"to": 120,
"total": 120
}
- if page is defined as > last page,
GET URL/api/customers?page=4
API Response
"links": {
"first": "URL/api/customers?page=1",
"last": "URL/api/customers?page=3",
"prev": "URL/api/customers?page=3",
"next": null
},
"meta": {
"current_page": 4,
"from": null,
"last_page": 3,
"path": "URL/api/customers",
"per_page": 50,
"to": null,
"total": 120
}
← Errors Includables →