Eventlayer / API & operations

Pagination

Read ticket and attendee collections a page at a time, or iterate through them with the SDK.

Paginated resources return items and meta. Use cursor IDs to continue through a collection. Check the resource reference: events.list() returns an array, while resources such as tickets and attendees support pagination.

Read one page

list-tickets.ts · server only
const { data: page, error } = await eventlayer.tickets.list({
  eventId: "ev_your_event_id",
  limit: 50,
});
if (error) throw error;

console.log(page.items);
if (page.meta.has_more) {
  const after = page.items.at(-1)?.id;
  // Pass this cursor as `after` in the next list request.
  console.log(after);
}

Keep the same filters when requesting subsequent pages. Do not assume the first page contains every attendee or ticket in an event.

Iterate through a collection

The SDK handles subsequent requests with listAll(). Each yielded item is a result envelope, including any error that stops pagination.

all-tickets.ts · server only
for await (const { data: ticket, error } of eventlayer.tickets.listAll({
  eventId: "ev_your_event_id",
})) {
  if (error) throw error;
  console.log(ticket.id, ticket.status);
}

If a page fails, report the incomplete operation instead of treating the records read so far as a complete collection. See retries and recovery.