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
| Parameter | Type | Default | Description |
|---|---|---|---|
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
}
}
| Field | Type | Description |
|---|---|---|
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
- Don't store cursors long-term — Cursors may expire. Use them for immediate pagination only.
- Use reasonable page sizes — Default of 50 works well. Max of 512 reduces round trips for bulk fetches.
- Don't parse cursor values — Cursors are opaque strings. Their format may change without notice.
- Handle empty pages — A response with an empty
dataarray andhasNextPage: falsemeans no (more) results.