Betting API — REST API
Place Bet
| Property | Value |
|---|---|
| Endpoint | /api/v1/bets/place |
| Method | POST |
| Description | Allows the customer to place a new bet on an event. |
Request Headers
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
Request Body Example
{
"sportId": "2",
"marketId": "9.1223445",
"runnerId": 100123,
"priceIndex": 0,
"size": 50,
"memberSize": 50,
"odds": 100,
"line": 10,
"side": "BACK",
"memberCode": "member_code",
"currency": "HKD",
"ipAddress": "member_ip_address",
"requestId": "123456789" // optional
}
Response — Success (201 Created)
{
"id": 3,
"requestId": "123456789",
"memberCode": "member_code",
"status": "PENDING",
"side": "BACK",
"size": 5,
"memberSize": 5,
"odds": 100,
"line": 10,
"version": 1727702890748
}
Response — Error (4xx)
[
{
"error_code": "some_error_code",
"errorMessage": "Member code is missing",
"version": "2024-10-10T12:21:00.995612Z"
}
]
Note: All successful bet responses will be returned with
PENDINGstatus. After the provider processing, the bet placement results (placed or not) will be provided in the RabbitMQ queue.
PlaceBetRequest
| Field | Type | Description | Required |
|---|---|---|---|
| sportId | String | Sport identifier | Yes |
| providerId | String | Unique identifier for the betting provider. | Yes |
| marketId | String | Identifier for the specific market within an event. | Yes |
| runnerId | Long | Identifier for the specific runner within a market. | Yes |
| priceIndex | Integer | The index of the price level on the price ladder within the selection. For example, if a selection had prices 1.91 and 1.90 then a price_level_index of '0' would be 1.91 and '1' would be for 1.90. | No |
| size | BigDecimal | Bet size requested for placement | Yes |
| memberSize | BigDecimal | Bet size initially requested by the member (before PT) | Yes |
| odds | BigDecimal | Bet odds requested for placement | Yes |
| line | Integer | Bet line, for line fancy markets only | No |
| side | Side | Side enum. One of: BACK - selection occurrence side selection; LAY - selection non-occurrence side selection | Yes |
| memberCode | String | Code identifying the member placing the bet. | Yes |
| ipAddress | String | IP address of the client placing the bet. | Yes |
| currency | String | Currency code (e.g., "USD") | No |
| requestId | String | A unique identifier can be generated on the customer side for the request to ensure idempotency. | No |
PlaceBetResponse
| Field | Type | Description |
|---|---|---|
| betId | Long | Unique identifier for the placed bet |
| requestId | String | A request unique identifier |
| memberCode | String | Code identifying the member placing the bet |
| status | BetStatus | Bet status enum. One of: PENDING - the bet placement is pending; FAILED - the bet placement has failed; PLACED - the bet is successfully placed; VOIDED - the bet is voided |
| side | Side | Side enum. One of: BACK - selection occurrence side selection; LAY - selection non-occurrence side selection |
| size | BigDecimal | Bet size requested for placement |
| odds | BigDecimal | Bet odds requested for placement |
| line | Integer | Bet line requested for placement |
| version | long | Timestamp when the bet was placed (UTC) |
PlaceBetErrorResponse
| Field | Type | Description |
|---|---|---|
| errorCode | String | Code representing the type of error |
| errorMessage | String | Human-readable message describing the error |
| version | String | Timestamp when the bet was placed (UTC) |