Skip to main content

Overview

Retrieve a paginated list of tournaments using API key authentication. This endpoint is designed for machine-to-machine integrations, dashboards, and services that don’t require user authentication.
This endpoint uses API key authentication instead of user JWT tokens. Perfect for data pipelines, monitoring dashboards, and automated systems.

Authentication

Use the X-API-Key header with your API access key:
X-API-Key: your-api-key
Protect your API key. Never expose it in client-side code or public repositories.

Query Parameters

Same filtering options as the authenticated endpoint:
ParameterTypeDefaultDescription
pageIndexinteger0Page number (0-indexed)
pageSizeinteger10Items per page (1-50)
orderBystringcreatedAtSort field
orderstringdescSort direction
searchstringSearch by name or description
visibilitystringFilter: public or private
typestringFilter by tournament type
statusstringFilter: upcoming, active, or completed

Example Request

curl -X GET "https://app.forgeai.gg/api/v1/public/tournaments?status=active" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json"

Response

Returns the same tournament structure as the authenticated endpoint:
{
  "success": true,
  "data": [
    {
      "id": "tourn_abc123",
      "name": "Weekly Championship",
      "status": "active",
      "currentParticipants": 42,
      "maxParticipants": 100,
      ...
    }
  ],
  "pagination": {
    "pageIndex": 0,
    "pageSize": 10,
    "totalCount": 15,
    "totalPages": 2
  }
}

Use Cases

Pull tournament data periodically to power status dashboards:
// Cron job to refresh tournament cache
async function refreshTournamentCache() {
  const response = await fetch(
    'https://app.forgeai.gg/api/v1/public/tournaments?status=active&pageSize=50',
    { headers: { 'X-API-Key': API_KEY } }
  );
  const { data } = await response.json();
  await cache.set('active_tournaments', data, { ttl: 300 });
}
Let users query tournaments via bot commands:
@bot.command()
async def tournaments(ctx, status="active"):
    response = requests.get(
        f"https://app.forgeai.gg/api/v1/public/tournaments?status={status}",
        headers={"X-API-Key": API_KEY}
    )
    data = response.json()["data"]
    
    embed = discord.Embed(title=f"{status.title()} Tournaments")
    for t in data[:5]:
        embed.add_field(
            name=t["name"],
            value=f"{t['currentParticipants']}/{t['maxParticipants']} participants"
        )
    await ctx.send(embed=embed)