Skip to content

Native embedding ​

Instead of an iframe, a platform can draw the sportsbook itself with oddyne-frontend-core and talk to the player API directly. This page covers the backend side: sessions, browsing without a session, and serving the API from your own domain. The frontend side is the Frontend library.

Sessions ​

Your server opens a session for a logged-in player and hands the token to your frontend. Same site key and same trust as POST /api/launch, but the answer is a token, not a URL.

bash
curl -s -X POST https://api.oddyne.com/api/session \
  -H "Authorization: Bearer $SITE_API_KEY" -H "Content-Type: application/json" \
  -d '{"siteId": "brand-a", "userId": "p-1029", "currency": "EUR", "lang": "en"}'
json
{
  "success": true, "code": 0, "message": "Success",
  "data": {
    "token": "eyJhbGciOi…", "expiresAt": "2026-11-21T10:15:00Z",
    "refreshToken": "eyJhbGciOi…", "refreshExpiresAt": "2026-11-21T22:00:00Z"
  }
}
Field
siteId, userIdrequiredYour site and your player id
currencyoptionalRecorded on the player: their bets are in it. Must be one of the site's currencies
lang, username, partneroptionalAs on launch
expiryMinutesoptionalSession lifetime, 5–1440; default 15

The session token goes to the browser and on every player call as Authorization: Bearer <token>, and on the socket as ?token=.

The refresh token (12 hours) stays on your server. It is not a session: the API and the socket refuse it.

POST /api/session/refresh ​

Before the session expires — or when the frontend reports onSessionExpired — exchange the refresh token for the next session (and the next refresh token):

json
{ "refreshToken": "eyJhbGciOi…", "expiryMinutes": 15 }

Same answer as /api/session. A refresh token of another site, or one issued before the player's sessions were revoked, answers 401.

POST /api/session/revoke ​

When the player logs out, self-excludes or is blocked:

json
{ "userId": "p-1029" }
json
{ "success": true, "code": 0, "data": { "revokedAt": "2026-11-21T10:02:11Z" } }

Every token issued to the player until that moment — sessions and refresh tokens — is refused: on the player API within 5 seconds, and an open socket is closed at its next session check (within 5 minutes; a socket carries reads only). A new session opened after the revocation works. To stop a player betting without ending their session, block them instead (PUT /sites/{siteId}/players/{ref}/risk in the Admin API).

Browsing without a session ​

The catalogue, prematch and live lists, event pages, results and the live socket work without a token — a visitor browses as anonymous. Set a token at any time and the same frontend continues as that player; no reload, no new socket address.

Calls that need a player answer 401 without one: placing a bet, the player's tickets, cashout. The frontend turns that into onLoginRequired.

Serving the API from your domain ​

You may proxy the player API and the socket through your own gateway, for example https://brand-a.com/sb/api/* → https://api.oddyne.com/api/* and wss://brand-a.com/sb/ws → wss://api.oddyne.com/ws/feed.

  • No cookies. Authentication is the Authorization header (and ?token= on the socket), so any origin works; CORS allows every origin and the headers the API reads (Authorization, Content-Type, siteid).
  • The player's address. Rate limits are per player address. Send it in X-Forwarded-For from your gateway, and give us your gateway's egress addresses: only forwarding headers set by a proxy we know are believed — otherwise any client could choose its own address.
  • The socket is a plain WebSocket: no sticky sessions, any instance serves any connection. The server sends a heartbeat every 30 seconds; keep your proxy's idle timeout above 60 seconds. On a close with code 1008 (session expired or revoked) refresh the session before reconnecting — reconnecting with the same token will be refused.

Integration documentation for the Oddyne Sportsbook.