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.

Events are the top-level container for every tournament in Gestor Deportivo. An event holds the format rules, schedule boundaries, category, and media assets for a competition. Once an event exists, teams can reserve spots, matches can be scheduled, and standings can be tracked until the organizer marks it finished.

Event Lifecycle

Every tournament moves through a predictable sequence of states:
  1. Create — organizer calls POST /api/event/agregate to set up the event shell.
  2. Teams reserve — teams submit reservation requests; the organizer accepts or rejects them.
  3. Run matches — games are created, goals and cards are recorded, standings are finalized.
  4. Finish — organizer calls POST /api/event/finish/:eventId/event, which sets stade: false and finality: "Finalizado".

Classification Types

The classificationType boolean controls the bracket format used throughout the event:
ValueFormat
falseKnockout only — single-elimination bracket with no group stage
trueGroup stage + knockout — teams are distributed into groups first, then top finishers advance

Event Status Fields

Two fields together describe where an event stands:
FieldTypeMeaning
stadebooleantrue = event is active and ongoing; false = event is closed
finalitystring"En curso" while running; "Finalizado" after the finish call

Management Endpoints

POST /api/event/agregate

Creates a new sports tournament event. The authenticated user becomes the owner. Plan-based limits apply — the number of events an account can hold is capped by subscription tier, though admin accounts bypass this check entirely. Authentication: access-token: <jwt_token> — required Request format: multipart/form-data
title
string
required
Display name of the tournament (e.g., "Copa Primavera 2025").
description
string
required
Full description of the event, its rules, and any relevant notes.
category
string
required
Player gender category. Must be one of "Masculino", "Femenino", or "Mixto".
startDate
string
ISO date string for when the tournament begins (e.g., "2025-03-01").
endDate
string
ISO date string for when the tournament ends.
ubication
string
Venue or city where the event takes place.
sport
string
default:"Futbol"
Sport being played. Defaults to "Futbol" if omitted.
keys
string
Tournament format label. One of "Campeonato", "Copa", "Liga", or "Torneo".
classificationType
boolean
false for knockout-only; true for group stage + knockout.
eventsImg
file[]
One or more banner or cover images for the event (multipart file upload, field name eventsImg).
curl -X POST https://api.example.com/api/event/agregate \
  -H "access-token: <jwt_token>" \
  -F "title=Copa Primavera 2025" \
  -F "description=Torneo relámpago de fútbol 7 para equipos amateur" \
  -F "category=Masculino" \
  -F "startDate=2025-03-01" \
  -F "endDate=2025-04-30" \
  -F "ubication=Estadio Municipal, Guadalajara" \
  -F "sport=Futbol" \
  -F "keys=Copa" \
  -F "classificationType=false" \
  -F "eventsImg=@/path/to/banner.jpg"
status
boolean
true on success.
event
object
The newly created event document.
{
  "status": true,
  "event": {
    "_id": "64a1f2c3e4b5d6f7a8b9c0d1",
    "title": "Copa Primavera 2025",
    "category": "Masculino",
    "sport": "Futbol",
    "stade": true,
    "finality": "En curso",
    "keys": "Copa",
    "classificationType": false
  }
}

POST /api/event/update/:eventId/event

Updates an existing event. Only the event owner can call this endpoint. All body fields are optional — only the fields you send will be updated. Images are replaced if a new eventsImg file is provided. Authentication: access-token: <jwt_token> — required (owner only) Request format: multipart/form-data
eventId
string
required
The _id of the event to update.
title
string
New display name for the tournament.
description
string
Updated description.
category
string
One of "Masculino", "Femenino", or "Mixto".
startDate
string
Updated start date string.
endDate
string
Updated end date string.
ubication
string
Updated venue or city.
sport
string
Updated sport name.
keys
string
Updated format label: "Campeonato", "Copa", "Liga", or "Torneo".
classificationType
boolean
Updated classification format flag.
eventsImg
file[]
Replacement images (multipart, field name eventsImg).
curl -X POST https://api.example.com/api/event/update/64a1f2c3e4b5d6f7a8b9c0d1/event \
  -H "access-token: <jwt_token>" \
  -F "ubication=Cancha Norte, Zapopan" \
  -F "endDate=2025-05-15"
status
boolean
true on success.
event
object
The updated event document with the same shape as the create response.
{
  "status": true,
  "event": {
    "_id": "64a1f2c3e4b5d6f7a8b9c0d1",
    "ubication": "Cancha Norte, Zapopan",
    "endDate": "2025-05-15"
  }
}

POST /api/event/finish/:eventId/event

Closes an event. Sets stade to false and finality to "Finalizado". This action signals that all matches are done and the tournament has concluded. Only the event owner can call this endpoint. Authentication: access-token: <jwt_token> — required (owner only)
eventId
string
required
The _id of the event to finish.
Finishing an event is not reversible through the API. Make sure all match results and standings have been recorded before calling this endpoint.
curl -X POST https://api.example.com/api/event/finish/64a1f2c3e4b5d6f7a8b9c0d1/event \
  -H "access-token: <jwt_token>"
status
boolean
true on success.
{ "status": true }

POST /api/event/remove/:eventId

Permanently deletes an event and its associated data. Only the event owner can delete their own events. Authentication: access-token: <jwt_token> — required (owner only)
eventId
string
required
The _id of the event to delete.
Deletion is permanent. All associated games, standings, and reservation records linked to this event will be removed.
curl -X POST https://api.example.com/api/event/remove/64a1f2c3e4b5d6f7a8b9c0d1 \
  -H "access-token: <jwt_token>"
status
boolean
true on success.
{ "status": true }

Listing Endpoints

POST /api/event/list/:owner/:pag?/:perpage?

Returns a paginated list of events. If owner is a user ID, only that user’s events are returned. If owner is the string "all", events from every organizer are returned. Authentication: None required
owner
string
required
A user _id to filter by organizer, or the literal string "all" to retrieve events from all users.
pag
number
Page number (1-based). Defaults to 1 if omitted.
perpage
number
Number of events per page. Defaults to the server-side default if omitted.
# All events, page 1, 10 per page
curl -X POST https://api.example.com/api/event/list/all/1/10

# Events from a specific organizer
curl -X POST https://api.example.com/api/event/list/64a1f2c3e4b5d6f7a8b9c0d1/1/10
status
boolean
true on success.
data
array
Array of event documents matching the filter.
pagination
object
Pagination metadata.
{
  "status": true,
  "data": [
    {
      "_id": "64a1f2c3e4b5d6f7a8b9c0d1",
      "title": "Copa Primavera 2025",
      "stade": true,
      "finality": "En curso"
    }
  ],
  "pagination": {
    "total": 42,
    "page": 1,
    "perpage": 10,
    "pages": 5
  }
}

POST /api/event/list-public/:pag?/:perpage?

Returns a paginated list of all publicly active events — those where stade is true. This endpoint is ideal for public-facing tournament discovery pages. Authentication: None required
pag
number
Page number (1-based).
perpage
number
Number of events per page.
Only events with stade: true are returned. Finished events (stade: false) are excluded from this listing.
curl -X POST https://api.example.com/api/event/list-public/1/20
status
boolean
true on success.
data
array
Array of active event documents.
pagination
object
Pagination metadata (same shape as /list).
{
  "status": true,
  "data": [
    {
      "_id": "64a1f2c3e4b5d6f7a8b9c0d1",
      "title": "Liga Verano 2025",
      "stade": true,
      "category": "Mixto",
      "sport": "Futbol"
    }
  ],
  "pagination": {
    "total": 8,
    "page": 1,
    "perpage": 20,
    "pages": 1
  }
}

POST /api/event/to/:eventId/list-event

Retrieves a single event by its ID. Use this to display a tournament’s full detail page. Authentication: None required
eventId
string
required
The _id of the event to retrieve.
curl -X POST https://api.example.com/api/event/to/64a1f2c3e4b5d6f7a8b9c0d1/list-event
status
boolean
true on success.
event
object
Full event document including all fields described in the Event model.
{
  "status": true,
  "event": {
    "_id": "64a1f2c3e4b5d6f7a8b9c0d1",
    "title": "Copa Primavera 2025",
    "description": "Torneo relámpago de fútbol 7 para equipos amateur",
    "category": "Masculino",
    "sport": "Futbol",
    "ubication": "Estadio Municipal, Guadalajara",
    "startDate": "2025-03-01",
    "endDate": "2025-04-30",
    "stade": true,
    "finality": "En curso",
    "keys": "Copa",
    "classificationType": false,
    "eventsImg": ["https://cdn.example.com/banner.jpg"]
  }
}

Build docs developers (and LLMs) love