Skip to main content

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.

Every fixture in Gestor Deportivo is a self-contained game record that accumulates goals, disciplinary events, and substitutions as the match progresses. Once all events are recorded, you finalize the game to push results into the tournament standings table. This guide walks through creating a match, recording all in-game events, and querying the resulting statistics.

Creating a match

Before you can record any match events, you need a game document tied to an event. Supply both teams, the venue details, and the officiating referee.
curl -X POST https://api.example.com/api/game/new-matches/<eventId>/game \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "teams": ["<teamAId>", "<teamBId>"],
    "matchDate": "2025-03-08",
    "matchTime": "15:00",
    "matchDay": 1,
    "scenery": "Estadio Municipal — Cancha 2",
    "workingday": "Jornada 1",
    "refereeName": "Luis García"
  }'
FieldTypeDescription
teamsarrayExactly two team IDs participating in the match
matchDatedate stringCalendar date of the fixture
matchTimestringKick-off time (e.g. "15:00")
matchDaynumberNumeric match day within the competition
scenerystringVenue or pitch name
workingdaystringHuman-readable round label (e.g. "Jornada 3")
refereeNamestringName of the officiating referee
The response includes the gameId used in all subsequent recording endpoints. To update any of these fields after creation:
curl -X POST https://api.example.com/api/game/update/<gameId>/matches \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "matchTime": "16:30",
    "refereeName": "Ana López"
  }'

Recording match events

Work through these steps in order during or after the match. Finalize the game last — that action freezes results and updates the standings table.
1

Record goals

Post the goals scored by a specific team in this match. Each entry in the goals array captures the minute, type, and the player who scored.
curl -X POST https://api.example.com/api/game/goals/<gameId>/<teamId>/<eventId> \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "goals": [
      {
        "timeGoals": 23,
        "typeGoals": "normal",
        "playerData": "<playerId>"
      },
      {
        "timeGoals": 67,
        "typeGoals": "Penal",
        "playerData": "<playerId>"
      }
    ]
  }'
typeGoals valueDescription
normalOpen-play goal
PenalPenalty kick conversion
ownGoalOwn goal (credited to the opposing team)
Call this endpoint once per team. If neither team scored, you can skip this step.
2

Record disciplinary cards

Submit yellow, red, and blue cards issued during the match. All card arrays are sent in a single request per team. Any array can be empty if no cards of that type were given.
curl -X POST https://api.example.com/api/game/card/<gameId>/<teamId>/<eventId>/global \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "yellowCard": [
      { "time": 34, "playerData": "<playerId>" }
    ],
    "redCard": [],
    "blueCard": [
      { "time": 55, "playerData": "<playerId>" }
    ]
  }'
See Card types below for a description of each card’s meaning and effect.
3

Record fouls and substitutions

Log disciplinary foul counts and any player substitutions made during the match. Both are submitted together per team.
curl -X POST https://api.example.com/api/game/disciplinarys/<gameId>/<teamId>/<eventId> \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "fouls": [
      { "playerData": "<playerId>", "foulCount": 2 }
    ],
    "substitutions": [
      {
        "playerOut": "<playerId>",
        "playerIn": "<playerId>",
        "time": 72
      }
    ]
  }'
4

Finalize the match and update standings

Once all events are recorded, finalize the game. This calculates the result, awards points, and updates the tournament standings table.
curl -X POST https://api.example.com/api/game/table/<gameId>/<eventId>/finalize \
  -H "Authorization: Bearer <token>"
Always call the finalize endpoint after recording all goals, cards, and disciplinary data. The standings calculation is based on the data present at the moment finalization runs. Re-running finalize after adding missed events will recalculate correctly, but it is best practice to ensure all data is complete first.

Card types

Yellow Card

Caution. A warning issued for unsporting behaviour or persistent foul play. Two yellow cards in a match result in an automatic ejection.

Red Card

Ejection. The player is immediately dismissed from the match and typically triggers a suspension for the next fixture.

Blue Card

Temporary suspension. Used in some indoor or futsal formats to send a player off for a set period rather than the full match.

Querying game data

All listing endpoints below are public and require no authentication.

All matches in an event

curl -X POST https://api.example.com/api/game/list/<eventId>/game/event

A specific match by ID

curl -X POST https://api.example.com/api/game/list/<gameId>/gameId

Standings table for an event

Returns each team’s accumulated points, win/draw/loss record, and goal statistics.
curl -X POST https://api.example.com/api/game/list/<eventId>/table/game

Top-scorer table for an event

Returns players ranked by total goals scored across all matches in the event.
curl -X POST https://api.example.com/api/game/list/<eventId>/table-gols

Per-player match data

Retrieve individual player statistics for a specific game.
curl -X POST https://api.example.com/api/game/list/match/<gameId>/data/player
Use the standings and top-scorer endpoints to power public-facing leaderboards in your app. Neither endpoint requires a token, so you can call them directly from a frontend client without exposing credentials.

Build docs developers (and LLMs) love