TOURNAMENTSUITE
TOURNAMENTSUITE
Developer Documentation
Get StartedPaginationResponse CodesRate LimitsWebhooks
Overview

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

ParameterTypeDefaultMaximumDescription
pageinteger1—Page number (1-based)
limitinteger25100Number 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"
}
FieldDescription
totalTotal number of items across all pages
pageCurrent page number
limitItems returned per page
totalPagesTotal number of pages
hasNextWhether a next page exists
hasPrevWhether 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?

Get Started

Create your account, set up a project, and make your first API call in minutes.

Response Codes

HTTP status codes returned by the Tournament Suite API and how to handle them.

On this page

Query parametersExample requestResponse shapeIterating all pages