Seamless Wallet API
Calls bhub makes to the operator's wallet. The operator implements these endpoints.
Servers
| URL | Use |
|---|---|
https://{operator-wallet-host}/bhub |
Conventions
- Transport: HTTPS POST,
Content-Type: application/json; charset=utf-8, UTF-8 strings. - Every business outcome returns HTTP 200 with a
status. Non-200 means infrastructure failure and is treated as a timeout (unknown outcome). One exception: a request whose signature, key id or timestamp fails verification is answered HTTP 401 with{"status":"INVALID_SIGNATURE"}(unsigned); bhub treats it as a definite refusal. - Guides and the conformance kit: https://bhubsystems.com/docs
- Amounts: decimal strings in the currency's minor-unit precision (
"12.50"ZAR,"1500"UGX), never floats. More decimals than the currency allows is a bad request. The precision table is published atGET /v1/currencieson the operator API. - Identifiers: strings of at most 64 characters,
[A-Za-z0-9._:-]. - Times: RFC 3339 with
Z(UTC). Reports render SAST for ZA.
Signing (HMAC-SHA256)
Headers on every request and every response:
X-Bhub-Key-Id: which key signed (two keys may be live during rotation).X-Bhub-Timestamp: Unix seconds. Requests outside +/-300 s are rejected.X-Bhub-Signature: hex HMAC-SHA256 oftimestamp + "\n" + raw_bodywith the shared key. The operator signs its response body the same way, so bhub verifies answers too. HMAC-SHA256 doubles as the message error-detection code (SANS 1718-3 10.4, 10.11).
Test and live (X-Bhub-Environment)
Every request carries X-Bhub-Environment: live or X-Bhub-Environment: test.
testmarks every call of the test studio (simulator) and of "Test connection" in the portal: synthetic players, sandbox rounds, trouble caused on purpose. It is sent only to the operator's registered test wallets, signed with the test wallet's own keys, which are never the live keys.livemarks real play, and bhub's reconciliation pulls ofGET /v1/transactions.- A live wallet MUST refuse a request marked
test(HTTP 200 withstatus: BAD_REQUEST, or HTTP 401INVALID_SIGNATUREwhen the test key is unknown to it). A test wallet SHOULD refuse a request markedlive. A missing header is treated asliveby older wallets; bhub always sends it. The header is not part of the signed bytes; the separate test keys are what keep test calls out of a live wallet. See docs/operator-api.md, "Prepare a test wallet".
Idempotency contract
tx_idis the idempotency key, globally unique, kept by the operator for at least 180 days.- A repeat with the same
tx_idand identical body MUST return the original outcome with the CURRENT balance andstatus: OK(or the original rejection). - The same
tx_idwith a different body MUST returnDUPLICATE_CONFLICT. "Body" means the business fields:request_id(new on every attempt) andsession_token(may be refreshed) are excluded from the comparison. rollbackof a transaction the operator never saw MUST returnOKand remember the targetref_tx_id(tombstone), so a late-arriving original is refused withTRANSACTION_ROLLED_BACK.
Retries (published policy)
bet/bet_windebit: timeout ~3 s, NOT retried; bhub sendsrollbackinstead, delivered with 2 immediate retries, then the async schedule below.win,rollback,end_round,promo_credit: 2 immediate retries, then the same async schedule (1 min, 10 min, then hourly) up to 72 h, then manual reconciliation (visible in the failed-transaction feed and webhook).
Transactions endpoint (optional, for daily reconciliation)
GET /v1/transactions lets bhub read the operator's own records of every bhub money call, one
business day at a time, instead of the operator uploading a file. It is signed like every
call, except that a GET has no body: the signed bytes are the request target (path and query
exactly as sent, e.g. /bhub/v1/transactions?from=...&limit=5000&to=...). The answer is signed
over its body as usual. bhub asks for the business day plus 10 minutes either side and follows
next_cursor until it is null. Lines are in the published layout (the same fields as the file
upload). A line counts once; a stake the wallet gave back is status: rolled_back.
Session
Exchange a launch token for the player's identity and balance.
POST/v1/authenticate
Signed (HMAC-SHA256). See Request signing. · operationId authenticate
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
Request body application/json, required
Schema AuthenticateRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
launch_tokenrequired | string | at most 256 characters |
game_idrequired | Id | |
providerrequired | Id | |
ip_address | string |
Responses
| Status | Meaning |
|---|---|
| 200 | Outcome application/json: AuthenticateResponse |
balance
POST/v1/balance
Signed (HMAC-SHA256). See Request signing. · operationId balance
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
Request body application/json, required
Schema BalanceRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | |
player_idrequired | Id | |
currencyrequired | Currency |
Responses
| Status | Meaning |
|---|---|
| 200 | Outcome application/json: WalletResponse |
Money
Debit a stake.
POST/v1/bet
Signed (HMAC-SHA256). See Request signing. · operationId bet
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
Request body application/json, required
Schema BetRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | at most 256 characters |
player_idrequired | Id | |
currencyrequired | Currency | |
game_idrequired | Id | |
providerrequired | Id | |
round_idrequired | Id | |
round_closed | boolean or null | true when this call closes the round, false when more calls follow; absent or null when the studio did not say. |
is_free | boolean | Free spins round (granted by the studio, or an in-game feature). The stake is passed as the studio sent it, normally 0. default |
bonus_ref | Id | The studio's own free spins / bonus reference, opaque to bhub. bhub creates and manages no free spins campaigns; it only passes free spins rounds through. A free spins round without a reference is still processed and is flagged for review. |
round_details | object | The studio's raw round and bonus fields, passed through unchanged (no fixed schema). |
jurisdiction | object | ZA WRS ticket fields (ticket number arrives later via the round feed). |
jurisdiction.code | string | e.g. |
jurisdiction.province | string | |
jurisdiction.venue | string | |
tx_idrequired | Id | |
amountrequired | Amount | |
jackpot_contribution_micro | string | pattern |
Responses
| Status | Meaning |
|---|---|
| 200 | Outcome application/json: WalletResponse |
Credit a win. A round may have several wins. Zero-amount wins are sent when they close a round.
POST/v1/win
Signed (HMAC-SHA256). See Request signing. · operationId win
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
Request body application/json, required
Schema WinRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | at most 256 characters |
player_idrequired | Id | |
currencyrequired | Currency | |
game_idrequired | Id | |
providerrequired | Id | |
round_idrequired | Id | |
round_closed | boolean or null | true when this call closes the round, false when more calls follow; absent or null when the studio did not say. |
is_free | boolean | Free spins round (granted by the studio, or an in-game feature). The stake is passed as the studio sent it, normally 0. default |
bonus_ref | Id | The studio's own free spins / bonus reference, opaque to bhub. bhub creates and manages no free spins campaigns; it only passes free spins rounds through. A free spins round without a reference is still processed and is flagged for review. |
round_details | object | The studio's raw round and bonus fields, passed through unchanged (no fixed schema). |
jurisdiction | object | ZA WRS ticket fields (ticket number arrives later via the round feed). |
jurisdiction.code | string | e.g. |
jurisdiction.province | string | |
jurisdiction.venue | string | |
tx_idrequired | Id | |
ref_tx_id | Id | The bet this win settles |
amountrequired | Amount |
Responses
| Status | Meaning |
|---|---|
| 200 | Outcome application/json: WalletResponse |
Debit and credit in one call (instant and crash games). Atomic on the operator side.
POST/v1/bet_win
Signed (HMAC-SHA256). See Request signing. · operationId betWin
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
Request body application/json, required
Schema BetWinRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | at most 256 characters |
player_idrequired | Id | |
currencyrequired | Currency | |
game_idrequired | Id | |
providerrequired | Id | |
round_idrequired | Id | |
round_closed | boolean or null | true when this call closes the round, false when more calls follow; absent or null when the studio did not say. |
is_free | boolean | Free spins round (granted by the studio, or an in-game feature). The stake is passed as the studio sent it, normally 0. default |
bonus_ref | Id | The studio's own free spins / bonus reference, opaque to bhub. bhub creates and manages no free spins campaigns; it only passes free spins rounds through. A free spins round without a reference is still processed and is flagged for review. |
round_details | object | The studio's raw round and bonus fields, passed through unchanged (no fixed schema). |
jurisdiction | object | ZA WRS ticket fields (ticket number arrives later via the round feed). |
jurisdiction.code | string | e.g. |
jurisdiction.province | string | |
jurisdiction.venue | string | |
tx_idrequired | Id | |
bet_amountrequired | Amount | |
win_amountrequired | Amount |
Responses
| Status | Meaning |
|---|---|
| 200 | Outcome application/json: WalletResponse |
Reverse a bet or a win identified by ref_tx_id.
POST/v1/rollback
Signed (HMAC-SHA256). See Request signing. · operationId rollback
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
Request body application/json, required
Schema RollbackRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | at most 256 characters |
player_idrequired | Id | |
currencyrequired | Currency | |
game_idrequired | Id | |
providerrequired | Id | |
tx_idrequired | Id | |
ref_tx_idrequired | Id | |
round_idrequired | Id | |
round_closed | boolean or null |
Responses
| Status | Meaning |
|---|---|
| 200 | Outcome application/json: WalletResponse |
Close a round. Idempotent per round_id; may repeat.
POST/v1/end_round
Signed (HMAC-SHA256). See Request signing. · operationId endRound
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
Request body application/json, required
Schema EndRoundRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | at most 256 characters |
player_idrequired | Id | |
currencyrequired | Currency | |
game_idrequired | Id | |
providerrequired | Id | |
tx_idrequired | Id | |
round_idrequired | Id | |
total_betrequired | Amount | |
total_winrequired | Amount |
Responses
| Status | Meaning |
|---|---|
| 200 | Outcome application/json: WalletResponse |
Promotions
Offline-safe credit outside normal play (free-spins total, jackpot, tournament, prize drop, cashback). No session needed.
POST/v1/promo_credit
Signed (HMAC-SHA256). See Request signing. · operationId promoCredit
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
Request body application/json, required
Schema PromoCreditRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
tx_idrequired | Id | |
player_idrequired | Id | |
currencyrequired | Currency | |
amountrequired | Amount | |
kindrequired | string | free_spins_win is a studio's aggregated free spins total paid at the end of the free spins; report it as a promotional payout. free_spins_winjackpottournamentprize_dropmissioncashbackadjustment |
bonus_ref | Id | The studio's opaque bonus reference, when it sent one. |
round_id | Id | |
game_id | Id | |
provider | Id |
Responses
| Status | Meaning |
|---|---|
| 200 | Outcome application/json: WalletResponse |
Reconciliation
The operator's records of bhub money calls in a time window (optional; for reconciliation).
GET/v1/transactions
Signed (HMAC-SHA256). See Request signing. · operationId listTransactions
Signed over the request target (path and query) instead of a body. Pages are in the
operator's order; cursor is opaque to bhub. Amounts are integers in minor units here
(this is a records export, not a money call).
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Bhub-Environmentrequired | header | string | live for real play, test for the test studio and Test connection. See "Test and live". livetest |
fromrequired | query | string (date-time) | Inclusive. |
torequired | query | string (date-time) | Exclusive. |
cursor | query | string | at most 200 characters |
limit | query | integer | default |
Responses
| Status | Meaning |
|---|---|
| 200 | One page application/json: TransactionsPage |
| 400 | Bad window |
| 401 | Signature failed: {"status":"INVALID_SIGNATURE"} |
Schemas
Id
string
at most 64 characters · pattern ^[A-Za-z0-9._:-]+$
Amount
Non-negative decimal string in the currency's precision.
string
pattern ^(0|[1-9][0-9]{0,17})(\.[0-9]{1,4})?$
Currency
ISO 4217
string
pattern ^[A-Z]{3}$
Status
string
OKINSUFFICIENT_FUNDSPLAYER_NOT_FOUNDPLAYER_BLOCKEDTOKEN_INVALIDTOKEN_EXPIREDINVALID_SIGNATUREBAD_REQUESTGAME_DISABLEDLIMIT_REACHEDBET_OUT_OF_LIMITSCURRENCY_MISMATCHDUPLICATE_CONFLICTTRANSACTION_NOT_FOUNDTRANSACTION_ROLLED_BACKREALITY_CHECKINTERNAL_RETRYINTERNAL_NO_RETRY Common
RoundRef
| Field | Type | Description |
|---|---|---|
round_idrequired | Id | |
round_closed | boolean or null | true when this call closes the round, false when more calls follow; absent or null when the studio did not say. |
is_free | boolean | Free spins round (granted by the studio, or an in-game feature). The stake is passed as the studio sent it, normally 0. default |
bonus_ref | Id | The studio's own free spins / bonus reference, opaque to bhub. bhub creates and manages no free spins campaigns; it only passes free spins rounds through. A free spins round without a reference is still processed and is flagged for review. |
round_details | object | The studio's raw round and bonus fields, passed through unchanged (no fixed schema). |
jurisdiction | object | ZA WRS ticket fields (ticket number arrives later via the round feed). |
jurisdiction.code | string | e.g. |
jurisdiction.province | string | |
jurisdiction.venue | string |
AuthenticateRequest
AuthenticateResponse
BalanceRequest
BetRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | at most 256 characters |
player_idrequired | Id | |
currencyrequired | Currency | |
game_idrequired | Id | |
providerrequired | Id | |
round_idrequired | Id | |
round_closed | boolean or null | true when this call closes the round, false when more calls follow; absent or null when the studio did not say. |
is_free | boolean | Free spins round (granted by the studio, or an in-game feature). The stake is passed as the studio sent it, normally 0. default |
bonus_ref | Id | The studio's own free spins / bonus reference, opaque to bhub. bhub creates and manages no free spins campaigns; it only passes free spins rounds through. A free spins round without a reference is still processed and is flagged for review. |
round_details | object | The studio's raw round and bonus fields, passed through unchanged (no fixed schema). |
jurisdiction | object | ZA WRS ticket fields (ticket number arrives later via the round feed). |
jurisdiction.code | string | e.g. |
jurisdiction.province | string | |
jurisdiction.venue | string | |
tx_idrequired | Id | |
amountrequired | Amount | |
jackpot_contribution_micro | string | pattern |
WinRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | at most 256 characters |
player_idrequired | Id | |
currencyrequired | Currency | |
game_idrequired | Id | |
providerrequired | Id | |
round_idrequired | Id | |
round_closed | boolean or null | true when this call closes the round, false when more calls follow; absent or null when the studio did not say. |
is_free | boolean | Free spins round (granted by the studio, or an in-game feature). The stake is passed as the studio sent it, normally 0. default |
bonus_ref | Id | The studio's own free spins / bonus reference, opaque to bhub. bhub creates and manages no free spins campaigns; it only passes free spins rounds through. A free spins round without a reference is still processed and is flagged for review. |
round_details | object | The studio's raw round and bonus fields, passed through unchanged (no fixed schema). |
jurisdiction | object | ZA WRS ticket fields (ticket number arrives later via the round feed). |
jurisdiction.code | string | e.g. |
jurisdiction.province | string | |
jurisdiction.venue | string | |
tx_idrequired | Id | |
ref_tx_id | Id | The bet this win settles |
amountrequired | Amount |
BetWinRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
session_token | string | at most 256 characters |
player_idrequired | Id | |
currencyrequired | Currency | |
game_idrequired | Id | |
providerrequired | Id | |
round_idrequired | Id | |
round_closed | boolean or null | true when this call closes the round, false when more calls follow; absent or null when the studio did not say. |
is_free | boolean | Free spins round (granted by the studio, or an in-game feature). The stake is passed as the studio sent it, normally 0. default |
bonus_ref | Id | The studio's own free spins / bonus reference, opaque to bhub. bhub creates and manages no free spins campaigns; it only passes free spins rounds through. A free spins round without a reference is still processed and is flagged for review. |
round_details | object | The studio's raw round and bonus fields, passed through unchanged (no fixed schema). |
jurisdiction | object | ZA WRS ticket fields (ticket number arrives later via the round feed). |
jurisdiction.code | string | e.g. |
jurisdiction.province | string | |
jurisdiction.venue | string | |
tx_idrequired | Id | |
bet_amountrequired | Amount | |
win_amountrequired | Amount |
RollbackRequest
EndRoundRequest
PromoCreditRequest
| Field | Type | Description |
|---|---|---|
request_idrequired | Id | |
tx_idrequired | Id | |
player_idrequired | Id | |
currencyrequired | Currency | |
amountrequired | Amount | |
kindrequired | string | free_spins_win is a studio's aggregated free spins total paid at the end of the free spins; report it as a promotional payout. free_spins_winjackpottournamentprize_dropmissioncashbackadjustment |
bonus_ref | Id | The studio's opaque bonus reference, when it sent one. |
round_id | Id | |
game_id | Id | |
provider | Id |
WalletResponse
| Field | Type | Description |
|---|---|---|
statusrequired | Status | |
request_id | Id | |
operator_tx_id | string | at most 64 characters |
currency | Currency | |
balance | Balance | |
used_bonus | Amount | |
messages | array of object | Player messages the game client renders (responsible gambling, notices). at most 3 items |
messages[].titlerequired | string | at most 60 characters |
messages[].textrequired | string | at most 300 characters |
RecordLine
One line of the operator's records (the published reconciliation layout).
| Field | Type | Description |
|---|---|---|
operator_tx_id | string | The operator's own id for the line. at most 64 characters |
bhub_tx_id | string | The tx_id bhub sent. The matching key. at most 64 characters |
round_id | string | Fallback key with kind and amount when bhub_tx_id is missing. at most 64 characters |
player_ref | string | at most 64 characters |
kindrequired | string | bet_win is two lines: a stake and a payout. stakepayoutrefund |
amount_minorrequired | integer (int64) | min 0 |
currencyrequired | Currency | |
occurred_atrequired | string (date-time) | |
balance_after | integer (int64) | Cash balance after the line |
status | string | okrolled_backfaileddefault |
TransactionsPage
| Field | Type | Description |
|---|---|---|
transactionsrequired | array of RecordLine | |
next_cursorrequired | string or null | Null on the last page. |