The Administration API provides privileged endpoints for managing users, monitoring league activity, uploading optimized images, and querying the audit trail. Every route in this section is protected by both JWT authentication and an admin role check — regular users and referees will receive aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Danielsl4/TFG_DAM_2526/llms.txt
Use this file to discover all available pages before exploring further.
403 Forbidden response.
All endpoints on this page require an
Authorization: Bearer <token> header where the decoded JWT contains role: "admin". Requests from non-admin accounts are rejected before any business logic runs.GET /admin/active-season
Returns the currently active season object. Equivalent to the publicGET /seasons/active endpoint but restricted to admin callers.
Responses
| Status | Description |
|---|---|
200 | Active season object |
404 | No season is currently marked active |
Unique season identifier.
Human-readable season name (e.g. “2025/26”).
ISO 8601 date when the season begins.
ISO 8601 date when the season ends.
Always
true for the returned object.cURL
GET /admin/summary
Returns an aggregated dashboard snapshot: entity counts and the five most recent audit log entries. Optionally scoped to a specific season. Query parametersWhen provided, counts are filtered to teams, players, and matches that belong to this season. Audit logs are also filtered by season when possible.
The five most recent audit log entries, each joined with the acting user’s username.
cURL
Example response
POST /admin/upload
Uploads an image to Cloudinary. The file is first processed by Sharp to optimize size and format before the upload occurs. Only a single file per request is accepted via theimage multipart field.
Query parameters
Cloudinary folder to store the image in (e.g.
"teams", "players").Override the auto-generated filename in Cloudinary. Omit to let the server generate one.
multipart/form-data
The image file to upload. Processed by Sharp before being sent to Cloudinary.
The public Cloudinary URL of the uploaded and optimized image.
cURL
Example response
GET /admin/users
Returns a paginated list of active user accounts. Supports accent-insensitive search across username and email usingunaccent.
Query parameters
Case- and accent-insensitive filter applied to both
username and email.Page number (1-indexed).
Number of results per page.
Total number of active users matching the search filter.
Current page number.
Page size used for this response.
cURL
PUT /admin/users/:id
Updates the role of an existing user account. Path parametersID of the user whose role should be changed.
New role to assign. Must be one of
"admin", "referee", or "user".Confirmation message.
cURL
DELETE /admin/users/:id
Soft-deactivates a user account by settingis_active = false and anonymizing their username and email with a __deleted__<timestamp> suffix. The record is preserved in the database for referential integrity.
Path parameters
ID of the user to deactivate.
Confirmation that the user was deactivated and anonymized.
cURL
GET /admin/logs
Returns a paginated, filterable list of audit log entries. Each log records an admin or system action, the acting user, the affected entity, and a JSONB details payload. Query parametersPage number (1-indexed).
Number of log entries per page.
Filter to logs whose
details.season_id matches this value (or logs with no season context).Accent-insensitive partial match against the acting user’s username.
Exact date filter in
YYYY-MM-DD format. Matches on the created_at date component.Total number of log entries matching the applied filters.
Current page number.
Page size used for this response.
cURL
Example response