Skip to content
— Ticketing that leaves the money with the organizer.

Pagination

Every list answers one page at a time:

{
  "items": [{ "id": "…" }, { "id": "…" }],
  "nextCursor": "eyJ0IjoiMjAyNi0xMC0yNFQxMDowMDowMC4wMDBaIn0"
}
  • limit — how many items a page holds, 1 to 100 (25 when you do not say).
  • cursor — pass the previous page's nextCursor to get the next page. Leave it out for the first; an empty cursor= means the same. One this API did not give out answers 400 api.bad_cursor.
  • nextCursor: null — this was the last page.

Lists are newest first. A cursor marks a place in the list rather than a page number, so items created while you read never make you see one twice or skip one; a new item simply appears at the top, where your next full read will find it.

A cursor is opaque: pass it back exactly as you got it, with the same filters, and do not build one yourself. It does not expire, but it belongs to the list it came from.

Reading everything

cursor=""
while :; do
  page=$(curl -s "https://api.lupeno.com/v1/events/$EVENT_ID/orders?limit=100&cursor=$cursor" \
    -H "Authorization: Bearer $LUPENO_API_KEY")
  echo "$page" | jq -r '.items[] | "\(.number) \(.state)"'
  cursor=$(echo "$page" | jq -r '.nextCursor // empty')
  [ -z "$cursor" ] && break
done

With the SDK, paginate does the loop and yields one item at a time:

import { paginate } from '@lupeno/sdk';

for await (const order of paginate((cursor) =>
  lupeno.GET('/v1/events/{eventId}/orders', {
    params: { path: { eventId }, query: { cursor, limit: 100 } },
  }),
)) {
  console.log(order.number, order.state);
}

Staying in sync

To keep a copy of your orders current, read everything once, then let webhooks tell you what changes — rather than reading every list again on a timer. They do not tell everything: an approval or decline and an unpaid order going overdue have no event (what webhooks do not tell), so re-read the orders that were still waiting, by id or with the list's state filter. A bundle order is listed on every event it includes (1.12.0): keep it once, by its id. A full read of a large event at 100 items a page stays far below the rate limit.

NextIdempotency