Pagination

How to paginate through API results

The Lirium API uses cursor-based pagination for resource collections.

Pagination Parameters

ParameterDescription
starting_afterReturn resources listed after the specified cursor value
ending_beforeReturn resources listed before the specified cursor value
limitMaximum number of results to return (page size)

Note: starting_after and ending_before are mutually exclusive. Only one may be used per request.

Response Format

All paginated responses include a pagination object alongside the collection of results. The collection is not returned under a generic data key — it is named after the resource for each endpoint (e.g. orders for order search, customers for customer search, events for webhook event search, partner_orders for partner order search):

{
  "orders": [
    ...
  ],
  "pagination": {
    "ending_before": "20210109013316841679",
    "starting_after": "20210109013316841679",
    "limit": 10
  }
}

Navigation

  • Use starting_after from the response to navigate to the next page
  • Use ending_before from the response to navigate to the previous page

Empty Results

When there are no results, both starting_after and ending_before will be null.

To avoid losing your cursor position:

  • If using starting_after and you receive an empty response, there is no next page
  • If using ending_before and you receive an empty response, there is no previous page

Did this page help you?