API Reference
Manage sessions programmatically, end to end: list your sessions with live status, create a session (account + strategy), move a session between your strategies, and start, restart or stop it. These endpoints authenticate with your API key, verify ownership of every row they touch, and send launch/cancel commands to your connected desktop client.
Base URL: https://api.b337.ai
Launch a session. Asynchronous: the call answers straight away with a pending envelope, and the launch result arrives when your client finishes logging in (via POST /api/bet_status or your callback_url).
POST /v3/start_session
| Parameter | Type | Required | Description |
|---|---|---|---|
| session_id | string | Yes | The session ID to launch |
| callback_url | string | No | http(s) URL to POST the launch result to (see Async v3) |
callback_url echoes your URL only if it was registered. The launch times out after 5 minutes. (A sandbox sample of this route returns 202.)
status is running or failed; on failure error says why.
Cancels a running session, waits 10 seconds, then launches it again.
POST /v3/restart_session
Same request body, response envelope and result as Start Session. The cancel is sent immediately; the correlation_id you get back belongs to the launch that follows 10 seconds later. If that launch never fires you see status: "timeout" after timeout_at, and it is safe to call restart again.
Stops one of your own running sessions. Stopping is never blocked by your subscription status, so you can always stop a running bot.
POST /v3/stop_session
| Parameter | Type | Required | Description |
|---|---|---|---|
| session_id | string | Yes | The session ID to stop |
| revoke | bool | No | Default false. If true, the stop also reaches a client that is offline right now: it stops the session as soon as it reconnects. The flag is cleared by your next start of that session |
delivered: false means your desktop client is not connected, so the stop did not reach it live. Send "revoke": true to make sure it stops when it reconnects.
Your sessions in one read: account, strategy and live status per row — everything the dashboard's Sessions page shows, without the dashboard. Use it to decide which sessions to re-point, start or stop.
GET /v3/sessions
| Parameter | Type | Required | Description |
|---|---|---|---|
| bookie | string | No | Only sessions on this bookmaker (e.g. tab) |
| strategy_id | string | No | Only sessions on this strategy |
| pc_id | string | No | Only sessions on this PC |
status is the live, client-reported state: launching right after a start is dispatched, then whatever the bot reports (commonly running). A session with no live state — never launched, or its state expired after it stopped — reads idle. balance / bonus_balance are the same cached live figures /v3/balance serves (null when no recent reading exists). Hidden accounts and internal housekeeping sessions are omitted, matching the dashboard.
Your strategies — the strategy_id values Create Session and Change Session Strategy take, so you can resolve a strategy by name (e.g. find "Mugging - light").
GET /v3/strategies
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | No | Only strategies of this type (e.g. classic_racing, sgm_saver) |
api-type strategies are listed (they own your Open/copy sessions) but are not valid targets for the two endpoints below — Open sessions are created with POST /accounts/create_api_session.
Attach one of your accounts to one of your existing strategies — the API twin of the dashboard's Add Session dialog. Creating a session never launches it; call /v3/start_session when you want it running.
POST /v3/create_session
| Parameter | Type | Required | Description |
|---|---|---|---|
| account_id | string | Yes | One of your accounts |
| strategy_id | string | Yes | One of your strategies (not api-type) |
| pc_id | string | Yes | The PC the session should run on |
| use_bypass | bool | No | TAB number-login path. Defaults to true on TAB accounts, false elsewhere |
Idempotent per (account, strategy): if that pairing already has a session, it is returned with "existing": true instead of being duplicated.
Re-point an existing session at another of your strategies — move an account between, say, "Mugging", "Mugging - light" and a promos strategy without touching the dashboard.
POST /v3/change_session_strategy
| Parameter | Type | Required | Description |
|---|---|---|---|
| session_id | string | Yes | The session to re-point |
| strategy_id | string | Yes | The target strategy (yours, not api-type) |
The change applies from the session's next launch — a running bot keeps the strategy it launched with. session_status echoes the live state so you know whether to call /v3/restart_session. Refused (409): converting an Open (api) or copy-trading session in place, targeting a housekeeping strategy, or creating a duplicate (account, strategy) pairing.
| Field | Type | Description |
|---|---|---|
| status | string | "stopped" |
| session_id | string | The session that was stopped |
| delivered | bool | Whether the cancel reached a connected client. false means no client is connected right now |
| Status Code | Description |
|---|---|
| 400 | Missing session_id (start, restart and stop), callback_url must be an http(s) URL, (stop) a body that is not JSON, or missing required fields (create / change) |
| 401 | Invalid API key |
| 403 | Session does not belong to this user; No valid subscription (start/restart); or the launch gate's own message when your plan may not run this session's strategy (start/restart); This session is in paper trading mode. Turn Paper off to run it with the bot. (start/restart: a paper session never runs the bot) |
| 404 | Session not found or invalid; Account not found / Strategy not found (create / change — also returned for rows that are not yours) |
| 409 | create / change refusals: api-type or housekeeping strategy target, re-pointing an Open/copy session, or a duplicate (account, strategy) pairing |
| 422 | No X-API-Key header |
| 503 | (start/restart) Couldn't confirm this session isn't in paper trading mode. Try again in a moment.: the paper flag could not be read; retry after a short wait |
| 500 | Internal server error |
Error Response Example:
POST /api/bet_status with the correlation_id or supply a callback_url"revoke": true keeps an offline client from resuming, and your next start clears itGET /v3/strategies once to resolve the ids, then per move — POST /v3/change_session_strategy, and POST /v3/restart_session if session_status says it is running/v3/start_session keeps every launch gate (subscription, plan and strategy-type rules)