How do I get preflop strategy from an API?
Call POST /v1/gto/preflop with Hero's two cards, Hero's position, and every preflop action before Hero. Pokerai API derives the spot and returns a JSON strategy distribution for that hand.
hole_cards, positions.hero, and the complete preflop_actions sequence, and optionally select preflop_version. Read each item in strategy as a frequency, not as a recommended move.Quick facts
| Endpoint | POST /v1/gto/preflop |
|---|---|
| Required input | hole_cards, positions.hero, and preflop_actions |
| Output | The derived situation, mixed strategy[], and current quota usage |
| Quota | Each call charges 1 general presolved lookup; it does not use real-time solve quota |
| Intended use | Training, study, coaching, hand review, and research — never real-money RTA |
Build the preflop request
The action line is explicit and ordered. Start with the blind posts, include every fold, call, and raise before Hero, and stop before Hero acts. Do not include Hero in preflop_actions.
| Field | What to send |
|---|---|
hole_cards | Exactly two cards as one unseparated string, such as "AhKh". |
positions.hero | Hero's seat in the current 6-max position set: SB, BB, UTG, MP, CO, or BTN. |
preflop_actions | The complete sequence before Hero. Each item has position and action; non-fold actions include the newly invested amount in BB, not a running total. |
preflop_version | Optional chart-set ID. Omit it for the platform default, or use an ID returned by GET /v1/gto/preflop/versions. |
Minimal curl request
curl -s https://pokerai.bet/v1/gto/preflop \
-H "Authorization: Bearer $POKERAI_API_KEY" -H "Content-Type: application/json" \
-d '{"hole_cards":"AhKh","positions":{"hero":"MP"},"preflop_version":"6max_RC_100bb_200NL",
"preflop_actions":[{"position":"SB","action":"small blind","amount":0.5},
{"position":"BB","action":"big blind","amount":1},
{"position":"UTG","action":"raise","amount":3}]}'
Read the real response
This captured response matches the request above: Hero has AhKh in MP facing a UTG open. situation is derived from the action line, and quota reports this key's monthly usage.
{"hole_cards": "AhKh", "situation": "Raise", "strategy": [{"action": "raise", "frequency": 1, "amount_bb": 9, "sizing_pot": 0.8}], "quota": {"used": 7, "limit": 100}}
How mixed frequency works
Each frequency is a probability from 0 to 1, and the action frequencies for the hand normally sum to about 1. Some hands are pure, as in the response above; others are genuinely mixed.
For example, a captured response for 9h9s in MP facing a 2.5BB UTG open returned fold 0.254, call 0.106, and raise 0.64. That means 25.4% fold, 10.6% call, and 64% raise. The API exposes the distribution; it does not promise or choose a recommended action.
What amount_bb means
For a returned raise, amount_bb is the absolute amount to raise to in big blinds. It is not the incremental amount used inside the request's action history.
| Raises before Hero | Derived spot | amount_bb |
|---|---|---|
| 0 | Open | 3 |
| 1 | 3-bet | 9 |
| 2 | 4-bet | 25 |
| 3 or more | 5-bet+ | 100 with allin: true |
Choose preflop_version safely
The optional preflop_version selects a preflop chart set, and the same spot can have different frequencies across versions. The example uses 6max_RC_100bb_200NL; omitting the field selects the platform default.
Treat GET /v1/gto/preflop/versions as the authoritative discovery endpoint. Use an ID it returns instead of assuming that today's IDs, stack depths, or formats are permanent.
Quota and retries
A preflop lookup consumes 1 general presolved quota. The response's quota.used and quota.limit show the current monthly counter for that API key; usage is also visible in the dashboard.
Do not retry a quota-exhausted request. Wait for the monthly reset or change the available quota; reserve retry logic for transient failures documented by the API.
Common errors
| HTTP | Error | Cause and fix |
|---|---|---|
| 400 | invalid_hole_cards | Send exactly two valid cards in hole_cards. |
| 400 | invalid_positions / invalid_actions | Use a documented Hero position and a complete, legal action sequence that starts with the blind posts. |
| 400 | unsupported_preflop_version | Refresh GET /v1/gto/preflop/versions and pass one of the returned IDs. |
| 401 | missing_api_key / invalid_api_key | Send a valid API key in the Authorization: Bearer header. |
| 404 | no_solution | The requested spot has no presolved data; verify or change the spot instead of retrying unchanged. |
| 429 | quota_exceeded | The monthly general quota is exhausted; an immediate retry will not help. |
When to use this — and when not to
Use preflop strategy lookups in trainers, study tools, coaching workflows, hand-review queues, research, and offline agent analysis. Store the returned frequencies with the version and input spot so a review remains reproducible.
Do not use Pokerai API for real-time assistance at real-money tables, and do not turn mixed output into a claim that one move is guaranteed or recommended. Real-time assistance at real-money tables is prohibited. See the Terms.
Do not use Pokerai API for real-time assistance at real-money tables, and do not turn mixed output into a claim that one move is guaranteed or recommended. Real-money RTA is prohibited by the Terms.
Reference, SDK, and next steps
- Interactive API reference — request and response schema for POST /v1/gto/preflop
- Developer docs — authentication, full preflop behavior, quota, and error details
- Poker GTO API quickstart — make a first authenticated API request
- English OpenAPI snapshot — machine-readable contract for clients and tools
- Python SDK — typed Python client generated from the public contract
- JavaScript / TypeScript SDK — typed client for JavaScript and TypeScript applications
- MCP server — Pokerai API tools for compatible AI agents
- No-RTA policy — acceptable-use boundary for real-money play