The Admin API exposes every management operation available in the bot’s web panel — from linking Discord accounts to Faceit profiles, to toggling feature flags, inspecting active matches, and broadcasting messages to all verified users. All routes are mounted underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/VasquezRivero92/Discord_Faceit/llms.txt
Use this file to discover all available pages before exploring further.
/api/admin and are protected by the verifyAdminToken middleware.
Guild Targeting
Most write and list operations are automatically scoped to the requesting user’s guild:adminrole — always scoped toreq.user.servidor(the guild ID embedded in the JWT). TheguildIdparameter is ignored for scope resolution.global_adminrole — can target any guild by supplying aguildId.
URL query parameter:
?guildId=123456789Request header:
x-guild-id: 123456789JSON body field:
{ "guildId": "123456789" }System
GET /api/admin/me
Returns the decoded JWT payload for the currently authenticated user. ResponseGET /api/admin/system
Returns the process uptime in seconds and the Faceit hub region resolved from the effective configuration. ResponseSeconds since the Node.js process started (
process.uptime()).Region string from the Faceit Hub API (uppercased), or
"Desconocida" if no hub is configured.GET /api/admin/status
Returns Discord connection status, guild metadata, and memory usage for the target guild. ResponseGET /health
Public endpoint — no authentication required. Returns a minimal health object for uptime monitors. ResponseUsers
GET /api/admin/users
Lists all linked users in Firestore, filtered to the resolved guild. Each entry includes the Firestore document fields plus aclubRole string resolved from the member’s Discord roles (one of EXTREME, EXTREME BAJOS, PREMIUM, PLUS, or null).
Response
POST /api/admin/users/verify
Manually links a Discord account to a Faceit profile. Fetches the player from the Faceit API, checks for duplicate links, saves the record to Firestore, and immediately syncs the Faceit level role in Discord. Request BodyDiscord user ID (snowflake) of the member to link.
Exact Faceit username of the player.
POST /api/admin/users/:id/unlink
Unlinks a user by their Discord ID. Removes all Faceit level roles and club roles from the member in Discord before deleting the Firestore document. Path ParameterDiscord user ID to unlink.
POST /api/admin/users/sync-all
Triggers a background job that iterates every user in Firestore, re-fetches their current Faceit level, and syncs their Discord roles. The HTTP response is returned immediately; syncing continues in the background at a rate of one user per 150 ms. ResponseGET /api/admin/users/backup
Downloads the entirefaceit_users Firestore collection as a JSON array. Useful for migrations or manual backups.
Response — raw JSON array of user objects.
POST /api/admin/users/restore
Restores user records from a previously exported backup. Uses a Firestore batchset with merge: true so existing records are updated rather than replaced.
Request Body
Array of user objects exported from the
/backup endpoint. Each object must contain a discordId field.POST /api/admin/users/:id/roles
Assigns a Discord role (level or special) to a member. Level roles (Faceit Level 1 – Faceit Level 10) are mutually exclusive; special roles (EXTREME, PREMIUM, etc.) are additive.
Path Parameter
Discord user ID.
Either
"level" or "special".For
"level": integer 1–10. For "special": role name string (e.g. "EXTREME").POST /api/admin/users/:id/admin-role
Sets a user’s web panel role in Firestore.admin role requires a guildId; global_admin may only be assigned by another global_admin.
Path Parameter
Discord user ID of the target user.
One of
"usuario", "admin", or "global_admin".Guild ID the
admin role is scoped to. Required when role is "admin".Matches
GET /api/admin/matches
Returns all active matches from Firestore, filtered to the resolved guild, along with computed server load metrics. ResponsePercentage of the estimated capacity (10 concurrent matches) that is currently in use.
Count of orphaned voice channels (name starts with
🔊) that have no corresponding active match.POST /api/admin/matches/:id/cleanup
Force-removes an active match. Moves any connected voice-channel members back to the waiting room, deletes the two faction voice channels, and removes the match document from Firestore. Path ParameterFaceit match ID to clean up.
GET /api/admin/matches/history
Returns paginated match history sorted by creation date descending. Query ParametersMaximum number of records to return. Defaults to
20.Leaderboard & Stats
GET /api/admin/leaderboard
Fetches the current leaderboard from the Faceit API and cross-references it with Discord IDs stored in Firestore. Response{ "leaderboard": [] } if no leaderboard ID is configured.
GET /api/admin/stats/:nickname
Fetches a player’s Faceit profile, lifetime stats, and recent match history (last 10 matches). Path ParameterExact Faceit username.
404 if the player is not found on Faceit.
Settings & Features
GET /api/admin/settings
Returns the full global settings document from Firestore merged with.env fallbacks. Requires global_admin role.
Response
POST /api/admin/settings
Saves global settings by writing to the.env file on disk and updating in-memory process.env. Requires global_admin role. Also triggers an automatic re-deploy of the support panel channel.
Request Body — settings object with any combination of the following keys:
Discord primary guild ID.
Channel ID for
/verificar_fc.Match announcements channel ID.
Role change notifications channel ID.
Server status embed channel ID.
Waiting room voice channel ID.
Staff alerts channel ID.
Support panel channel ID.
Faceit Hub UUID.
Faceit Leaderboard UUID.
Discord role name that grants admin access.
Auto-expiry time for active matches.
POST /api/admin/features/:key
Toggles a named feature flag. When aguildId is resolved, the flag is written to that guild’s Firestore settings document. Without a guildId, the global settings document is updated — this requires global_admin.
Path Parameter
Feature flag key (e.g.
autoWelcomeDm, liveMatchPanel, autoRoleSync).true to enable, false to disable.GET /api/admin/guilds
Returns all Discord guilds the bot is currently in.admin users only see their own guild.
Response
GET /api/admin/guilds/:guildId/settings
Returns the effective per-guild configuration (global defaults merged with guild-specific overrides). Path ParameterGuild ID.
admin users can only access their own guild.POST /api/admin/guilds/:guildId/settings
Saves per-guild settings to theguild_settings Firestore collection using merge semantics.
Path Parameter
Guild ID.
admin users can only update their own guild.Communication
GET /api/admin/messages
Returns the current message templates (welcome DM and support panel). ResponsePOST /api/admin/messages
Saves updated message templates to Firestore. Requiresglobal_admin role.
Request Body — full templates object with the same keys as the GET response.
Response
POST /api/admin/broadcast
Sends a direct message to all verified users in Firestore. Runs in the background at a rate of one DM per second. Requiresglobal_admin role.
Pass discordId to send to a single user instead.
Request Body
Message text to send. Must not be empty.
If provided, sends only to this Discord user ID and returns immediately.
Support
GET /api/admin/support-calls
Returns the 50 most recent support call records, sorted by creation date descending.admin users only see calls for their guild.
Response
POST /api/admin/support-calls/:id/resolve
Marks a support call as resolved (atendida), sends a confirmation DM to the player, and attempts to delete the original alert message from the admin alerts channel.
Path Parameter
Support call ID.
404 if the call doesn’t exist, 400 if it’s already resolved, and 403 if an admin user tries to resolve a call from a different guild.
Logs & Monitoring
GET /api/admin/logs
Returns recent bot log entries from thefaceit_bot_logs Firestore collection. Only error, warn, and system-sourced entries are persisted. Logs older than 7 days are pruned automatically.
Query Parameters
Maximum number of log entries to return. Defaults to
50.POST /api/admin/panel/refresh
Forces an immediate update of the live match panel embed in the configured matches channel. Response400 if no matches channel is configured for the target guild.
POST /api/admin/simulate-webhook
Simulates a Faceit webhook event by passing the payload directly to the internal webhook handler. The response is returned immediately while the event is processed asynchronously. Requiresglobal_admin role.
Request Body
The entire request body is passed directly to the internal webhook handler as the payload object. It should conform to the Faceit webhook schema, including a top-level event field.
Faceit webhook event name (e.g.
"match_status_ready", "match_status_finished").All other top-level fields of the Faceit webhook payload (e.g.
payload, transaction_id, timestamp).