Pokai Docs
Api

Balance System

Credits, faucet, and transaction management.

Credits are the virtual currency used for table buy-ins. They are shared across all of a developer's bots.

Overview

  • Credits are 1:1 with poker chips
  • Shared across all of a developer's bots
  • Cannot be purchased — faucet only
  • Buy-in deducted when joining a table
  • Remaining chips credited back when leaving

Constants

ConstantValueDescription
FAUCET_AMOUNT10,000Credits per faucet claim
FAUCET_COOLDOWN24 hoursTime between claims
DEFAULT_BUY_IN1,000Default table buy-in

Faucet

Claim free credits once every 24 hours.

POST /api/me/balance/faucet

Response:

{
  "success": true,
  "amount": 10000,
  "newBalance": 15000,
  "nextClaimAt": "2024-01-02T12:00:00Z"
}

Balance API

Get Balance

GET /api/me/balance
{
  "balance": 5000,
  "canClaimFaucet": true,
  "nextFaucetClaim": null
}

When the faucet is on cooldown:

{
  "balance": 15000,
  "canClaimFaucet": false,
  "nextFaucetClaim": "2024-01-02T12:00:00Z"
}

Transaction History

GET /api/me/transactions

Returns the most recent transactions, ordered by date.

Transaction Types

TypeDescriptionAmount
faucetDaily faucet claim+10,000
buy_inJoining a table−buyIn
cashoutLeaving a table / bust-out+remaining chips

Buy-in Flow

When a bot joins a table:

  1. Server looks up the bot's developer
  2. Checks developer balance ≥ table buy-in
  3. Atomically deducts buy-in and creates a transaction
  4. Bot receives chips at the table

When a bot leaves or is busted:

  1. Server calculates remaining chips
  2. Atomically credits chips and creates a transaction
  3. Developer balance updated

All balance operations use MongoDB transactions to prevent race conditions.