Bet Placement Endpoint
Path: {operator-env-url}/bet
Bet placement involves the submission of a betslip that contains one or more single bets. As visible in the Request Parameters table below, an array of single bets exists for the 'bets' parameter. When bet placement calls are made to this endpoint, the operator needs to take the following steps:
validate the user session by looking up the user session based on userId and sessionToken and ensuring that session details are correct and not expired
confirm that the user has a sufficient balance to cover the sum total of all the individual bet stakes
confirm that the user is able to place each bet in light of any regulatory restrictions (could be cool down periods, max stakes, max liability per market type etc.)
upon successfully completing all relevant checks, store all bet information for each bet in the bets array against the userId with a status equivalent to 'pending' to indicate that the bet is awaiting result. A
potentialPayout
amount should be calculated by multiplying the decimalPrice field by the stake. This should be saved alongside the bet to facilitate bet resulting. Here is the formula for clarity:
potentialPayout = (stake * decimalPrice)
respond with a response matching the 'Response Parameters' schema as detailed below
or alternatively.. upon unsuccessfully completing all relevant check, store none of the bets in the bet placement call and respond with a relevant error response, as detailed below
Request Parameters
type: POST
content-type: application/json
Idempotency
Request will contain a header X-Idempotency-Key
in the form of a UUID string. See 'Idempotency' section for more information.
requestId
String/UUID
Yes
92e02ae9-a2a3-48e2-af0e-940aec4bbcfb
userId
String
Yes
user123
sessionToken
String
Yes
0bJV7oLNI0iMFl3rlomqQQ==
timestamp
String (epoch)
Yes
1640995200000
bets
Array <BetDetails>
Yes
Response Parameters
accepts: application/json
requestId
String/UUID
Yes
Matches request's requestId
userId
String
Yes
sessionToken
String
Yes
Original or refreshed
timestamp
String (epoch)
Yes
Response timestamp
status
String ("PLACED")
Yes
bets
Array <BetDetails>
Yes
Error Response
accepts: application/json
status
String ("FAILURE")
Yes
errorCode
String
Yes
errorMessage
String
No
failedBets
Array <FailedBet>
No (Except for INVALID_STAKE errors)
Errors
INVALID_USER
400
INVALID_BET_DETAILS
400
INVALID_STAKE
400
INSUFFICIENT_FUNDS
400
USER_BLOCKED
400
MISSING_PARAMETER
400
INVALID_SESSION
401
AUTHENTICATION_FAILED
403
GENERAL_EXCEPTION
500
REQUEST_TIMED_OUT
503
Model Definitions
BetDetails
betId
String/UUID
Yes
sportId
String
Yes
sportName
String
Yes
sportDisplayName
String
Yes
eventId
String
Yes
eventAltId
String
No
eventName
String
Yes
eventDisplayName
String
Yes
eventStage
String/Stage
Yes
competitionId
String
Yes
competitionName
String
Yes
competitionDisplayName
String
Yes
marketTypeId
String
Yes
marketId
String
Yes
marketName
String
Yes
marketDisplayName
String
Yes
marketStage
String/Stage
Yes
selectionId
String
Yes
selectionName
String
Yes
selectionDisplayName
String
Yes
decimalPrice
Decimal/Double
Yes
stake
Decimal/Double
Yes
eventAltId
is an optional field that may contain an alternate eventId (eg a DDE id for golf bets)
FailedBet
betId
String/UUID
Yes
sportId
String
Yes
eventId
String
Yes
marketId
String
Yes
selectionId
String
Yes
reason
BetFailureReason
Yes
BetFailureReason
maxStake
Decimal/Double
No
minStake
Decimal/Double
No
the stake value returned within BetFailureReason should be the value of the limit breached
Stage
IN_PLAY
PRE_PLAY
Last updated