Pagination

Lists come a page at a time. Ask for the next page with the cursor the last one gave you, until has_more is false.

The list object

JSON
{
  "object": "list",
  "url": "/api/v1/orders",
  "has_more": true,
  "next_cursor": "eyJwIjoyfQ",
  "data": [ { "object": "order", "id": "O-7KQ2M4X", "...": "..." } ]
}
  • data holds this page’s objects, in the order the endpoint describes (newest first for orders, soonest first for events).
  • has_more is true when there is another page.
  • next_cursor is what to send as cursor for that page, or null on the last one. Treat it as an opaque string: it is only valid for the same list.

Parameters

ParameterWhat it does
limitResults a page, from 1 to 100. Default 25. Anything else is invalid_limit.
cursorThe next_cursor of the page before. A cursor the API did not make is invalid_cursor.

Send the same filters (such as event_id or q) with every page of one list.

Every page

async function* allOrders(eventId) {
  let cursor = null;
  do {
    const q = new URLSearchParams({ event_id: String(eventId), limit: "100" });
    if (cursor) q.set("cursor", cursor);
    const res = await fetch(`https://eos.aveoevents.com/api/v1/orders?${q}`, {
      headers: { Authorization: `Bearer ${process.env.EOS_API_KEY}` },
    });
    const page = await res.json();
    if (!res.ok) throw new Error(page.error.message);
    yield* page.data;
    cursor = page.next_cursor;
  } while (cursor);
}

for await (const order of allOrders(41)) console.log(order.id, order.total);

Lists that page