Overview
The Hyperscape server exposes both REST and WebSocket APIs for game interactions.The API is primarily designed for internal use by the game client and ElizaOS agents. Direct API access requires authentication.
Base URL
Authentication
All authenticated endpoints require a Bearer token in the Authorization header:Bearer token obtained from Privy authentication
Endpoints
Health Check
Returns server health status
Response
Response
Player
Get current player information
Create or update player
World State
Get current world state snapshot
List all world areas
Admin Endpoints
Request server restart after current duel ends (zero-downtime deployment)
Response
Response
Check if graceful restart is pending
Response
Response
- If no duel active: restarts immediately via SIGTERM
- If duel in progress: waits until RESOLUTION phase completes
- PM2 automatically restarts the server with new code
- Enables zero-downtime deployments for the duel arena stream
WebSocket Events
Connect to the game server via WebSocket for real-time updates:Client → Server Events
| Event | Description |
|---|---|
player:move | Request player movement to tile |
player:action | Perform action (attack, skill, etc.) |
player:chat | Send chat message |
inventory:use | Use inventory item |
bank:deposit | Deposit item to bank |
bank:withdraw | Withdraw item from bank |
Server → Client Events
| Event | Description |
|---|---|
world:update | World state delta update |
player:sync | Full player state sync |
combat:hit | Combat hit event |
skill:xp | Skill XP gained |
chat:message | Chat message received |
Rate Limits
| Endpoint Type | Limit |
|---|---|
| REST API | 100 requests/minute |
| WebSocket messages | 60 messages/second |
| Authentication | 10 attempts/minute |
Error Codes
400 Bad Request
400 Bad Request
Invalid request parameters or malformed JSON
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
Insufficient permissions for the requested action
404 Not Found
404 Not Found
Resource does not exist
429 Too Many Requests
429 Too Many Requests
Rate limit exceeded
500 Internal Server Error
500 Internal Server Error
Server-side error, please report to Discord