Games represent individual matches within a tournament event. Each game tracks two teams, the full record of in-match events (goals, yellow/red/blue cards, fouls, substitutions), and the final result. Once all events for a match are recorded, the organizer finalizes the standings table so rankings and statistics update across the tournament.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/gestor-backend/llms.txt
Use this file to discover all available pages before exploring further.
Match Lifecycle
Every match moves through a standard sequence before it contributes to tournament standings:- Create — organizer calls
POST /api/game/new-matches/:eventId/game(or the group-stage variant) to schedule the fixture. - Record events — goals, cards, fouls, and substitutions are recorded as they happen.
- Finalize — organizer calls the finalize endpoint to calculate and persist standings.
Card Types
Three card types are supported for disciplinary tracking:| Card | Field | Effect |
|---|---|---|
| Yellow | yellowCard | Caution — player receives a warning |
| Red | redCard | Ejection — player is removed from the match |
| Blue | blueCard | Temporary suspension — player sits out for a defined period |
Always call the finalize endpoint after recording all goals, cards, and disciplinary data for a match. Standings are not updated in real time — they are computed only when the finalize call is made.
Match Creation
POST /api/game/new-matches/:eventId/game
Schedules a new knockout or regular match within an event. Plan-based limits apply to the number of matches that can be created under a given subscription tier. Authentication:access-token: <jwt_token> — required
The
_id of the parent event.The first team. Must include the team’s
_id inside a nested team object: { "team": { "_id": "..." } }.The second team, same shape as
TeamOne.Date of the match (e.g.,
"2025-03-15").Kick-off time (e.g.,
"16:00").Human-readable match day label (e.g.,
"Jornada 1").Stadium or venue name for this specific match.
Round or stage identifier (e.g.,
"Cuartos de Final").Name of the assigned referee.
true on success.The newly created game document.
POST /api/game/new/:eventId/matches-group
Creates the full group stage structure for an event. Each group is named and assigned a set of teams. The server will generate the round-robin fixture schedule within each group automatically. Authentication:access-token: <jwt_token> — required
The
_id of the event to add groups to.Array of group objects to create.
true on success.POST /api/game/new/:eventId/matches-game-group/:groupId
Schedules a single match inside an existing group stage. Use this after creating the group structure to add or adjust individual fixtures within a group. Authentication:access-token: <jwt_token> — required
The
_id of the parent event.The
_id of the group stage this match belongs to.First team:
{ "team": { "_id": "..." } }.Second team:
{ "team": { "_id": "..." } }.Date of the match.
Kick-off time.
Match day label.
Venue name.
Round or stage identifier.
Referee’s name.
true on success.Match Updates
POST /api/game/update/:gameId/matches
Updates logistical details of an existing match — date, time, venue, referee, and matchday information. All body fields are optional; only provided fields are updated. Authentication:access-token: <jwt_token> — required
The
_id of the game to update.New match date.
New kick-off time.
Updated match day label.
Updated venue name.
Updated round or stage identifier.
Updated referee name.
true on success.The updated game document.
Recording Match Events
POST /api/game/goals/:gameId/:teamId/:eventId
Records goals scored by a team in a match. Each goal entry includes timing, type, and the player who scored. Player statistics in the Player model are updated automatically. Authentication:access-token: <jwt_token> — required
The
_id of the game.The
_id of the team that scored.The
_id of the parent event.Array of goal objects.
true on success.POST /api/game/card/:gameId/:teamId/:eventId/global
Records yellow, red, and blue cards issued to players of a team during a match. All three card arrays can be submitted in a single call. Player card statistics are updated in the Player model. Authentication:access-token: <jwt_token> — required
The
_id of the game.The
_id of the team receiving the cards.The
_id of the parent event.Caution cards. Each item:
{ "dataType": 1, "time": "30'", "playerData": [...] }.Ejection cards. Same shape as
yellowCard.Temporary suspension cards. Same shape as
yellowCard.true on success.POST /api/game/disciplinarys/:gameId/:teamId/:eventId
Records additional disciplinary data for a team in a match: total fouls committed, formal sanctions, and player substitutions. This complements the card recording endpoint with non-card disciplinary information. Authentication:access-token: <jwt_token> — required
The
_id of the game.The
_id of the team.The
_id of the parent event.Array of foul records committed by this team.
Array of formal sanction records. Each item should include a
typeSantions field describing the sanction type.Array of substitution records. Each item includes
timePlayerChange (minute), playerDataOne (player coming off), and playerDataTwo (player coming on).true on success.POST /api/game/goals-group/:gameId/:teamId/:eventId/:groupStageId
Records goals for a match that belongs to a group stage. Identical in payload to the standard goals endpoint but requires thegroupStageId path parameter so standings are updated within the correct group.
Authentication: access-token: <jwt_token> — required
The
_id of the game.The
_id of the scoring team.The
_id of the parent event.The
_id of the group stage this match belongs to.Same structure as
POST /api/game/goals — array of goal objects with dataType, timeGoals, typeGoals, and playerData.true on success.Finalizing Standings
POST /api/game/table/:gameId/:eventId/finalize
Finalizes the standings table for a regular (non-group) match. Computes win/loss/draw results, updates the standings table for the event, and marks the match as complete. Call this after all goals, cards, and disciplinary data have been recorded. Authentication:access-token: <jwt_token> — required
The
_id of the game to finalize.The
_id of the parent event.true on success.POST /api/game/table/:gameId/:eventId/:groupStageId/finalize
Same as the standard finalize endpoint but for group stage matches. Standings are updated within the specified group. Authentication:access-token: <jwt_token> — required
The
_id of the game to finalize.The
_id of the parent event.The
_id of the group stage.true on success.POST /api/game/finality/:eventId/group-table
Marks the entire group stage phase of an event as finished. Call this once all group stage matches have been played and finalized, before advancing to knockout rounds. Authentication:access-token: <jwt_token> — required
The
_id of the event whose group table to finalize.true on success.Listing & Querying
POST /api/game/list/:stadeParams/:pag?/:perpage?
Returns a paginated list of games filtered by their active/finished state. Authentication: None required"true" to list active games; "false" to list finished games.Page number (1-based).
Items per page.
POST /api/game/list/:gameId/gameId
Retrieves a single game document by its ID. Authentication: None requiredThe
_id of the game to fetch.POST /api/game/list/:gameId/data/:teamId/game
Returns team-specific data within a game — the team’s goals, cards, faults, and player changes for that match. Authentication: None requiredThe
_id of the game.The
_id of the team whose data to retrieve.POST /api/game/list/:eventId/game/event
Lists all games scheduled within a specific event. Authentication: None requiredThe
_id of the event.POST /api/game/list/:eventId/table/game
Returns the current standings table for a regular (non-group) tournament event. Authentication: None requiredThe
_id of the event.POST /api/game/list/:eventId/table/game/group
Returns the group stage standings tables for an event — one table per group showing points, wins, draws, losses, and goal difference. Authentication: None requiredThe
_id of the event.POST /api/game/list/:teamId/games/teams
Lists all games a specific team has participated in across any event. Authentication: None requiredThe
_id of the team.POST /api/game/list/match/:gameId/data/player
Returns individual player statistics for a match — goals, cards, and disciplinary data broken down per player. Authentication: None requiredThe
_id of the game.POST /api/game/list/working/day/game
Returns all games grouped by matchday (workingday), useful for building a fixture calendar view.
Authentication: None required
POST /api/game/list/:eventId/teams-groups
Lists all teams and their group assignments within an event’s group stage. Authentication: None requiredThe
_id of the event.POST /api/game/list/:eventId/table-gols
Returns the top scorer table for a specific event — players ranked by number of goals scored. Authentication: None requiredThe
_id of the event.