The matches endpoints cover the full fixture lifecycle: browsing the match calendar, viewing match detail with events, casting prediction votes, and — for referees and admins — creating, locking, updating, and finishing matches.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Danielsl4/TFG_DAM_2526_Consulta/llms.txt
Use this file to discover all available pages before exploring further.
GET /matches
Returns the match calendar for a season. Authentication is optional — when a valid token is provided, the response includes the authenticated user’s vote for each match.Filter by season. When omitted, matches from the currently active season are returned.
- Request
- Response
cURL
Response fields
Match identifier.
ISO 8601 datetime of the match.
Home team object, or
null if not yet assigned.Away team object with the same shape as
homeTeam, or null.Label shown when the home team is not yet determined (e.g. “Winner Group A”).
Label shown when the away team is not yet determined.
Home team goals.
null when the match has not started.Away team goals.
null when the match has not started.Home team goals scored in a penalty shootout.
Away team goals scored in a penalty shootout.
Playing field.
One of
pendiente, en_curso, or finalizado.Competition phase, e.g.
fase_de_grupos or eliminatorias.Name of the group this match belongs to.
Localised weekday name in Spanish (e.g.
Sábado).Referee notes added at the end of the match.
The authenticated user’s vote (
local, empate, or visitante), or null when unauthenticated or not yet voted.Aggregated prediction votes for this match.
GET /matches/last-activity
Returns the Unix timestamp of the last global match update. Use this for long-polling to detect score or event changes without fetching the full match list.- Request
- Response
cURL
Unix millisecond timestamp of the most recent activity, or
null when no activity has been recorded.GET /matches/:id
Returns full detail for a single match, including the events array. Authentication is optional.Match identifier.
- Request
- Response
cURL
Ordered list of match events.
POST /matches/:id/vote
Submits or updates the authenticated user’s pre-match prediction. Voting is only allowed while the match status ispendiente and both teams are assigned.
Requires authentication.
Match identifier.
The prediction. Must be one of
local (home win), empate (draw), or visitante (away win).- Request
- Response
cURL
Confirmation message.
Updated vote counts after the submission.
POST /matches
Creates a new match. Requires admin role.ISO 8601 datetime of the match.
Season the match belongs to.
Playing field identifier.
Group identifier for group-stage matches.
Home team identifier. Omit if the team is not yet determined.
Away team identifier. Omit if the team is not yet determined.
Label to display when the home team is not yet set (e.g. “Winner Group A”).
Label to display when the away team is not yet set.
Competition phase.
- Request
- Response
cURL
DELETE /matches/:id
Soft-deletes (moves to trash) a match. Requires admin role.Match identifier.
cURL
{ "message": "Partido enviado a la papelera correctamente" }.
POST /matches/:id/restore
Restores a trashed match. Requires admin role.Match identifier.
cURL
DELETE /matches/:id/permanent
Permanently deletes a match from the database. Requires admin role. The match must already be in the trash (is_active = false).
Match identifier.
cURL
GET /matches/admin/trash
Returns all soft-deleted matches. Requires admin role.- Request
- Response
cURL
Match identifier.
Match datetime.
Home team name.
Away team name.
Home team placeholder label.
Away team placeholder label.
Name of the season.
GET /matches/admin/report
Returns all finished matches with their events for the specified season. Requires admin role.Season to report on. When omitted, all finished matches across all seasons are returned.
- Request
- Response
cURL
PUT /matches/:id/teams
Updates the teams assigned to a match. Used to fill in knockout-stage slots once qualifiers are known. Requires admin role.Match identifier.
Home team identifier. Pass
null to clear.Away team identifier. Pass
null to clear.Home team placeholder label.
Away team placeholder label.
cURL
POST /matches/:id/lock
Acquires an exclusive editing lock on a match. The lock is held for 2 minutes and must be renewed by repeated calls. Returns a conflict if another user holds an active lock. Requires referee or admin role.Match identifier.
- Request
- Response — success
- Response — conflict
cURL
POST /matches/:id/unlock
Releases the editing lock on a match. A referee can only release a lock they own. Admins can force-release any lock. Requires referee or admin role.Match identifier.
Set to
true to force-release a lock owned by another user (admin only).cURL
PUT /matches/:id/status
Updates the match status. Requires referee or admin role and an active lock.Match identifier.
New status. One of
pendiente, en_curso, or finalizado.cURL
PUT /matches/:id/observations
Sets or clears the referee observations for a match. Requires referee or admin role and an active lock.Match identifier.
Referee notes. Pass
null or omit to clear.cURL
POST /matches/:id/events
Records a match event. Goals and penalty shootout goals automatically increment the corresponding goal counter on the match row. Goals and cards also update the player’s season statistics. Requires referee or admin role and an active lock.Match identifier.
Event type. One of:
gol, tarjeta_amarilla, tarjeta_roja, penalti_tanda_marcado, penalti_tanda_fallado.Player who caused the event.
home or away.- Request
- Response
cURL
DELETE /matches/:matchId/events/:eventId
Removes a match event and reverses its effect on goal counts and player statistics. Requires referee or admin role and an active lock.Match identifier.
Event identifier.
cURL
PUT /matches/:id/finish
Finalises a match: sets status tofinalizado, releases the lock, updates team standings, awards prediction points to users who voted correctly, and increments matches_played for all players who appeared in events. Requires referee or admin role and an active lock.
Match identifier.
Optional final referee notes.
- Request
- Response
cURL