Admin API Documentation
Administrative endpoints for managing Hyperscape server deployments.Authentication
All admin endpoints require authentication via thex-admin-code header:
ADMIN_CODE in your environment variables or .env file.
Graceful Restart
POST /admin/graceful-restart
Request a server restart after the current duel ends. Enables zero-downtime deployments for the duel arena stream. Headers:x-admin-code(required): Admin authentication code
- If no duel active (IDLE/ANNOUNCEMENT): Restarts immediately via SIGTERM
- If duel in progress (FIGHTING/RESOLUTION): Waits until RESOLUTION phase completes
- PM2 automatically restarts the server with new code
- No interruption to active duels or streams
- Deploy new code without interrupting active duels
- Update server configuration during live streams
- Apply security patches with minimal disruption
GET /admin/restart-status
Check if a graceful restart is pending. Headers:x-admin-code(required): Admin authentication code
success(boolean): Request succeededpendingRestart(boolean): Whether restart is pendingcurrentPhase(string): Current duel phase (IDLE, ANNOUNCEMENT, FIGHTING, RESOLUTION)
Programmatic API
The graceful restart functionality is also available programmatically via theStreamingDuelScheduler class:
Error Responses
401 Unauthorized:Configuration
Set the admin code in your environment:- Never commit
ADMIN_CODEto git - Use a strong, randomly generated code
- Rotate the code periodically
- Store in GitHub Secrets for CI/CD deployments
Related Documentation
- Deployment Process - Vast.ai deployment script
- PM2 Configuration - PM2 process management
- Streaming Status Check - Health monitoring script