Skip to main content
API fundamentals

Pagination

KennelBooker collection endpoints return a predictable page envelope so integrations can process large result sets safely.

Request one page at a time

Send request.page and request.pageSize in the query string. Page numbers are one-based, so the first page is 1.

Paginated request
curl --request GET \
  --url "https://api.kennelbooker.com/api/v1/bookings?request.page=1&request.pageSize=5" \
  --header "X-Api-Key: kb_live_your_api_key" \
  --header "Accept: application/json"

Pagination contract

Request parameters

Parameter Type Required Example Description
request.page integer Optional 1 The one-based page number to return. Defaults to 1.
request.pageSize integer Optional 25 The requested number of records on each page. Defaults to 25.

Response properties

Property Type Example Description
page integer 1 The one-based page number returned by the API.
pageSize integer 5 The page size applied to the request.
totalRecords integer 151 The total number of matching records across all pages.
totalPages integer 31 The total number of pages available for the applied page size.
items array [...] The records returned for the current page.

Response example

The metadata describes the complete matching result set while items contains only the current page.

Booking collection response
{
  "page": 1,
  "pageSize": 5,
  "totalRecords": 151,
  "totalPages": 31,
  "items": [
    {
      "bookingId": 229,
      "bookingType": "boarding",
      "reference": "KB000229",
      "status": "new",
      "customerId": 165,
      "customerName": "Example Customer",
      "petNames": "Milo",
      "numberOfPets": 1,
      "serviceId": 1,
      "checkInDate": "2026-05-07T00:00:00Z",
      "checkOutDate": "2026-05-08T00:00:00Z",
      "bookingPaid": false,
      "hasPayment": false
    }
  ]
}
This example shortens the items array for readability. A non-final page can contain up to pageSize records.

Fetch all pages

Read totalPages from each response and stop after processing that page. Do not calculate the final page solely from the number of items returned.

Iterate through pages in C#
int page = 1;
const int pageSize = 5;
PagedResponse<BookingSummary> result;

do
{
    string url = String.Format(
        "https://api.kennelbooker.com/api/v1/bookings?request.page={0}&request.pageSize={1}",
        page,
        pageSize);

    HttpResponseMessage response = await client.GetAsync(url);
    response.EnsureSuccessStatusCode();

    string json = await response.Content.ReadAsStringAsync();
    result = JsonConvert.DeserializeObject<PagedResponse<BookingSummary>>(json);

    foreach (BookingSummary booking in result.Items)
    {
        ProcessBooking(booking);
    }

    page++;
}
while (page <= result.TotalPages);
Iterate through pages in JavaScript
let page = 1;
const pageSize = 5;
let totalPages;

do {
  const url = new URL(
    "https://api.kennelbooker.com/api/v1/bookings"
  );
  url.searchParams.set("request.page", page);
  url.searchParams.set("request.pageSize", pageSize);

  const response = await fetch(url, {
    headers: {
      "X-Api-Key": process.env.KENNELBOOKER_API_KEY,
      "Accept": "application/json"
    }
  });

  if (!response.ok) {
    throw new Error(`Request failed: ${response.status}`);
  }

  const result = await response.json();
  totalPages = result.totalPages;

  for (const booking of result.items) {
    await processBooking(booking);
  }

  page++;
} while (page <= totalPages);

Client guidance

Start with page 1

Page numbers are one-based. Treat values below one as invalid.

Read fresh metadata

Records can change while paging. Use the metadata returned by the API instead of caching page counts indefinitely.