Pagination
Concepts
Pagination
How to walk lists of bookings and events with limit, starting_after and has_more.
GET /bookings and GET /events return a page { data, has_more }, newest first. Ask for up to limit items (1 to 100, 20 by default). For the next page, send the id of the last item you got in starting_after, while has_more is true.
js
// Walks every confirmed booking, 100 at a time
let startingAfter;
do {
const qs = new URLSearchParams({ limit: "100", status: "confirmed" });
if (startingAfter) qs.set("starting_after", startingAfter);
const res = await fetch(`https://api.muvon.mx/api/v1/bookings?${qs}`, {
headers: { Authorization: `Bearer ${process.env.MUVON_API_KEY}` },
});
const page = await res.json();
for (const booking of page.data) console.log(booking.code, booking.status);
startingAfter = page.has_more ? page.data.at(-1).id : undefined;
} while (startingAfter);Catalogues (/places, /vehicle-types, /extras) return the full list in data, without pages.

