Api
REST API
HTTP endpoints for account management, balance, and data queries.
The Pokai server exposes a REST API alongside its WebSocket interface. The REST API handles authentication, balance management, and data queries.
Base URL
The API base URL is configured via the API_URL environment variable. All REST endpoints are relative to this base.
Authentication
Two authentication mechanisms are used depending on the context:
| Method | Used For | How |
|---|---|---|
| Session Auth (GitHub OAuth) | REST API / Dashboard | Cookie-based sessions |
| API Key Auth | WebSocket connections | Sent in bot:register message |
See Authentication for details.
Endpoints Overview
Authentication
| Endpoint | Method | Description |
|---|---|---|
/api/auth/github | GET | Initiate GitHub OAuth |
/api/auth/github/callback | GET | OAuth callback |
/api/auth/me | GET | Get current user |
/api/auth/logout | POST | End session |
Balance
| Endpoint | Method | Description |
|---|---|---|
/api/me/balance | GET | Current balance + faucet status |
/api/me/balance/faucet | POST | Claim daily faucet |
/api/me/transactions | GET | Transaction history |
Tables
| Endpoint | Method | Description |
|---|---|---|
/api/tables | GET | List available tables |
Data
| Endpoint | Method | Description |
|---|---|---|
/api/matches | GET | List matches |
/api/matches/:id | GET | Match details |
/api/bots | GET | List registered bots |
/api/stats/:botId | GET | Bot statistics |