Paging & Ordering Results
Control result pagination and sorting with limit, offset, and order_by parameters
Results of a query can be paged using the limit and offset query string parameters and ordered using the order_by parameter.
Example Usage
Paging Parameters
| Attribute | Description |
|---|---|
limit=10 | Limit the number of results |
offset=5 | Offset the results from the start of the set |
Paging Examples
Ordering Parameters
| Attribute | Description |
|---|---|
order_by=created_at | Results Ordering |
Ordering Examples
Combined Paging and Ordering
You can combine paging and ordering to get paginated, sorted results:
Best Practices
Pagination
- Use consistent page sizes: Keep your
limitparameter consistent across requests - Handle empty results: Check if the returned array is empty to detect the end of results
- Consider total count: Some endpoints may provide total count information in response headers
Ordering
- Always specify ordering: For consistent pagination, always include an
order_byparameter - Use unique fields for ordering: When possible, include a unique field (like
idorcreated_at) in your ordering criteria - Consider performance: Ordering by indexed fields will perform better than non-indexed fields