Web Dashboard API

Overview

XBans registers a WebModule with the XCore web dashboard, providing REST API endpoints for managing sanctions through the web interface. This allows server administrators to review and manage moderation data from a browser without being in-game.

The web dashboard module is only available when the XCore web panel is enabled in XCore's configuration. See the XCore documentation for web panel setup.

Authentication

All API endpoints require a valid Bearer token in the Authorization header. Tokens are managed through the XCore web panel.

Authorization: Bearer <your-token>

Authentication uses constant-time token comparison to prevent timing attacks. Unauthenticated requests receive a 401 Unauthorized response.

API Endpoints

All XBans endpoints are prefixed with /api/xbans. Read endpoints are GET; write endpoints are POST with a JSON body.

Read endpoints

MethodEndpointDescription
GET/api/xbans/statsSanction counts (active bans, mutes, warns, reports, jails, totals)
GET/api/xbans/bansList all active bans
GET/api/xbans/ip-bansList all active IP bans
GET/api/xbans/mutesList all active mutes
GET/api/xbans/ip-mutesList all active IP mutes
GET/api/xbans/warnsList all active warnings
GET/api/xbans/reportsList all reports
GET/api/xbans/jailsList all jailed players
GET/api/xbans/jaillistList configured jail locations
GET/api/xbans/watchlistList watchlisted players
GET/api/xbans/playersList all known players
GET/api/xbans/player/:uuidGet a player's sanction profile
GET/api/xbans/auditAudit log (paginated, searchable, filterable)

Write endpoints

Issue or lift sanctions through the API. Body parameters typically include uuid, reason, duration (optional), and moderator.

MethodEndpointDescription
POST/api/xbans/ban / /unbanIssue / lift a ban
POST/api/xbans/ban-ip / /unban-ipIssue / lift an IP ban
POST/api/xbans/mute / /unmuteIssue / lift a mute
POST/api/xbans/mute-ip / /unmute-ipIssue / lift an IP mute
POST/api/xbans/warn / /unwarnIssue / lift a warning
POST/api/xbans/kickKick an online player
POST/api/xbans/jail / /unjailJail / release a player
POST/api/xbans/freezeToggle freeze on a player
POST/api/xbans/note/add / /note/deleteAdd / delete staff notes

All responses are JSON. List endpoints support pagination via ?page=1&limit=50 query parameters.

CORS & Rate Limiting

The API handles CORS automatically through XCore's web panel helpers. OPTIONS preflight requests are handled for cross-origin browser access.

Rate limiting is enforced per IP address:

  • 30 requests per 60-second window
  • Exceeding the limit returns 429 Too Many Requests

Cross-Server Sync

When a POST endpoint modifies sanction data (e.g., unbanning a player from the web panel), XBans automatically handles cross-server synchronization. The SanctionCache calls notifySync() internally, so the change is reflected on all connected servers immediately.

Unlike some other addons, XBans' web module does not need to manually publish sync messages. The SanctionCache layer handles this transparently.