SPXGAME Agent API

One contract. Casino and sports use the same api_key, secret_key, and player_id. Do not send a balance on launch.

Launch: https://spxgame.games · JSON · Desk currency: TND

Panel: https://spxgame.games/. Save the callback and the secret under API Configuration. This page is the document that button opens.

1. Overview

Two directions. Do not mix them.

DirectionWhoWhatAuth
You → SPXGAMELaunchOpens a game or Altenarapi_key + secret_key
SPXGAME → YouMoneyBalance, bet, win, refundPanel callback URL
  1. The player clicks on your site.
  2. You POST /api/v2/launch.
  3. You open data.launch_url in an iframe.
  4. Your wallet answers status: 1 and the latest balance.

Do not send a balance on launch. With no callback saved, the balance is the player deposit on this account. When a callback is saved, this server asks your site, then records the bet and the win. Home GGR is bets minus wins. The deposit is the solde, not GGR. The same transaction_id is applied once.

2. Authentication

FieldRequiredUse
api_keyYesLaunch. The key on API Configuration.
secret_keyYes, once createdLaunch. The secret on API Configuration. It must match.
callback_urlYes, on the panelYour HTTPS wallet.
player_idYesYour player id. 1–64 characters: letters, digits, _ . : -.
{
  "api_key": "YOUR_API_KEY",
  "secret_key": "YOUR_SECRET_KEY"
}

Send both fields in the JSON body. A missing, wrong, or inactive key returns HTTP 401 UNAUTHORIZED.

When a secret is saved, every wallet POST also sends X-Sign: HMAC-SHA256 of the raw body, hex. Catalog and panel calls are a different door. Those use Authorization: Bearer and the same API key. Do not put the bearer token on /api/v2/launch.

3. Wallet — your server

This server POSTs to your callback on every money move. Casino and Altenar use the same four methods.

SettingValue
URLCallback URL from API Configuration
MethodPOST
Content-Typeapplication/json
Timeout5 seconds
SignatureX-Sign when a secret is saved

Always return the latest balance. The same transaction_id must be idempotent — do not debit twice. status: 1 means success. Do not use HTTP 5xx for insufficient funds. Answer HTTP 200 and status: 0.

3.1 user_balance

{
  "method": "user_balance",
  "user_id": "12345"
}
{
  "status": 1,
  "balance": 250.00
}

3.2 Bet — transaction_bet

Sent when a player places a stake. Debit bet from user_id once. A second POST with the same transaction_id must return the same balance and must not debit again.

{
  "method": "transaction_bet",
  "transaction_id": "trx123",
  "round_id": "rnd456",
  "user_id": "12345",
  "bet": 50.00,
  "game": "sweet_bonanza",
  "currency": "TND",
  "currency_code": "TND"
}
FieldRequiredDescription
methodYestransaction_bet
transaction_idYesIdempotency key
round_idYesRound or coupon
user_idYesYour player id
betYesStake
gameNoGame id, or altenar

Success:

{ "status": 1, "balance": 200.00 }

Insufficient funds:

{ "status": 0, "balance": 10.00 }

3.3 Win — transaction_win

Cashout uses this too. win: 0 may arrive for a lost coupon. Do not reject it. A freespin win can arrive on its own. Accept it and credit the net profit.

{
  "method": "transaction_win",
  "transaction_id": "trx123-win",
  "round_id": "rnd456",
  "user_id": "12345",
  "win": 100.00,
  "game": "sweet_bonanza",
  "currency": "TND",
  "currency_code": "TND"
}
{ "status": 1, "balance": 300.00 }

3.4 Refund

Credit the player. Use this for a cancelled stake, a voided coupon, or a provider rollback. The amount is refund, not bet. Apply each transaction_id once. A repeated refund must not credit twice.

{
  "method": "refund",
  "transaction_id": "trx123-rf",
  "round_id": "rnd456",
  "user_id": "12345",
  "refund": 50.00,
  "game": "altenar",
  "currency": "TND",
  "currency_code": "TND"
}
{ "status": 1, "balance": 250.00 }

3.5 Rollback

There is no separate rollback method. A rollback is delivered as method: "refund". Credit refund and return the new balance. Sports void (bet_void) uses this same callback after the original stake was taken. If that stake was never stored, this server does not call you.

EventMethod you receiveAmount fieldYour ledger
Staketransaction_betbetDebit once
Win, cashout, or lost coupontransaction_winwin (may be 0)Credit once
Refund, void, or rollbackrefundrefundCredit once

The refund transaction_id is not the bet transaction_id. Keep both. Reply:

{ "status": 1, "balance": 250.00 }

Reject a refund you cannot apply with HTTP 200 and status: 0. HTTP 5xx means this server will retry the credit.

3.6 Wallet replies

Your replyMeaning
HTTP 200 + status: 1 + balanceAccepted
HTTP 200 + status: 0 + balanceRejected. A bet is treated as insufficient funds.
HTTP 5xx or timeoutNot accepted. A bet is not taken. A win is retried.

This server does not call account_details.

4. Provider list

GET https://spxgame.games/api/casino/providers

Auth is the API key, not the launch secret. Send Authorization: Bearer YOUR_API_KEY or ?api_key=YOUR_API_KEY. Do not send secret_key on this call.

GET /api/casino/providers?api_key=YOUR_API_KEY

Success:

{
  "ok": true,
  "flexrix_configured": true,
  "items": [
    {
      "code": "pragmatic",
      "label": "Pragmatic Play",
      "enabled": true,
      "owner_enabled": true,
      "games": 120,
      "image": "https://...",
      "logo": "/admin/logos/pragmatic.png"
    }
  ]
}
FieldMeaning
codeFilter value for the game list provider query.
labelName to show.
enabledThis account can launch games from this provider.
owner_enabledThe provider is on for the whole desk.
gamesHow many games are stored for this provider.
imageOne game image, or null.
logoLocal logo path, or null when no file is stored.

A missing or inactive key returns HTTP 401 UNAUTHORIZED.

5. Game list

GET https://spxgame.games/api/casino/games

Same API key as the provider list. Use slug as game_id on launch. 5 Lions is vs243lions.

GET /api/casino/games?api_key=YOUR_API_KEY&provider=pragmatic&search=lion&page=1&per_page=50
QueryDefaultMeaning
provideremptyProvider code or label.
searchemptyMatches name, slug, or provider.
page1Page number.
per_page50Page size. Maximum 200.
{
  "ok": true,
  "page": 1,
  "per_page": 50,
  "total": 120,
  "flexrix_configured": true,
  "items": [
    {
      "slug": "vs243lions",
      "uuid": "...",
      "name": "5 Lions",
      "provider": "Pragmatic Play",
      "provider_code": "pragmatic",
      "enabled": true,
      "active": true,
      "provider_enabled": true,
      "image": "https://...",
      "image_portrait": "https://...",
      "image_landscape": "https://...",
      "type": "slots",
      "technology": "html5",
      "is_mobile": true,
      "rtp": "96.5",
      "has_freespins": false
    }
  ]
}

Launch only a row where enabled, active, and provider_enabled are true. A switched-off game returns HTTP 403 GAME_DISABLED.

6. Launch

POST https://spxgame.games/api/v2/launch

The same handler answers POST /api/launch. Send the game-list slug as game_id. Do not send a mode for casino. Do not send a balance. The player is created on the first launch.

Demo

{
  "mode": "fun",
  "game_id": "vs243lions",
  "currency": "TND",
  "language": "en",
  "home_url": "https://example.com/lobby"
}

Demo does not call your wallet.

Real money

{
  "api_key": "YOUR_API_KEY",
  "secret_key": "YOUR_SECRET_KEY",
  "username": "player_nick",
  "player_id": "12345",
  "game_id": "vs243lions",
  "currency": "TND",
  "language": "en"
}
FieldRequiredDescription
api_key / secret_keyYesAccount credentials
usernameYesDisplay name. Defaults to player_id
player_idYesYour player id. Created on first launch.
game_idYesCatalog slug. 5 Lions is vs243lions
currencyYesTND
languageYesen, fr, ar, tr
home_urlNohttp or https lobby return

Success:

{
  "status": "success",
  "data": {
    "launch_url": "https://...",
    "game_id": "vs243lions",
    "player_id": "12345",
    "username": "player_nick",
    "currency": "TND",
    "language": "en"
  }
}
<iframe src="LAUNCH_URL" style="width:100%;height:100vh;border:0" allow="fullscreen"></iframe>

Leave mode out. Leave balance out. The player wallet is used. A deposit on that player_id is the casino balance.

7. Sportsbook — Altenar

Same endpoint, same api_key, same secret_key, same player_id. Only mode and game_id change. The wallet stays the same. Do not send a balance.

Productmodegame_idOpen
Altenaraltenar or altaltenariframe
BetBybetby or betbeybetbyiframe
SportRadarsportradar, exa, or exasportsbookexaiframe
Digitaindijisport, dji, or sportdigidjiiframe
Betconbetconbetconiframe

Horse Racing, EveryMatrix, and classic sports are not on this server. Those modes return HTTP 404 PRODUCT_NOT_ON_THIS_SERVER.

{
  "api_key": "YOUR_API_KEY",
  "secret_key": "YOUR_SECRET_KEY",
  "username": "player_nick",
  "player_id": "12345",
  "currency": "TND",
  "language": "en",
  "mode": "altenar",
  "game_id": "altenar"
}

Success:

{
  "status": "success",
  "data": {
    "launch_url": "https://alteanr.spxgame.net/launch?token=...&lang=en",
    "game_id": "altenar",
    "player_id": "12345",
    "username": "player_nick",
    "currency": "TND",
    "language": "en"
  }
}

The launch token lasts 2 hours. Request a new launch when it expires. Open data.launch_url. The host is https://alteanr.spxgame.net. player_id in the answer is the id you sent. A deposit on that player is the sports balance.

403 SPORTS_DISABLED means Altenar is switched off for this account.

What happenedYour method
Balanceuser_balance
Coupon placedtransaction_bet
Win or cashouttransaction_win
Cancel or voidrefund

Altenar posts to https://spxgame.games/wallet/altenar. BetBy posts to https://spxgame.games/wallet/betbey. SportRadar posts to https://spxgame.games/wallet/bet. Digitain posts to https://spxgame.games/wallet/dji. Betcon posts to https://spxgame.games/wallet/betcon. Those addresses are already set. Do not point them at your site. Your site receives section 3 for these books.

Betcon uses the same player and the same keys. Set mode and game_id to betcon. The launch opens on https://betcon.spxgame.net. The token lasts 10 minutes. 403 SPORTS_DISABLED means Betcon is switched off for this account.

Digitain uses the same player and the same keys. Set mode to dijisport and game_id to dji, and set currency to the player wallet. The launch opens a real session on https://dji.spxgame.net. The home after sign-in is https://dji.spxgame.net/SportsBook/Home. The token lasts 10 minutes. 403 SPORTS_DISABLED means Digitain is switched off for this account.

SportRadar uses the same player and the same keys. Set mode to sportradar and game_id to exa. The launch opens on https://bet.spxgame.net. 403 SPORTS_DISABLED means SportRadar is switched off for this account.

BetBy uses the same player and the same keys. Set mode and game_id to betby, and set currency to the player wallet. The launch opens a real session in that currency. The token lasts 10 minutes, so request a new launch each time the player opens the book. 403 SPORTS_DISABLED means BetBy is switched off for this account.

The panel preview, without a player token, is https://alteanr.spxgame.net/#/overview. A player session must use data.launch_url.

8. Errors

Launch and panel errors:

{ "ok": false, "error_code": "PLAYER_NOT_FOUND", "error_description": "..." }
HTTPCodeMeaning
401UNAUTHORIZEDWrong or inactive api_key or secret_key
403SPORTS_DISABLEDAltenar is off for this account
403GAME_DISABLEDThat game is switched off
404PRODUCT_NOT_ON_THIS_SERVERThat sportsbook mode is not sold here
400validationgame_id, currency, language, or player_id
429RATE_LIMITEDMore than 300 calls from one address in 60 seconds
502UPSTREAM_REJECTEDThe game network rejected the launch
502DEVELOPER_WALLETYour callback did not return a balance
504DEVELOPER_TIMEOUTYour wallet did not answer in 5 seconds
Wallet fieldMeaning
status: 1Success
status: 0Reject, missing field, or insufficient funds

9. Go-live checklist

GET /health returns { "ok": true } with no key.