Skip to main content

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

https://hyperscape-production.up.railway.app
The production API is deployed on Railway. The frontend is served separately from Cloudflare Pages at hyperscape.club.

Authentication

All authenticated endpoints require a Bearer token in the Authorization header:
curl -H "Authorization: Bearer <your-token>" \
  https://hyperscape-production.up.railway.app/api/v1/player
Authorization
string
required
Bearer token obtained from Privy authentication

Endpoints

Health Check

GET /health
endpoint
Returns server health status
curl https://api.hyperscape.club/health
{
  "status": "ok",
  "timestamp": "2025-01-05T12:00:00Z",
  "version": "1.0.0"
}

Player

GET /api/v1/player
endpoint
Get current player information
POST /api/v1/player
endpoint
Create or update player

World State

GET /api/v1/world
endpoint
Get current world state snapshot
GET /api/v1/world/areas
endpoint
List all world areas

Game Data

GET /api/data/skill-unlocks
endpoint
Get skill unlock definitions for all skills
New in v1.0: Server-authoritative skill unlock data for the Skill Guide Panel.
curl https://api.hyperscape.club/api/data/skill-unlocks
{
  "attack": [
    {
      "level": 1,
      "description": "Bronze weapons, Iron weapons",
      "type": "item"
    },
    {
      "level": 5,
      "description": "Steel weapons",
      "type": "item"
    },
    {
      "level": 40,
      "description": "Rune weapons",
      "type": "item"
    },
    {
      "level": 60,
      "description": "Dragon weapons",
      "type": "item"
    }
  ],
  "woodcutting": [
    {
      "level": 1,
      "description": "Normal trees",
      "type": "item"
    },
    {
      "level": 15,
      "description": "Oak trees",
      "type": "item"
    }
  ],
  "prayer": [
    {
      "level": 1,
      "description": "Thick Skin (+5% Defense)",
      "type": "ability"
    },
    {
      "level": 4,
      "description": "Burst of Strength (+5% Strength)",
      "type": "ability"
    }
  ]
}
Response Fields:
  • level (number) - Required skill level
  • description (string) - What is unlocked
  • type (string) - Unlock category: item, ability, area, quest, or activity
Usage:
  • Fetched by Skills Panel on mount
  • Cached in client state
  • Used by Skill Guide Panel to display unlocks
  • No authentication required (public data)
Implementation:
// packages/server/src/startup/routes/data-routes.ts
import { getAllSkillUnlocks } from "@hyperscape/shared";

fastify.get("/api/data/skill-unlocks", async (_req, reply) => {
  const unlocks = getAllSkillUnlocks();
  return reply.send(unlocks);
});

WebSocket Events

Connect to the game server via WebSocket for real-time updates:
const ws = new WebSocket('wss://api.hyperscape.club/ws');

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('Received:', data);
};

Client → Server Events

EventDescription
player:moveRequest player movement to tile
player:actionPerform action (attack, skill, etc.)
player:chatSend chat message
inventory:useUse inventory item
bank:depositDeposit item to bank
bank:withdrawWithdraw item from bank
tradeRequestRequest trade with another player
tradeRequestRespondAccept/decline trade request
tradeAddItemAdd item to trade offer
tradeRemoveItemRemove item from trade offer
tradeAcceptAccept current trade state
tradeCancelCancel trade

Server → Client Events

EventDescription
world:updateWorld state delta update
player:syncFull player state sync
combat:hitCombat hit event
skill:xpSkill XP gained
chat:messageChat message received
tradeIncomingTrade request received
tradeStartedTrade session started
tradeUpdatedTrade offer changed
tradeConfirmScreenMove to confirmation screen
tradeCompletedTrade completed successfully
tradeCancelledTrade cancelled
tradeErrorTrade error occurred

Trading Protocol

Rate Limits

API rate limits apply to prevent abuse. Exceeding limits will result in temporary blocks.
Endpoint TypeLimit
REST API100 requests/minute
WebSocket messages60 messages/second
Authentication10 attempts/minute

Error Codes

Invalid request parameters or malformed JSON
Missing or invalid authentication token
Insufficient permissions for the requested action
Resource does not exist
Rate limit exceeded
Server-side error, please report to Discord

SDKs & Libraries

Need Help?