weiqi-server exposes everything under the /api prefix. All endpoints
require an authenticated session unless marked public .
Session cookie: better-auth.session_token. The __Secure- prefix is tried
first. The guard lives in
apps/weiqi-server/src/modules/accounts/presentation/guards/auth.guard.ts:30.
Roles (passed to Auth(...roles) decorator):
Role Notes userDefault for any signed-in account. modChallenge moderation queue access. adminAdmin console access. super_adminReserved for emergency overrides.
Method Path Auth Notes GET /accounts/meYes Current user profile. PATCH /accounts/meYes Update display name etc.
Method Path Auth Notes POST /gamesYes Create a PvP game record. GET /gamesYes List games for the caller. GET /games/:idYes Game metadata. PATCH /games/:idYes Update metadata (e.g. archive). POST /games/:id/movesYes Append a move; validates with weiqi-engine. GET /games/:id/movesYes Move history.
Method Path Auth Notes GET /game/bot/levelsYes Catalog of the ten levels. See Bot Ladder . POST /game/bot/gamesYes Start a new bot game. GET /game/bot/games/:idYes Game state. GET /game/bot/games/:id/movesYes Move list. GET /game/bot/games/:id/reviewYes Latest KataGo review. POST /game/bot/games/:id/moveYes Player move; bot replies. POST /game/bot/games/:id/resignYes Resign. POST /game/bot/games/:id/hintYes One-move hint. Entitlement-gated. POST /game/bot/games/:id/undoYes Undo last move. GET /game/bot/ladder/meYes Caller’s ladder state. POST /game/bot/ladder/opt-inYes Toggle ladder participation. GET /game/bot/ladder/history?limit=50Yes Recent rating deltas.
Method Path Auth Notes POST /analysis/games/:id/runFullReviewYes One-call whole-game review. See KataGo Review . GET /analysis/games/:id/snapshotsYes Per-node KataGo snapshots. GET /analysis/games/:id/graphYes Winrate / score-lead series.
Method Path Auth Notes POST /challengesYes Submit a new challenge. GET /challengesPublic Browse approved challenges. POST /challenges/:id/solution-attemptsYes Submit a solution. GET /challenges/moderation/listmodModerator queue. POST /challenges/moderation/approvemodApprove a submission. POST /challenges/moderation/rejectmodReject a submission. GET /challenges/my-submissions/listYes Caller’s own submissions.
Method Path Auth Notes POST /agent/runadminRun a natural-language analytics query. GET /agent/tasks/:idadminPoll status of an agent task.
Socket.IO endpoint at /socket.io/ on the same origin. Auth is via the same
session cookie. Events emitted: gameState, botMove, classified,
gameEnded, plus analysis:turn while a runFullReview is in progress.
All errors share the same envelope:
"message" : " GameMessages.YOU_CANT_PLACE_STONE_ON_THIS_POSITION " ,
code is a stable, machine-readable identifier. message is human-readable
and may change between versions. Clients should branch on code.