GET /events and
GET /orders return one page at a
time and a cursor for the next page.
How do I page through a list?
- Make the first request without
cursor. - If the response has a
next_cursor, pass it unchanged ascursoron the next request, with the same filters. - Stop when there is no next cursor. Don’t stop because a page is short or
empty: an orders page can have fewer rows than
limitand still have anext_cursor.
Write your loop to stop on “no usable cursor” and it handles both:
Cursor rules
- Cursors are opaque. Do not parse, build or modify them.
- Reuse a cursor only with the filters that produced it. Changing
event_id,statusororder_typemid-loop gives you a page you didn’t ask for. - A malformed cursor is
400 invalid_cursor(on events, also for a cursor from another organization). - Cursors are for walking a list now, not bookmarks to keep for later.