Overview
The Admin API provides server management endpoints for maintenance mode, live logs, and server control. All endpoints require thex-admin-code header for authentication.
Added in PR #1015 (March 12, 2026).
Authentication
All admin endpoints require thex-admin-code header:
Maintenance Mode
Enter Maintenance Mode
- Stops new duel cycles from starting
- Waits for current cycle to complete
- Locks betting markets
- Returns when
safeToDeploy: true
- Default: 5 minutes (300000ms)
- Returns status even if timeout exceeded
- Check
safeToDeployfield before deploying
Exit Maintenance Mode
Get Maintenance Status
active- Whether maintenance mode is activeenteredAt- Unix timestamp (ms) when entered, ornullreason- Reason for maintenance, ornullsafeToDeploy- Whether it’s safe to restart servercurrentPhase- Current duel phase (IDLE, FIGHTING, COUNTDOWN, etc.)marketStatus- Betting market status (betting, locked, resolved, none)pendingMarkets- Number of unresolved markets
active: true(maintenance mode entered)currentPhasenot in [FIGHTING, COUNTDOWN, ANNOUNCEMENT]pendingMarkets: 0(all markets resolved)
Logs
Get Live Logs
timestamp- Unix timestamp in millisecondslevel- Log level (DEBUG, INFO, WARN, ERROR)system- System name (e.g., “DuelScheduler”, “Combat”)message- Log messagedata- Optional structured data (object)
- Stores up to 1000 most recent log entries
- Oldest entries discarded when buffer full
- Configurable via
LOGGER_MAX_ENTRIESenvironment variable
Server Control
Restart Server
- Validates admin code
- Waits 2 seconds (allows response to be sent)
- Calls
process.exit(0) - PM2 automatically restarts the server
Duel Status
Get Duel Status
Error Responses
403 Forbidden
x-admin-code header.
Solution: Set correct ADMIN_CODE in server .env and include in request header.
500 Internal Server Error
Usage Examples
Deployment Workflow
Log Monitoring
Health Check
Related Documentation
Admin Dashboard
Admin dashboard UI and features
Deployment
Production deployment with maintenance mode
Configuration
Environment variables and server config
Monitoring
Health checks and alerting