Run in production
Pagination
List endpoints use cursors, so pages stay stable while inventory and bookings change underneath you.
List endpoints use cursors, so pages stay stable while inventory and bookings change underneath you.
Follow links.next, or pass meta.next_cursor as cursor, until it is null. per_page sets the page size.
curl "https://api.konghotels.cloud/reservations?per_page=2" -H "apikey: $KONG_HOTELS_API_KEY"
# → follow links.next until it is null
let url = 'https://api.konghotels.cloud/reservations?per_page=50'
const reservations = []
while (url) {
const res = await fetch(url, { headers: { apikey: process.env.KONG_HOTELS_API_KEY } })
const page = await res.json()
reservations.push(...page.data)
url = page.links.next
}
GET /changes uses its own since and next_cursor sequence, and you keep calling while meta.has_more is true. See Staying in sync.