TS
Tournament Suite
TS
Tournament Suite
Developer Documentation

Pagination

How to paginate large result sets using the TournamentSuite API.

List endpoints return paginated results. Use the page and limit query parameters to navigate through result sets.

Query parameters

ParameterTypeDefaultMaximumDescription
pageinteger1—Page number (1-based)
limitinteger10100Number of items per page

Example request

curl "https://api.tournamentsuite.com/api/v1/tournaments?page=2&limit=20" \
  -H "X-API-Key: YOUR_API_KEY"

Pagination object

Every list response includes a pagination object:

{
  "success": true,
  "data": [...],
  "pagination": {
    "page": 2,
    "limit": 20,
    "total": 150,
    "totalPages": 8,
    "hasNext": true,
    "hasPrevious": true
  }
}
FieldDescription
pageCurrent page number
limitItems returned per page
totalTotal number of items across all pages
totalPagesTotal number of pages
hasNextWhether a next page exists
hasPreviousWhether a previous page exists

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/tournaments?page=${page}&limit=100`,
      { headers: { 'X-API-Key': apiKey } }
    );
    const json = await response.json();
    results.push(...json.data);
    hasNext = json.pagination.hasNext;
    page++;
  }

  return results;
}

On this page

Query parametersExample requestPagination objectIterating all pages