Bracket Game operations
Get the configuration for all platform interactions
Bracket Game operations are responsible for communicating with Prediction API and specially with custom bracket game functionalities.
The namespace is of course called bracketGame. All methods return promises. The general design of the namespace follows this pattern unless stated otherwise:
General call:
sdk.bracketGame .someMethod() .then((response) => { // Handle response }) .catch((error) => { // Handle error });
The responses are comprised of different objects you can find here.
Game related operations
Get bracket game by ID
Method: getGameById(gameId, disableCache?)
Model:
The method returns the Bracket Game information.
No authentication required.
The response from API is cached for 10 minutes. With disableCache
argument you can avoid cached response.
Example call:
sdk.bracketGame .getGameById("gameId") .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
id: "iccchampionstrophy",
title: "ICC Champions Trophy",
description:
"Welcome to the ICC Champions Trophy Bracket game. Predict the outcome of each match and win great prizes.",
rules: "<h2>Rules of the game</h2><p>The rules of the game are...</p>",
customFields: {
field_1: "value_1",
field_2: "value_2",
},
images: {
main: null,
cover: null,
mobile: null,
},
type: "BRACKET",
status: "OPEN",
points: 20,
related: [
{
entityId: "1",
entityType: "classic_quiz",
entityRelationship: "bonusPointsGame",
}
],
predictionsCutoff: "2025-02-19T00:00:00+00:00",
meta: {
participants: [
{
id: "1",
name: "Bangladesh",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Flag_of_Bangladesh.svg/23px-Flag_of_Bangladesh.svg.png",
undecided: false,
},
{
id: "2",
name: "India",
image:
"https://upload.wikimedia.org/wikipedia/en/thumb/4/41/Flag_of_India.svg/23px-Flag_of_India.svg.png",
undecided: false,
},
{
id: "3",
name: "New Zealand",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Flag_of_New_Zealand.svg/23px-Flag_of_New_Zealand.svg.png",
undecided: false,
},
{
id: "4",
name: "Pakistan",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/32/Flag_of_Pakistan.svg/23px-Flag_of_Pakistan.svg.png",
undecided: false,
},
{
id: "5",
name: "Afghanistan",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Flag_of_Afghanistan_%282013%E2%80%932021%29.svg/23px-Flag_of_Afghanistan_%282013%E2%80%932021%29.svg.png",
undecided: false,
},
{
id: "6",
name: "Australia",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Flag_of_Australia_%28converted%29.svg/23px-Flag_of_Australia_%28converted%29.svg.png",
undecided: false,
},
{
id: "7",
name: "England",
image:
"https://upload.wikimedia.org/wikipedia/en/thumb/b/be/Flag_of_England.svg/23px-Flag_of_England.svg.png",
undecided: false,
},
{
id: "8",
name: "South Africa",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Flag_of_South_Africa.svg/23px-Flag_of_South_Africa.svg.png",
undecided: false,
},
{
id: "9",
name: "A1",
image: null,
undecided: true,
},
{
id: "10",
name: "A2",
image: null,
undecided: true,
},
{
id: "11",
name: "B1",
image: null,
undecided: true,
},
{
id: "12",
name: "B2",
image: null,
undecided: true,
},
{
id: "13",
name: "SF1W",
image: null,
undecided: true,
},
{
id: "14",
name: "SF2W",
image: null,
undecided: true,
},
],
},
fixtures: [
{
matchId: "1",
participantOne: "4",
participantTwo: "3",
winner: null,
homeParticipant: null,
startDate: "2025-02-19T06:00:00+00:00",
score: {
participantOne: null,
participantTwo: null,
},
}
]
}
Get prediction for a bracket game
Method: getGamePredictionById(gameId, predictionId, disableCache?)
Models:
The method returns specific prediction for specific game.
No authentication required.
The response from API is cached for 10 minutes. With disableCache
argument you can avoid cached response.
Example call:
sdk.bracketGame .getGamePredictionById("gameId", "predictionId") .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
id: "profileId_g_gameId",
profileId: "profileId",
totalPoints: 100,
gamePoints: 80,
bonusPoints: 20,
position: 1,
status: "SETTLED",
gameId: "gameId",
fixtures: [
{
matchId: "11",
participantOne: "4",
participantTwo: "3",
winner: "participant_one",
correct: true
}
],
tiebreaker: {
statTotal: 1000
},
createdAt: "2025-01-08T15:02:15Z",
updatedAt: "2025-01-08T15:02:15Z"
}
User related operations
Make prediction for a Bracket Game
Method: makePrediction(gameId, prediction)
Models:
The method creates user prediction for the game.
Authentication required.
The prediction body should contain:
- predictions:
BracketGamePredictions[]
. A list of predictions for all fixtures of the game. Contain the following properties:- matchId:
string
. The ID of the match the user makes prediction for. - participantOne:
string
. The ID of the first participant in the match. - participantTwo:
string
. The ID of the second participant in the match. - winner:
BracketWinnerEnum
. The winner which the user has predicted. Available values are:BracketWinnerEnum.PARTICIPANT_ONE
andBracketWinnerEnum.PARTICIPANT_TWO
.
- matchId:
- tiebreaker:
BracketGameTiebreaker
. An object that contain the following properties:- statTotal:
number
.
- statTotal:
Example call:
const prediction = { predictions: [ { matchId: "11", participantOne: "4", participantTwo: "3", winner: BracketWinnerEnum.PARTICIPANT_ONE, }, ], tiebreaker: { statTotal: 1000, } }; sdk.bracketGame .makePrediction("gameId", prediction) .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
id: "profileId_g_gameId",
profileId: "profileId",
totalPoints: null,
gamePoints: null,
bonusPoints: null,
position: null,
status: "ACTIVE",
gameId: "gameId",
fixtures: [
{
matchId: "11",
participantOne: "4",
participantTwo: "3",
winner: BracketWinnerEnum.PARTICIPANT_ONE,
correct: null
}
],
tiebreaker: {
statTotal: 1000
},
createdAt: "2025-01-08T15:02:15Z",
updatedAt: "2025-01-08T15:02:15Z"
}
Update prediction for a Bracket Game
Method: updatePrediction(gameId, predictionId, prediction)
Models:
The method updates user prediction for the game.
Authentication required.
The prediction body should contain:
- predictions:
BracketGamePredictions[]
. A list of predictions for all fixtures of the game. Contain the following properties:- matchId:
string
. The ID of the match the user makes prediction for. - participantOne:
string
. The ID of the first participant in the match. - participantTwo:
string
. The ID of the second participant in the match. - winner:
BracketWinnerEnum
. The winner which the user has predicted. Available values are:BracketWinnerEnum.PARTICIPANT_ONE
andBracketWinnerEnum.PARTICIPANT_TWO
.
- matchId:
- tiebreaker:
BracketGameTiebreaker
. An object that contain the following properties:- statTotal:
number
.
- statTotal:
Example call:
const prediction = { predictions: [ { matchId: "11", participantOne: "4", participantTwo: "3", winner: BracketWinnerEnum.PARTICIPANT_ONE, }, ], tiebreaker: { statTotal: 1000, } }; sdk.bracketGame .updatePrediction("gameId", "profileId_g_gameId", prediction) .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
id: "profileId_g_gameId",
profileId: "profileId",
totalPoints: null,
gamePoints: null,
bonusPoints: null,
position: null,
status: "ACTIVE",
gameId: "gameId",
fixtures: [
{
matchId: "11",
participantOne: "4",
participantTwo: "3",
winner: "participant_one",
correct: null
}
],
tiebreaker: {
statTotal: 1000
},
createdAt: "2025-01-08T15:02:15Z",
updatedAt: "2025-01-08T15:02:15Z"
}
Get bracket game predictions for user
Method: getGamePredictionsForUser(gameId, profileId, filters?, disableCache?)
Models:
The method returns all predictions for specific game for specific user.
No authentication required.
N.B
Filters are still in progress in our backend functionality. So if you pass any filters to the method, they will be send to our API, but they will be ignored.
Example call:
sdk.bracketGame .getGamePredictionsForUser("gameId", "profileId") .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
meta: {
pagination: {
itemsPerPage: 1,
nextPageStartsAfter: "profileId_g_gameId"
}
},
data: [
{
id: "profileId_g_gameId",
profileId: "profileId",
totalPoints: null,
gamePoints: null,
bonusPoints: null,
position: null,
status: "ACTIVE",
gameId: "gameId",
fixtures: [
{
matchId: "11",
participantOne: "4",
participantTwo: "3",
winner: "participant_one",
correct: null
}
],
tiebreaker: {
statTotal: 1000
},
createdAt: "2025-01-08T15:02:15Z",
updatedAt: "2025-01-08T15:02:15Z"
}
]
}
Updated 1 day ago