Choose your API
REST API
Request / response over HTTPS. Use for login, account state, history, market lookups, and batch place / edit / cancel.
Orders WebSocket
Persistent low-latency channel for placing and cancelling orders. Use when you care about round-trip latency.
Streaming WebSocket
Push feeds for orderbook ticks and per-account fills / settles. Use to keep state in sync without polling.
When to use which
Authentication
There are no API keys. You authenticate with the same username and password you use to log in at 4casters.io, and all three APIs share the one token that login returns. API keys are planned; see Authentication for the current state.- Call
POST /user/loginon the REST API with your username and password. - Send the returned token on every subsequent request:
- REST:
Authorization: Bearer <token>header. - WebSockets:
Authorization: <token>header on the handshake.
- REST:
Conventions
- Transport: HTTPS / WSS only.
- Encoding: JSON everywhere.
- Response envelope (REST):
{ "data": <payload> }on success;{ "error": "<message>" }on HTTP errors. - Identifiers: Game ids, participant ids, and order ids are MongoDB
ObjectIDstrings (24-char hex). - Odds: American format (negative for favorites, positive for underdogs) unless noted.
- Time: ISO 8601 with
Z(UTC).
A typical integration
Most non-trivial clients combine all three:- REST —
POST /user/loginonce, cache the token, then callGET /user/getMeandGET /games/v2/leaguesto bootstrap state. - Streaming WebSocket — open the price feed for the markets you care about and the user feed to react to your own fills / settles.
- Orders WebSocket — open a persistent connection and place / cancel orders with low latency, correlating responses by
requestID. - REST — fall back to
POST /myBets/getMatchedBets,/myBets/getOrdersForGame, etc. for history and reconciliation.
Need the old docs?
The previous documentation lived as a Postman collection. It’s preserved for reference, but these Mintlify docs are now the source of truth — the Postman collection may lag behind for new endpoints, parameters, or response shapes.4Casters API — Postman collection
View the legacy Postman documentation