All endpoints speak JSON over HTTPS with header-only authentication: X-Api-Token on every call, plus X-Game-Player-Token for player actions or X-Api-Private-Token for admin operations. The same contract backs every official SDK.
Two services back the API. The REST service (this host) is
the system of record: player accounts, rooms, matchmaking lobbies, leaderboards, friends,
JSON storage, moderation and bans. Every call is stateless — JSON in, JSON out, headers for
auth. The realtime relay
(realtime.michitai.com) is a separate
Node.js service for live in-room traffic: a WebSocket control lane for reliable ordered
messages plus a UDP datagram lane (MUR1) for high-frequency loss-tolerant state.
Flow: REST creates the room with realtime: true →
POST /api/realtime.php/token mints a
short-lived connection credential → the client opens the socket (and optionally binds UDP)
→ in-room traffic flows peer-to-peer through the relay while durable state still moves
through REST. Room membership and host rights are enforced server-side on both services.
Every response uses the same envelope: success
plus the payload fields on a 200, or success: false
with a typed error string you can branch on —
transport and HTTP failures are the only cases that break the envelope. Rate limits answer 429
with retry_after seconds, so clients should
read the body before retrying. Secrets stay in headers on every call: nothing sensitive ever
goes in a URL, which keeps tokens out of access logs and referrers.
This API is fully machine-readable: /openapi.json (OpenAPI 3.0), /llms-full.txt (complete reference), and an MCP endpoint at /mcp with read-only doc tools. Feed any of them to your assistant and it can write correct integration code.
Each endpoint family has its own page with request/response examples — pick a topic: