Core Concepts
Sessions
Sessions are the foundation of the API. An active session represents a connection to a betting site and is required before you can place bets.
A session is an active connection to a specific betting site (e.g., TAB, Sportsbet). The API drives sessions running the API strategy, which you manage under Sessions → Open in the dashboard — or entirely over the API with the Account Lifecycle endpoints (add an account, then create_api_session). /v3/sessions lists every session except housekeeping sessions and hidden accounts; only sessions on the API strategy take API bets. Sessions:
- Maintain authentication state with the betting site
- Enable bet placement operations
- Are managed by the client application
- Can be reused for multiple bets
- Must be active before placing bets
To retrieve all active sessions for your account, send a GET request to /v3/sessions:
Request
GET /v3/sessions
Response
{
"sessions": [
{
"session_id": "uuid-string",
"bookie": "tab",
"username": "user@example.com",
"nickname": "Main TAB",
"account_id": "account-uuid",
"pc_id": "pc-identifier",
"use_bypass": true,
"strategy": { "strategy_id": 101, "name": "Mugging", "type": "classic_racing" },
"status": "running",
"balance": 120.5,
"bonus_balance": 0
},
{
"session_id": "uuid-string-2",
"bookie": "sportsbet",
"username": "user@example.com",
"nickname": null,
"account_id": "account-uuid-2",
"pc_id": "pc-identifier",
"use_bypass": false,
"strategy": { "strategy_id": 101, "name": "Mugging", "type": "classic_racing" },
"status": "idle",
"balance": null,
"bonus_balance": null
}
],
"count": 2
}
Example: cURL
curl https://api.b337.ai/v3/sessions \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"
Example: Python
import requests
response = requests.get(
'https://api.b337.ai/v3/sessions',
headers={
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
}
)
data = response.json()
print('Active Sessions:', data['sessions'])
Each session carries a status, the live state its client reports:
status | Meaning |
|---|
running | The session is up; bet only on sessions in this state. |
launching | A start was just dispatched; wait for it to settle. |
idle | No live state: never launched, or it expired after the session stopped. Start it with POST /v3/start_session. |
| anything else | Whatever the bot last reported (for example done …). Treat it as not running. |
balance and bonus_balance are the cached live figures /v3/balance serves; they are null when no recent reading exists, so do not read null as an empty account.
The following bookmaker groups are supported for racing betting:
- Entain Group - Ladbrokes, Neds
- Sportsbet - Sportsbet
- TAB - TAB, TABTouch
- BetMakers - 30+ brands including BaggyBet, BossBet, DiamondBet, PonyBet, RealBookie, SwiftBet, and more
- GenWeb - 12 brands including BetBetBet, MyBet, MidasBet, JimmyBet, LetsBet, Ultrabet, VicBet, and more
- Amuse - 8+ brands including BetDeluxe, BetNation, BigBet, Surge, PulseBet, Noisy, and more
- PuntersTech - 8 brands including MintBet, BlondeBet, BetFocus, VinBet, TradieBet, LightningBet, and more
- PointsBet - PointsBet
- Betr - Betr
- BetRight - BetRight
- PlayUp - PlayUp
- PalmerBet - PalmerBet
- ColossalBet - ColossalBet
- BetCloud - 12 brands including QuestBet, BetGalaxy, WellBet, VolcanoBet, and more
- EliteBet - EliteBet
- BetKings - BetKings
Sports bets (singles, SGMs and multis) go to any session whose bookmaker has a sports surface. Racing-only bookmakers (for example EliteBet, MyBet, BoostBet) refuse a sports bet with 422 at the API instead of accepting it. See the Sports Betting guide for which books support SGMs and multis.
- Check Session Status - Always verify sessions are active before placing bets
- Handle Disconnections - Implement retry logic for disconnected sessions
- Error Handling - Always check session status before placing bets
404 Session Not Found
{
"detail": "Session not found"
}
403 Not Your Session
{
"detail": "Session does not belong to user"
}
403 Session Not Active
The session is yours but is not running.
{
"detail": "Session is not active"
}
- Place Bet - Place racing & sports bets using sessions