Pagination

How pagination works

List endpoints use offset-based pagination.

  • Parameters

    • limit: number of items to return (default: 100, max: 1000)

    • offset: number of items to skip (default: 0)

  • Response fields

    • total: total items available after filters

    • limit: the limit you requested/applied

    • offset: the offset you requested/applied

    • items: the current page of results

  • Paging logic

    • Next page offset = offset + limit

    • You’ve reached the end when offset + items.length >= total

    • GET /data/bookings is ordered by reservation_start (asc), then booking_date (asc)

Example request

// Server-side (Node 18+). Don’t expose API keys in the browser.
(async () => {
  const BASE_URL = 'https://api.okup.ai';
  const API_KEY = process.env.OKUPAI_API_KEY;

  const res = await fetch(`${BASE_URL}/data/bookings?from=2025-01-01&to=2025-01-31&limit=200&offset=0`, {
    headers: { 'X-API-Key': API_KEY },
  });
  if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
  const data = await res.json();
  console.log(data);
})();

Iterate pages

Last updated