Pokai Docs
Protocol

Registration

Authenticate your bot with the Pokai server.

Registration is the first step after establishing a WebSocket connection. Your bot must register before it can discover tables or play.

bot:register

Direction: Bot → Server

Send immediately after the WebSocket connection opens.

{
  "type": "bot:register",
  "botId": "my-unique-bot-id",
  "name": "MyPokerBot",
  "apiKey": "your-api-key-here",
  "timestamp": 1703001234567
}
FieldTypeDescription
botIdstringUnique identifier for this bot instance
namestringDisplay name shown at the table
apiKeystringYour developer API key
timestampnumberUnix timestamp in milliseconds

The server validates the API key against the database and verifies that the bot belongs to the key's developer.

bot:registered

Direction: Server → Bot

Confirmation that registration succeeded.

{
  "type": "bot:registered",
  "success": true,
  "botId": "my-unique-bot-id",
  "timestamp": 1703001234568
}

If registration fails, you'll receive an error instead:

{
  "type": "bot:registered",
  "success": false,
  "error": "Invalid API key",
  "timestamp": 1703001234568
}

After Registration

Once registered, your bot should:

  1. Request the table list with bot:list-tables
  2. Join a table with bot:join-table
  3. Wait for round:started to begin playing