Skip to main content
4casters exposes three APIs that share the same auth token and the same underlying account / orderbook / settlement engine. Pick the one that matches what you’re building, or mix-and-match — most integrations use REST for setup + history and a WebSocket for live trading.

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.
  1. Call POST /user/login on the REST API with your username and password.
  2. Send the returned token on every subsequent request:
    • REST: Authorization: Bearer <token> header.
    • WebSockets: Authorization: <token> header on the handshake.
Tokens are valid for 30 days and are rotated automatically after that. See Authentication for token lifetime, error handling, and credential guidance, and the REST login reference for the full response shape.

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 ObjectID strings (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:
  1. REST — POST /user/login once, cache the token, then call GET /user/getMe and GET /games/v2/leagues to bootstrap state.
  2. Streaming WebSocket — open the price feed for the markets you care about and the user feed to react to your own fills / settles.
  3. Orders WebSocket — open a persistent connection and place / cancel orders with low latency, correlating responses by requestID.
  4. 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