Pagination
List endpoints return results in pages. Pagination keeps responses fast and lets clients fetch only what they need.
Query Parameters
Every list endpoint accepts two parameters:
| Parameter | Default | Max | Notes |
|---|---|---|---|
page |
1 | - | Starts at 1 |
limit |
25 | 100 | Items per page |
Defaults and maximums are set by the admin in API Settings. Values above the maximum are clamped, not rejected.
GET /api/v1/websites?page=2&limit=50
Response Format
List responses include a pagination object next to data:
{
"data": [ ... ],
"pagination": {
"page": 2,
"limit": 50,
"total": 142,
"total_pages": 3
}
}
| Field | Meaning |
|---|---|
page |
Current page number |
limit |
Items per page used for this response |
total |
Total items across all pages |
total_pages |
Total number of pages |
Iterating Through Pages
Fetch the first page, then increment page until page equals total_pages:
PAGE=1
while true; do
RESPONSE=$(curl -s -H "Authorization: Bearer $TOKEN" \
"https://panel.example.com/api/v1/websites?page=${PAGE}&limit=50")
# Process the current page
echo "$RESPONSE" | jq '.data[]'
TOTAL_PAGES=$(echo "$RESPONSE" | jq '.pagination.total_pages')
if [ "$PAGE" -ge "$TOTAL_PAGES" ]; then
break
fi
PAGE=$((PAGE + 1))
done
Empty Results
If a list is empty, data is an empty array and total_pages is 0:
{
"data": [],
"pagination": {
"page": 1,
"limit": 25,
"total": 0,
"total_pages": 0
}
}
Out-of-Range Pages
Requesting a page beyond total_pages returns an empty data array. It does not error.
GET /api/v1/websites?page=999
{
"data": [],
"pagination": {
"page": 999,
"limit": 25,
"total": 142,
"total_pages": 6
}
}
Clamping
Invalid values are clamped, not rejected:
page=0or negative is treated aspage=1limit=0or negative is treated aslimit=1limitabove the maximum is clamped to the maximum
That means you can always trust the pagination object in the response to reflect what was actually returned, regardless of what you sent.
Related
- Errors - error codes and responses
- Endpoints - endpoint reference
- API Settings - admin configuration for page size defaults