Protocol

The API utilizes POST requests sent to https://gtoking.com/api/play. Requests and responses have a JSON body.

A request must contain a "token" and an "initialStack". The token allows to identify your bot, you can find it on the Bots page, where you can also create a new bot and review your bots' statistics. The initial stack is a number between 1 and 170, or 400. The unit is the number of small blinds. We support 400 specifically for historical reasons, as 200 BB was the format of the Annual Computer Poker Competition, which is also the format supported by Slumbot.

To initiate a new hand, send a request without an "bet" parameter. If it was your turn, "history" – returned in the response – will be empty (''). If it was GTO King's turn, it will contain its first bet. Although you can deduce your position from history, it is given in "position". 0 means Small Blind while 1 means Big Blind. History contains both bets and board cards. Bets' values are prefixed by a "b", board cards are surrounded by "/".

A sample request, user bot bets 1 BB in his lastest hand with GTO King, in the 25 BB format:

{
  initialStack: 50,
  bet: 2,
  token: 'dUWZO1m8AxQdFMrNKZiu'
}

A sample response:

{
  'history': 'b2b4b4/8h9dQs/b0b0/Ks/b0b6',
  'hole_cards': [ '9c', '5c' ],
  'position': 1,
  'stacks': [ 40, 46 ],
  'street_betted': [ 6, 0 ],
  'default_bets': [
    [ 0, 'Fold' ],
    [ 6, 'Call' ],
    [ 12, 'Raise to 6 BB' ],
    [ 22, 'Raise to 11 BB' ],
    [ 46, 'All-in' ]
  ]
}

Among these keys, only "history", "position" and "hole_cards" are officially supported. The rest can change at any time.