Pagination

All top-level API resources have support for bulk fetches through "list" API methods. For example, you can list debts, list customers, and list organisations.
Search endpoints also support pagination.

These list API methods share common structure and accept, at a minimum, the following parameters: limit, after, and before.

Ophelos's API methods use cursor-based pagination through the after and before parameters.
Both parameters accept an existing object ID value and return objects in reverse chronological order.
The before parameter returns objects listed before the named object.
The after parameter returns objects listed after the named object.
These parameters are mutually exclusive. You can use either the before or after parameter in a request, but not both simultaneously.

Headers for pagination are included in the response, providing information about the total number of objects in the list and the URL for the next and previous pages.

Example pagination

curl https://api.ophelos.com/debts?limit=3
  -H "Authorization: Bearer sk_prod_H4x0rN0t4R3alAPiK3y" \
  -I
HTTP/1.1 200 OK
Link: <https://api.ophelos.com/debts?after=deb_356zDAP4QelkLHW7Vdnb9OrZ&limit=3>; rel="first",
  <https://api.ophelos.com/debts?after=deb_YZOxn2vwl7qWbhwa3Q6PNJkM&limit=3>; rel="next",
  <https://api.ophelos.com/debts?after=deb_ykXQ1JqWZ7bbRTo7xMzN6j3g&limit=3>; rel="prev"
X-Total-Count: 34
X-Page-Items: 10