EZToTrack Developers

Pagination

Navigate large datasets with cursor-based pagination.

How It Works

All list endpoints use cursor-based pagination. This provides stable, consistent results even when data is being added or removed.

Query Parameters

ParameterTypeDefaultDescription
limit integer 50 Number of results per page (1–512)
after string Cursor from previous response to fetch the next page

Response Format

Every paginated response includes a pagination object:

{
  "data": [
    { "id": "veh_001", "name": "Truck 101" },
    { "id": "veh_002", "name": "Truck 102" },
    { "id": "veh_003", "name": "Truck 103" }
  ],
  "pagination": {
    "endCursor": "eyJpZCI6InZlaF8wMDMifQ==",
    "hasNextPage": true
  }
}
FieldTypeDescription
pagination.endCursor string Opaque cursor to pass as the after parameter for the next page
pagination.hasNextPage boolean true if more results are available

Fetching All Pages

To retrieve all results, loop until hasNextPage is false:

import requests

API_KEY = "ezt_live_abc123..."
BASE_URL = "https://publicapi.app.eztotrack.com"
headers = {"Authorization": f"Bearer {API_KEY}"}

all_vehicles = []
cursor = None

while True:
    params = {"limit": 100}
    if cursor:
        params["after"] = cursor

    resp = requests.get(
        f"{BASE_URL}/fleet/vehicles",
        headers=headers,
        params=params
    )
    data = resp.json()

    all_vehicles.extend(data["data"])

    pagination = data["pagination"]
    if not pagination["hasNextPage"]:
        break
    cursor = pagination["endCursor"]

print(f"Fetched {len(all_vehicles)} vehicles")
const API_KEY = "ezt_live_abc123...";
const BASE_URL = "https://publicapi.app.eztotrack.com";
const headers = { "Authorization": `Bearer ${API_KEY}` };

const allVehicles = [];
let cursor = null;

while (true) {
  const params = new URLSearchParams({ limit: "100" });
  if (cursor) params.set("after", cursor);

  const resp = await fetch(
    `${BASE_URL}/fleet/vehicles?${params}`,
    { headers }
  );
  const { data, pagination } = await resp.json();

  allVehicles.push(...data);

  if (!pagination.hasNextPage) break;
  cursor = pagination.endCursor;
}

console.log(`Fetched ${allVehicles.length} vehicles`);
# First page
curl -H "Authorization: Bearer ezt_live_abc123..." \
  "https://publicapi.app.eztotrack.com/fleet/vehicles?limit=100"

# Next page (use endCursor from previous response)
curl -H "Authorization: Bearer ezt_live_abc123..." \
  "https://publicapi.app.eztotrack.com/fleet/vehicles?limit=100&after=eyJpZCI6InZlaF8wMDMifQ=="

Best Practices