Revision History
Version | Date | Changes |
---|---|---|
1.0.6 |
17 November 2022 |
Updated document. Add Outcome Statuses table. |
1.0.7 |
15 January 2024 |
Changed the maximum period you can specify for Search bets (accepted bets). |
Description
This is the document containing endpoints for bet operations.
Integration URL
Environment | Base URL | Description |
---|---|---|
Production |
Production environment |
Samples
Example python program to connect, authenticate, get odds and place bets.
Process Flow
Login
Firstly, the client needs to obtain a session token
before using the rest of the endpoints.
During the login
call, the client gets a bearer session token
which should be used in the Authorization header.
The TTL for the provided token is 30 minutes. After this time has elapsed, the session token can be obtained by a login call.
|
URL: sharpbet-url/client:login
Request headers
Name | Description |
---|---|
|
Device type |
|
Unique project id provided by Sharpbet - this must always be set to the value '14' |
Request fields
Path | Type | Description | Required |
---|---|---|---|
|
|
Client login or email |
|
|
|
Client password |
|
Example request
POST /platform-api/v1/client:login HTTP/1.1
Content-Type: application/json;charset=UTF-8
device: mobile
x-project-id: 14
{
"login" : "john@gmail.com",
"password" : "i5cgwLx2aV"
}
Response fields
Path | Type | Description |
---|---|---|
|
|
Session token |
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"sessionToken" : "v0EsPnSxXFjZDujgs9Ge40CbcQEOV6pv"
}
Client Logout
The endpoint is used to invalidate the token received by the login
request.
URL: sharpbet-url/client:logout
Request headers
Name | Description |
---|---|
|
Authorization bearer token to invalidate |
Example request
POST /platform-api/v1/client:logout HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer v0EsPnSxXFjZDujgs9Ge40CbcQEOV6pv
Response fields
Path | Type | Description |
---|---|---|
|
|
Response message |
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"message" : "ok"
}
Client details
The endpoint is used to get the client information, including details about the balance.
URL: sharpbet-url/client
Request headers
Name | Description |
---|---|
|
Authorization bearer token |
Example request
GET /platform-api/v1/client HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer v0EsPnSxXFjZDujgs9Ge40CbcQEOV6pv
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"id" : 17832,
"email" : "john@gmail.com",
"login" : "je8Xbsab",
"firstName" : "John",
"lastName" : "Doe",
"middleName" : "Michael",
"currency" : "EUR",
"balance" : 25000
}
Place bet
The endpoint is used to place a bet.
-
http
- make a place bet http request with immediate response containingplaceBetRequestId
-
websocket
- receive the result of the bet place request with the sameplaceBetRequestId
HTTP part
URL: sharpbet-url/bet:place
Request headers
Name | Description |
---|---|
|
Authorization bearer token |
Request fields
Path | Type | Description | Required |
---|---|---|---|
|
|
Bet request id, it is used by client to identify the response published to the web socket |
|
|
|
Currently only SINGLE betType is supported |
|
|
|
See Language codes. By default ENG |
|
|
|
See Currency codes. Bet currency should match client’s currency |
|
|
|
Amount in fractional monetary unit (e.g. cents for USD) |
|
|
|
The list of outcomes |
|
|
|
Outcome id |
|
|
|
Outcome odds which the bet is made for |
|
|
|
Specific partner details, such as endPunterId |
|
Example request
POST /platform-api/v1/bet:place HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer v0EsPnSxXFjZDujgs9Ge40CbcQEOV6pv
{
"placeBetRequestId" : "74bd3bb9-b7d6-47fd-99df-097588ec66ea",
"betType" : "SINGLE",
"locale" : "ENG",
"currency" : "EUR",
"betAmount" : 800,
"outcomes" : [ {
"outcomeId" : "453861511",
"odds" : 1.04
} ],
"partnerDetails" : {
"endPunterId" : "6bdd82xe3"
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
Place bet request id of the processing bet |
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"placeBetRequestId" : "74bd3bb997588ec66ea"
}
Web Socket part
-
Connect to web socket
wss://sharpbet-url/notifier?projectId={projectId}
-
Send subscribing message with
session token
to the web socket:
{
"messageType": "SUBSCRIBE",
"payload": {
"token": "Bearer Ard91MDqjHpiPxn2PTMgn7R9lls0PYP0",
"locale": "ENG",
"subscriptionKeys": [
{
"notificationTopic": "AUTHORIZED_CLIENT_UPDATES"
}
]
}
}
When bet is accepted/rejected/pending, the following message with bet details will be published to the web socket:
{
"notificationTopic": "PLACE_BET_ACCEPTED",
"payload": {
"id": "8203",
"data": {
"clientId": 8203,
"placeBetRequestId": "74bd3bb9-b7d6-47fd-99df-097588ec66ea",
"bets": [
{
"placeBetRequestId": "74bd3bb9-b7d6-47fd-99df-097588ec66ea",
"betId": 193772,
"clientId": 8203,
"locale": "ENG",
"betSportService": "LIVE",
"betType": "SINGLE",
"acceptOddsChanges": "NO",
"acceptParameterChanges": "NO",
"betOdds": 1.35,
"odds": 1.35,
"currency": "EUR",
"betAmount": 350,
"winAmount": 123,
"payout": 473,
"betStatus": "UNSETTLED",
"maxBetAmount": 10000,
"orderBetId": 103,
"createTime": 1642015800000,
"updateTime": 1642015800000,
"outcomes": [
{
"odds": 1.35,
"incomeOdds": 1.35,
"parameterized": true,
"parameterValue": "3.5",
"sportService": "LIVE",
"outcomeStatus": "WIN",
"eventStartTime": 1642015800000,
"homeScore": 1.0,
"awayScore": 0.0,
"finalHomeScore": 1.0,
"finalAwayScore": 0.0,
"outcomeId": "81992543",
"outcomeName": "Iberostar Tenerife",
"localizedOutcomeName": "Iberostar Tenerife",
"marketId": "189736649",
"marketName": "Winner (inc. overtime)",
"localizedMarketName": "Winner (inc. overtime)",
"eventId": "1908155",
"eventName": "Iberostar Tenerife vs Pinar Karsiyaka",
"localizedEventName": "Iberostar Tenerife vs Pinar Karsiyaka",
"tournamentId": "id",
"tournamentName": "FIBA Champions League",
"localizedTournamentName": "FIBA Champions League",
"categoryId": "129",
"categoryName": "International",
"localizedCategoryName": "International",
"sportId": "3",
"sportName": "Basketball",
"localizedSportName": "Basketball",
"participants": [
{
"id": 1009486,
"qualifier": "home",
"fullName": "Iberostar Tenerife",
"shortName": "Iberostar Tenerife"
},
{
"id": 1012129,
"qualifier": "away",
"fullName": "Pinar Karsiyaka",
"shortName": "Pinar Karsiyaka"
}
]
}
]
}
]
}
}
}
Other available topics: PLACE_BET_PENDING , BET_SETTLED have the same structure.
|
In case of bet place failed, the following message will be published to the websocket:
{
"notificationTopic": "PLACE_BET_FAILED",
"payload": {
"id": "8203",
"data": {
"clientId": 8203,
"placeBetRequestId": "74bd3bb9-b7d6-47fd-99df-097588ec66ea",
"code": "BET_VALIDATION_FAILED",
"message": "Bet validation failed",
"violations": [
{
"code": "OUTCOME_ODDS_CHANGED",
"message": "Odds changed",
"violationInfo": {
"outcomeId": "81992543",
"newOdds": 1.42
}
}
]
}
}
}
Search bets (accepted bets)
The endpoint is used to get the client’s bets.
Without using filter.createDate or filter.settleDate, the response will contain bets by creation date for the last 7 days. If you use one of these filters, the maximum period you can specify is 8 days. |
Base URL: sharpbet-url/bet:search
Request headers
Name | Description |
---|---|
|
Authorization bearer token |
Request fields
Path | Type | Description | Required |
---|---|---|---|
|
|
Bet client filter |
|
|
|
Array of bet id |
|
|
|
Array of bet request id |
|
|
|
Bet statuses: UNSETTLED, WIN, LOSE, CANCELLED, VOID, CASH_OUT |
|
|
|
Create date range |
|
|
|
Lower bound for the bet’s create time (inclusive) |
|
|
|
Upper bound for the bet’s create time (inclusive) |
|
|
|
Settle date range |
|
|
|
Lower bound for the bet’s settle time (inclusive) |
|
|
|
Upper bound for the bet’s settle time (inclusive) |
|
|
|
Object for pagination |
|
|
|
Items per page |
|
|
|
Current page |
|
|
|
Total items |
|
|
|
Total pages |
|
|
|
Array of Sorting information |
|
|
|
Order |
|
|
|
Field name |
|
|
|
Direction: ASC, DESC |
|
Example request
POST /platform-api/v1/bet:search HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer v0EsPnSxXFjZDujgs9Ge40CbcQEOV6pv
{
"filter" : {
"betIds" : [ 193772 ],
"placeBetRequestIds" : [ "74bd3bb997588ec66ea" ],
"betStatuses" : [ "UNSETTLED", "VOID", "LOSE", "WIN" ],
"createDate" : {
"from" : 1642015800000,
"to" : 1642025800000
},
"settleDate" : {
"from" : 1642015800000,
"to" : 1642025800000
}
},
"paging" : {
"itemsPerPage" : 10,
"currentPage" : 0,
"totalItems" : 0,
"totalPages" : 0
},
"sorting" : [ {
"order" : 0,
"fieldName" : "createTime",
"direction" : "DESC"
} ]
}
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"bets" : [ {
"betId" : 193772,
"clientId" : 8203,
"placeBetRequestId" : null,
"locale" : "ENG",
"betSportService" : "PREMATCH",
"betType" : "SINGLE",
"acceptOddsChanges" : "NO",
"acceptParameterChanges" : "NO",
"betOdds" : 1.35,
"odds" : 1.35,
"currency" : "EUR",
"betAmount" : 350,
"winAmount" : 123,
"payout" : 473,
"betStatus" : "UNSETTLED",
"maxBetAmount" : 10000,
"orderBetId" : 103,
"createTime" : 1642015800000,
"updateTime" : 1642025800000,
"settleTime" : 1642016000000,
"resettleTime" : 1642018000000,
"outcomes" : [ {
"odds" : 1.35,
"incomeOdds" : 1.35,
"parameterized" : true,
"parameterValue" : "3.5",
"sportService" : "PREMATCH",
"outcomeStatus" : "WIN",
"eventStartTime" : 1642015800000,
"homeScore" : 1.0,
"awayScore" : 0.0,
"finalHomeScore" : 1.0,
"finalAwayScore" : 0.0,
"outcomeId" : "81992543",
"outcomeName" : "Iberostar Tenerife",
"localizedOutcomeName" : "Iberostar Tenerife",
"marketId" : "189736649",
"marketName" : "Winner (inc. overtime)",
"localizedMarketName" : "Winner (inc. overtime)",
"eventId" : "1908155",
"eventName" : "Iberostar Tenerife vs Pinar Karsiyaka",
"localizedEventName" : "Iberostar Tenerife vs Pinar Karsiyaka",
"tournamentId" : "id",
"tournamentName" : "FIBA Champions League",
"localizedTournamentName" : "FIBA Champions League",
"categoryId" : "129",
"categoryName" : "International",
"localizedCategoryName" : "International",
"sportId" : "3",
"sportName" : "Basketball",
"localizedSportName" : "Basketball",
"participants" : [ {
"id" : 1009486,
"qualifier" : "home",
"fullName" : "Iberostar Tenerife",
"shortName" : "Iberostar Tenerife"
}, {
"id" : 1012129,
"qualifier" : "away",
"fullName" : "Pinar Karsiyaka",
"shortName" : "Pinar Karsiyaka"
} ]
} ]
} ],
"paging" : {
"itemsPerPage" : 10,
"currentPage" : 0,
"totalItems" : 59,
"totalPages" : 6
},
"sorting" : [ {
"order" : 0,
"fieldName" : "createTime",
"direction" : "DESC"
} ]
}
Search bet requests
The endpoint is used to get the client’s bets.
Base URL: sharpbet-url/bet/request:search
Request headers
Name | Description |
---|---|
|
Authorization bearer token |
Request fields
Path | Type | Description | Required |
---|---|---|---|
|
|
Array of bet request id |
|
|
|
Acceptance statuses: ACCEPTED, REJECTED, PENDING |
|
|
|
Object for pagination |
|
|
|
Items per page |
|
|
|
Current page |
|
|
|
Total items |
|
|
|
Total pages |
|
|
|
Array of Sorting information |
|
|
|
Order |
|
|
|
Field name |
|
|
|
Direction: ASC, DESC |
|
Example request
POST /platform-api/v1/bet/request:search HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer v0EsPnSxXFjZDujgs9Ge40CbcQEOV6pv
{
"filter" : {
"placeBetRequestIds" : [ "74bd3bb997588ec66ea" ],
"acceptanceStatuses" : [ "REJECTED" ]
},
"paging" : {
"itemsPerPage" : 10,
"currentPage" : 0,
"totalItems" : 0,
"totalPages" : 0
},
"sorting" : [ {
"order" : 0,
"fieldName" : "createTime",
"direction" : "DESC"
} ]
}
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
"bets" : [ {
"placeBetRequestId" : "74bd3bb997588ec66ea",
"clientId" : 8203,
"locale" : "ENG",
"betSportService" : "PREMATCH",
"betType" : "SINGLE",
"acceptOddsChanges" : "NO",
"acceptParameterChanges" : "NO",
"betOdds" : 1.35,
"odds" : 1.35,
"currency" : "EUR",
"betAmount" : 350,
"betStatus" : "PENDING",
"maxBetAmount" : 10000,
"orderBetId" : 103,
"createTime" : 1642015800000,
"updateTime" : 1642015800000,
"acceptanceStatus" : "REJECTED",
"acceptanceFailReason" : "Not enough funds",
"outcomes" : [ {
"odds" : 1.35,
"incomeOdds" : 1.35,
"parameterized" : true,
"parameterValue" : "3.5",
"sportService" : "PREMATCH",
"outcomeStatus" : "WIN",
"eventStartTime" : 1642015800000,
"homeScore" : 1.0,
"awayScore" : 0.0,
"finalHomeScore" : null,
"finalAwayScore" : null,
"outcomeId" : "81992543",
"outcomeName" : "Iberostar Tenerife",
"localizedOutcomeName" : "Iberostar Tenerife",
"marketId" : "189736649",
"marketName" : "Winner (inc. overtime)",
"localizedMarketName" : "Winner (inc. overtime)",
"eventId" : "1908155",
"eventName" : "Iberostar Tenerife vs Pinar Karsiyaka",
"localizedEventName" : "Iberostar Tenerife vs Pinar Karsiyaka",
"tournamentId" : "id",
"tournamentName" : "FIBA Champions League",
"localizedTournamentName" : "FIBA Champions League",
"categoryId" : "129",
"categoryName" : "International",
"localizedCategoryName" : "International",
"sportId" : "3",
"sportName" : "Basketball",
"localizedSportName" : "Basketball",
"participants" : [ {
"id" : 1009486,
"qualifier" : "home",
"fullName" : "Iberostar Tenerife",
"shortName" : "Iberostar Tenerife"
}, {
"id" : 1012129,
"qualifier" : "away",
"fullName" : "Pinar Karsiyaka",
"shortName" : "Pinar Karsiyaka"
} ]
} ]
} ],
"paging" : {
"itemsPerPage" : 10,
"currentPage" : 0,
"totalItems" : 59,
"totalPages" : 6
},
"sorting" : [ {
"order" : 0,
"fieldName" : "createTime",
"direction" : "DESC"
} ]
}
Outcomes statuses
Outcome Status | Description |
---|---|
NOT_DEFINED |
|
WIN |
outcome won |
LOSE |
outcome lost |
VOID |
return on the outcome, settlement with Odds=1 |
HALF_WIN |
for Asian markets, settlement with odds=odds/2+1/2 |
HALF_LOSE |
for Asian markets, settlement with odds=1/2 |
Language codes
Code | Language |
---|---|
ENG |
English |
HIN |
Hindi |
RUS |
Russian |
ARA |
Arabic |
For more codes see ISO 639-2 language codes
Currency codes
Code | Language |
---|---|
EUR |
Euro |
GBP |
Pound Sterling |
USD |
US Dollar |
KZT |
Tenge |
For more codes see ISO 4217 currency codes
Country codes
Code | Language |
---|---|
IN |
India |
CN |
China |
KZ |
Kazakhstan |
GE |
Georgia |
For more codes see ISO 3166-1 country codes