Pagination
How to paginate large result sets using the Tournament Suite API.
List endpoints return paginated results. Use the page and limit query parameters to navigate through result sets.
Query parameters
| Parameter | Type | Default | Maximum | Description |
|---|---|---|---|---|
page | integer | 1 | — | Page number (1-based) |
limit | integer | 25 | 100 | Number of items per page |
Example request
curl "https://api.tournamentsuite.com/api/v1/data/tournaments?page=2&limit=20" \
-H "X-API-Key: YOUR_API_KEY"
Response shape
Every Data API response is wrapped in an envelope with success, data, and message. For list endpoints, data is not a bare array — it's an object that holds both the list and the paging fields together. For example, GET /api/v1/data/tournaments returns:
{
"success": true,
"data": {
"tournaments": [...],
"total": 150,
"page": 2,
"limit": 20,
"totalPages": 8,
"hasNext": true,
"hasPrev": true
},
"message": "Tournaments retrieved successfully"
}
| Field | Description |
|---|---|
total | Total number of items across all pages |
page | Current page number |
limit | Items returned per page |
totalPages | Total number of pages |
hasNext | Whether a next page exists |
hasPrev | Whether a previous page exists |
The name of the array field and the exact set of paging fields varies by endpoint (for example, GET /api/v1/data/tournaments/:id/matches nests its list under matches instead of tournaments). Check the response of the specific endpoint you're calling rather than assuming a fixed shape.
Not every list endpoint reports paging metadata. GET /api/v1/data/matches/:id/events still accepts page and limit to control how many rows are returned, but its data is a plain array of events with no total, hasNext, or other paging fields — use the limit you requested to tell whether more pages are likely to exist.
Iterating all pages
async function fetchAllTournaments(apiKey: string) {
const results = [];
let page = 1;
let hasNext = true;
while (hasNext) {
const response = await fetch(
`https://api.tournamentsuite.com/api/v1/data/tournaments?page=${page}&limit=100`,
{ headers: { 'X-API-Key': apiKey } }
);
const json = await response.json();
results.push(...json.data.tournaments);
hasNext = json.data.hasNext;
page++;
}
return results;
}Was this helpful?
