Predictor operations

Let your users predict match outcomes and earn points

Predictor operations are responsible for communicating with the Prediction API in predictor mode.
Each method that works with statistical data also converts your IDs to the desired ID provider for easier and quicker development.

The namespace is of course called predictor. All methods return promises. The general design of the namespace follows this pattern unless stated otherwise:

sdk.predictor.someMethod(filtersObject).then((responseObject) => {
  // do something with responseObject
});

The responses are comprised of different objects you can find here.

Match related operations

Some match related operations require authentication, some do not. This will be stated in each method.
In addition, some API calls are HTTP cached. This, again, will be state in each method.

Another thing to keep in mind is that not all markets are available for all matches. Depending on the coverage from
the data provider some matches will accept all markets, while the rest will accept only some. You can see the list of full coverage competitions
by calling the method getConfig().

Make football prediction

Method: makeFootballPrediction(matchId, market, value, playerId?)

Makes a prediction for a selected match and market.

Requires authentication. Not cached.

Accepted options:

  • matchId: string. ID of the match.
  • market: string. Options include: "FT_1X2", "HT_1X2", "BOTH_TEAMS_SCORE",
    "OVER_GOALS_0_5", "OVER_GOALS_1_5", "OVER_GOALS_2_5", "OVER_GOALS_3_5", "OVER_GOALS_4_5", "OVER_GOALS_5_5", "OVER_GOALS_6_5",
    "OVER_CORNERS_6_5", "OVER_CORNERS_7_5", "OVER_CORNERS_8_5", "OVER_CORNERS_9_5", "OVER_CORNERS_10_5", "OVER_CORNERS_11_5", "OVER_CORNERS_12_5", "OVER_CORNERS_13_5",
    "DOUBLE_CHANCE", "HT_FT", "PLAYER_SCORE", "PLAYER_YELLOW_CARD", "PLAYER_RED_CARD", "RED_CARD_MATCH", "PENALTY_MATCH",
    "PLAYER_SCORE_FIRST_GOAL", "CORNERS_MATCH", "CORRECT_SCORE", "CORRECT_SCORE_HT", "CORRECT_SCORE_ADVANCED" "PLAYER_SCORE_HATTRICK" & "PLAYER_SCORE_TWICE"
  • value: object. the prediction. The value depends on the market. Some markets require booleans, some strings, other numbers. For example when market is "FT_1X2", value can be "1", "x" or "2".

More information about value param can be found here

  • playerId: string. Optional. The ID of the player. Only applicable to the player related markets.

How the method works:

sdk.predictor
  .makeFootballPrediction('matchId', 'market', 'value', 'playerId')
  .then((responseObject) => {
    // do something with responseObject
  });

Example result

{
  id: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2_p_OVER_GOALS_fb:m:806686519",
  gameInstanceId: null,
  wager: null,
  gameType: "MATCH_QUIZ",
  totalFixtures: 1,
  settledFixtures: 0,
  userId: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2",
  fixtures: [
    {
      market: "OVER_GOALS_1.5",
      matchId: "fb:m:806686519",
      matchType: "FOOTBALL",
      matchModel: null, // returns BasicMatchModel
      prediction: {
        value: false,
        playerId: null,
        playerModel: null // only available for player related markets
      },
      result: {
        settledAt: null,
        resettledAt: null,
        status: "NOT_SETTLED",
        outcome: "NOT_VERIFIED",
        points: 0
      }
    }
  ],
  status: "ACTIVE",
  tiebreaker: null,
  points: 0,
  createdAt: "2022-02-08T11:32:59Z",
  updatedAt: "2022-02-08T11:32:59Z"
}

Delete football prediction

Method: deleteFootballPrediction("predictionId")

Allows user to delete their own prediction.

Requires authentication. Not cached.

Parameters:

  • predictionId: string. ID of the prediction.
sdk.predictor.deleteFootballPrediction('prediction-id-here').then((responseObject) => {
  // do something with responseObject
});

Example result

true; // returns true on success or exception on failure

Get match summary

Method: getMatchSummary(matchId, disableCache?)

Returns the summary of all predictions for all users in all markets.

Cached by API for 1 hour.

Parameters:

  • matchId: string. ID of a football match.
  • disableCache: boolean. Optional. Option to disable cache from API.
sdk.predictor.getMatchSummary('fb:m:887608794').then((responseObject) => {
  // do something with responseObject
});

Example result

{
   matchId: "fb:m:887608794",
   matchType: "FOOTBALL",
   predictions: {
      fullTimeOneXTwo: {
         1: 0,
         2: 0,
         x: 0
      },
      halfTimeOneXTwo: {
         1: 0,
         2: 0,
         x: 0
      },
      bothTeamsScore: {
         no: 0,
         yes: 0
      },
      doubleChance: {
         12: 0,
         1x: 0,
         x2: 0
      },
      halfTimeFullTime: {
         "x/x": 0,
         "1/1": 0,
         "1/2": 0,
         "2/1": 0,
         "2/2": 0,
         "1/x": 0,
         "x/2": 0,
         "x/1": 0,
         "2/x": 0
      },
      playerScore: {},
      playerYellowCard: {},
      playerRedCard: {},
      redCardMatch: {
         no: 0,
         yes: 0
      },
      penaltyMatch: {
         no: 0,
         yes: 0
      },
      playerScoreFirstGoal: {},
      cornersMatch: {},
      correctScore: {},
      playerScoreHattrick: {},
      playerScoreTwice: {},
      overZeroPointFiveGoals: {
         no: 0,
         yes: 0
      },
      overOnePointFiveGoals: {
         no: 0,
         yes: 0
      },
      overTwoPointFiveGoals: {
         no: 0,
         yes: 0
      },
      overThreePointFiveGoals: {
         no: 0,
         yes: 0
      },
      overFourPointFiveGoals: {
         no: 0,
         yes: 0
      },
      overFivePointFiveGoals: {
         no: 0,
         yes: 0
      },
      overSixPointFiveGoals: {
         no: 0,
         yes: 0
      },
      overSixPointFiveCorners: {
         no: 0,
         yes: 0
      },
      overSevenPointFiveCorners: {
         no: 0,
         yes: 0
      },
      overEightPointFiveCorners: {
         no: 0,
         yes: 0
      },
      overNinePointFiveCorners: {
         no: 0,
         yes: 0
      },
      overTenPointFiveCorners: {
         no: 0,
         yes: 0
      },
      overElevenPointFiveCorners: {
         no: 0,
         yes: 0
      },
      overTwelvePointFiveCorners: {
         no: 0,
         yes: 0
      },
      overThirteenPointFiveCorners: {
         no: 0,
         yes: 0
      }
   }
}

Get market summary

Method: getMarketSummary(matchId, market, playerId?)

Returns the summary of a specific market for a particular match for all users.

Cached by API for 1 hour.

Parameters:

  • matchId: string. ID of a football match.
  • market: string. The ID of the market. Options include: "FT_1X2", "HT_1X2", "BOTH_TEAMS_SCORE", "OVER_GOALS_0.5",
    "OVER_GOALS_1.5", "OVER_GOALS_2.5", "OVER_GOALS_3.5", "OVER_GOALS_4.5", "OVER_GOALS_5.5", "OVER_GOALS_6.5", "OVER_CORNERS_6.5",
    "OVER_CORNERS_7.5", "OVER_CORNERS_8.5", "OVER_CORNERS_9.5", "OVER_CORNERS_10.5", "OVER_CORNERS_11.5", "OVER_CORNERS_12.5",
    "OVER_CORNERS_13.5", "DOUBLE_CHANCE", "HT_FT", "PLAYER_SCORE", "PLAYER_YELLOW_CARD", "PLAYER_RED_CARD", "RED_CARD_MATCH",
    "PENALTY_MATCH", "PLAYER_SCORE_FIRST_GOAL", "CORNERS_MATCH", "CORRECT_SCORE", "PLAYER_SCORE_HATTRICK" & "PLAYER_SCORE_TWICE"
  • playerId: string. Optional. When provided market is some of the following: ("PLAYER_SCORE", "PLAYER_YELLOW_CARD", "PLAYER_RED_CARD", "PLAYER_SCORE_FIRST_GOAL", "PLAYER_SCORE_HATTRICK" & "PLAYER_SCORE_TWICE") client can pass an id of a player to get the specific market summary for the player.

Keep in mind that for PLAYER_SCORE_FIRST_GOAL for playerId paramater is available also "OWN_GOAL" and "NOBODY"

Example call with player market and player id:

sdk.predictor.getMarketSummary('fb:m:887608794', 'PLAYER_SCORE_FIRST_GOAL', "fb:p:476").then((responseObject) => {
  // do something with responseObject
});

Example result

// keep in mind the response changes depending on the market
{
   yes: 541,
   no: 102,
   model: PlayerBasicModel
}

Example call with player market no player id:

sdk.predictor.getMarketSummary('fb:m:887608794', 'PLAYER_SCORE_FIRST_GOAL').then((responseObject) => {
  // do something with responseObject
});

Example result

// keep in mind the response changes depending on the market
matchId: "fb:m:46358",
   matchType: "FOOTBALL",
   playerScoreFirstGoal: {
      fb:p:4208556: {
         no: 0,
         yes: 1,
         model: PlayerBasicModel
      },
      OWN_GOAL: {
         no: 1,
         yes: 0
      },
      NOBODY: {
         no: 0,
         yes: 0
      }
   }

Example call:

sdk.predictor.getMarketSummary('fb:m:887608794', 'FT_1X2').then((responseObject) => {
  // do something with responseObject
});

Example result

// keep in mind the response changes depending on the market
{
   matchId: "fb:m:887608794",
   matchType: "FOOTBALL",
   fullTimeOneXTwo: {
      1: 541,
      2: 102,
      x: 67
   }
}

Get match markets results

Method: getMatchMarketsResults(matchId)

Returns the match correct results for all markets.

Parameters:

matchId the match ID for finished match.

Example call:

sdk.predictor.getMatchMarketsResults("fb:m:736264671").then((responseObject) => {
  // do something with responseObject
});

Example result

{
   FT_1X2: "2",
   HT_1X2: "2",
   BOTH_TEAMS_SCORE: false,
   DOUBLE_CHANCE: [
      "x2",
      "12"
   ],
   HT_FT: "2/2",
   RED_CARD_MATCH: true,
   PENALTY_MATCH: false,
   CORNERS_MATCH: 9,
   PLAYER_YELLOW_CARD: [
      {
         playerId: "fb:p:42112",
         playerModel: {
            id: "fb:p:42112",
            country: {
               id: "fb:cnt:1522",
               alias: null,
               countryCode: "ENG",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "England"
            },
            birthDate: "1995-07-12",
            firstName: "Luke",
            lastName: "Shaw",
            name: "Luke Shaw",
            position: "defender",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/db811454-c9d3-4e99-bd21-1109969943b3.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:82389",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/4211797e-8c4e-11eb-aff3-42010a8400d1.png"
                  },
                  name: "England",
                  code: "ENG",
                  national: true,
                  undecided: false,
                  fullName: null,
                  shortName: null
               },
               {
                  id: "fb:t:8102",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/2e3d2ae6-825f-4304-a8f5-ca50d4dcc6c8.png"
                  },
                  name: "Manchester United",
                  code: "MUN",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      },
      {
         playerId: "fb:p:43400",
         playerModel: {
            id: "fb:p:43400",
            country: {
               id: "fb:cnt:3135",
               alias: null,
               countryCode: "PRT",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a92ec60-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "Portugal"
            },
            birthDate: "1985-02-05",
            firstName: "Cristiano Ronaldo",
            lastName: "dos Santos Aveiro",
            name: "Cristiano Ronaldo",
            position: "forward",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/f7105da1-9b65-4fe8-848d-09418ae1e096.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:81681",
                  country: {
                     id: "fb:cnt:172",
                     alias: null,
                     countryCode: "SAU",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a9369bd-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "Saudi Arabia"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/340b82a1-e2d5-47bc-b95e-3f2b661d4162.png"
                  },
                  name: "Al Nassr FC",
                  code: "ALN",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               },
               {
                  id: "fb:t:81651",
                  country: {
                     id: "fb:cnt:3135",
                     alias: null,
                     countryCode: "PRT",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a92ec60-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "Portugal"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/4217ec5f-8c4e-11eb-aff3-42010a8400d1.png"
                  },
                  name: "Portugal",
                  code: "POR",
                  national: true,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      },
      {
         playerId: "fb:p:47001",
         playerModel: {
            id: "fb:p:47001",
            country: {
               id: "fb:cnt:665",
               alias: null,
               countryCode: "BRA",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a936471-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "Brazil"
            },
            birthDate: "1993-03-05",
            firstName: "Frederico",
            lastName: "Rodrigues Santos",
            name: "Fred",
            position: "midfielder",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/6bd9279b-9c83-479e-8c06-1befd4c31fd1.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:8516",
                  country: {
                     id: "fb:cnt:7188",
                     alias: null,
                     countryCode: "TUR",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a9347a0-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "Turkey"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/92b1ca85-a91e-4f20-a410-b04a94594753.png"
                  },
                  name: "Fenerbahce",
                  code: "FEN",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      },
      {
         playerId: "fb:p:45137",
         playerModel: {
            id: "fb:p:45137",
            country: {
               id: "fb:cnt:3135",
               alias: null,
               countryCode: "PRT",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a92ec60-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "Portugal"
            },
            birthDate: "1994-09-08",
            firstName: "Bruno Miguel",
            lastName: "Borges Fernandes",
            name: "Bruno Fernandes",
            position: "midfielder",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/f919cd44-49f2-414b-aa55-68928ecdde0b.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:8102",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/2e3d2ae6-825f-4304-a8f5-ca50d4dcc6c8.png"
                  },
                  name: "Manchester United",
                  code: "MUN",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               },
               {
                  id: "fb:t:81651",
                  country: {
                     id: "fb:cnt:3135",
                     alias: null,
                     countryCode: "PRT",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a92ec60-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "Portugal"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/4217ec5f-8c4e-11eb-aff3-42010a8400d1.png"
                  },
                  name: "Portugal",
                  code: "POR",
                  national: true,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      },
      {
         playerId: "fb:p:42279",
         playerModel: {
            id: "fb:p:42279",
            country: {
               id: "fb:cnt:1522",
               alias: null,
               countryCode: "ENG",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "England"
            },
            birthDate: "1993-03-05",
            firstName: "Harry",
            lastName: "Maguire",
            name: "Harry Maguire",
            position: "defender",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/898cda58-0e9e-4802-84e0-73edce4d85ff.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:8102",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/2e3d2ae6-825f-4304-a8f5-ca50d4dcc6c8.png"
                  },
                  name: "Manchester United",
                  code: "MUN",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      },
      {
         playerId: "fb:p:4158170",
         playerModel: {
            id: "fb:p:4158170",
            country: {
               id: "fb:cnt:1522",
               alias: null,
               countryCode: "ENG",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "England"
            },
            birthDate: "1997-11-26",
            firstName: null,
            lastName: null,
            name: "Aaron Wan-Bissaka",
            position: "defender",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/7637430f-0b66-4b2f-acbd-c3c60596f528.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:894",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/dae64e7e-af11-4924-bceb-b23b08a985b3.png"
                  },
                  name: "West Ham United",
                  code: "WHU",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      }
   ],
   PLAYER_RED_CARD: [
      {
         playerId: "fb:p:42006",
         playerModel: {
            id: "fb:p:42006",
            country: {
               id: "fb:cnt:2258",
               alias: null,
               countryCode: "FRA",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a92ed77-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "France"
            },
            birthDate: "1993-03-15",
            firstName: "Paul",
            lastName: "Pogba",
            name: "Paul Pogba",
            position: "midfielder",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/56c3c8a3-ca94-4697-bd2d-95bd256fe1da.jpeg"
            },
            isDeleted: false,
            teams: []
         }
      }
   ],
   PLAYER_SCORE_FIRST_GOAL: {
      playerId: "fb:p:44610",
      playerModel: {
         id: "fb:p:44610",
         country: {
            id: "fb:cnt:83",
            alias: null,
            countryCode: "GUI",
            assets: {
               flag: "https://football.fansunitedassets.com/country/3a9305fc-8e19-11eb-b60d-42010a84003b.png"
            },
            name: "Guinea"
         },
         birthDate: "1995-02-10",
         firstName: "Naby Deco",
         lastName: "Keïta",
         name: "Naby Keita",
         position: "midfielder",
         assets: {
            headshot: "https://football.fansunitedassets.com/player/17c0a917-8d46-45b7-9f60-1d170f9c0d07.jpeg"
         },
         isDeleted: false,
         teams: [
            {
               id: "fb:t:87120",
               country: {
                  id: "fb:cnt:83",
                  alias: null,
                  countryCode: "GUI",
                  assets: {
                     flag: "https://football.fansunitedassets.com/country/3a9305fc-8e19-11eb-b60d-42010a84003b.png"
                  },
                  name: "Guinea"
               },
               gender: "male",
               assets: null,
               name: "Guinea U23",
               code: "GUI",
               national: true,
               undecided: false,
               fullName: null,
               shortName: null
            },
            {
               id: "fb:t:8226",
               country: {
                  id: "fb:cnt:924",
                  alias: null,
                  countryCode: "DEU",
                  assets: {
                     flag: "https://football.fansunitedassets.com/country/3a92e4fd-8e19-11eb-b60d-42010a84003b.png"
                  },
                  name: "Germany"
               },
               gender: "male",
               assets: {
                  logo: "https://football.fansunitedassets.com/team/9917c2e1-ffdb-4c50-b9d4-b7e5b6612ccd.png"
               },
               name: "Werder Bremen",
               code: "SVW",
               national: false,
               undecided: false,
               fullName: null,
               shortName: null
            }
         ]
      }
   },
   PLAYER_SCORE: [
      {
         playerId: "fb:p:44610",
         playerModel: {
            id: "fb:p:44610",
            country: {
               id: "fb:cnt:83",
               alias: null,
               countryCode: "GUI",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a9305fc-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "Guinea"
            },
            birthDate: "1995-02-10",
            firstName: "Naby Deco",
            lastName: "Keïta",
            name: "Naby Keita",
            position: "midfielder",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/17c0a917-8d46-45b7-9f60-1d170f9c0d07.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:87120",
                  country: {
                     id: "fb:cnt:83",
                     alias: null,
                     countryCode: "GUI",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a9305fc-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "Guinea"
                  },
                  gender: "male",
                  assets: null,
                  name: "Guinea U23",
                  code: "GUI",
                  national: true,
                  undecided: false,
                  fullName: null,
                  shortName: null
               },
               {
                  id: "fb:t:8226",
                  country: {
                     id: "fb:cnt:924",
                     alias: null,
                     countryCode: "DEU",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a92e4fd-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "Germany"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/9917c2e1-ffdb-4c50-b9d4-b7e5b6612ccd.png"
                  },
                  name: "Werder Bremen",
                  code: "SVW",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      },
      {
         playerId: "fb:p:48496",
         playerModel: {
            id: "fb:p:48496",
            country: {
               id: "fb:cnt:3135",
               alias: null,
               countryCode: "PRT",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a92ec60-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "Portugal"
            },
            birthDate: "1996-12-04",
            firstName: "Diogo José",
            lastName: "Teixeira da Silva",
            name: "Diogo Jota",
            position: "forward",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/dd85b73f-3407-4f0d-bd46-f1bd0f6f7ce4.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:892",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/a4cb91e9-c357-4392-a07d-2e7d1fbca7c5.png"
                  },
                  name: "Liverpool",
                  code: "LIV",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               },
               {
                  id: "fb:t:81651",
                  country: {
                     id: "fb:cnt:3135",
                     alias: null,
                     countryCode: "PRT",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a92ec60-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "Portugal"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/4217ec5f-8c4e-11eb-aff3-42010a8400d1.png"
                  },
                  name: "Portugal",
                  code: "POR",
                  national: true,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      },
      {
         playerId: "fb:p:44971",
         playerModel: {
            id: "fb:p:44971",
            country: {
               id: "fb:cnt:97",
               alias: null,
               countryCode: "EGY",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a92f3ae-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "Egypt"
            },
            birthDate: "1992-06-15",
            firstName: "Mohamed",
            lastName: "Salah Ghaly",
            name: "Mohamed Salah",
            position: "forward",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/bd4bc667-8089-4ba1-b096-2876719990bc.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:892",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/a4cb91e9-c357-4392-a07d-2e7d1fbca7c5.png"
                  },
                  name: "Liverpool",
                  code: "LIV",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      }
   ],
   PLAYER_SCORE_TWICE: [
      {
         playerId: "fb:p:44971",
         playerModel: {
            id: "fb:p:44971",
            country: {
               id: "fb:cnt:97",
               alias: null,
               countryCode: "EGY",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a92f3ae-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "Egypt"
            },
            birthDate: "1992-06-15",
            firstName: "Mohamed",
            lastName: "Salah Ghaly",
            name: "Mohamed Salah",
            position: "forward",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/bd4bc667-8089-4ba1-b096-2876719990bc.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:892",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/a4cb91e9-c357-4392-a07d-2e7d1fbca7c5.png"
                  },
                  name: "Liverpool",
                  code: "LIV",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      }
   ],
   PLAYER_SCORE_HATTRICK: [
      {
         playerId: "fb:p:44971",
         playerModel: {
            id: "fb:p:44971",
            country: {
               id: "fb:cnt:97",
               alias: null,
               countryCode: "EGY",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a92f3ae-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "Egypt"
            },
            birthDate: "1992-06-15",
            firstName: "Mohamed",
            lastName: "Salah Ghaly",
            name: "Mohamed Salah",
            position: "forward",
            assets: {
               headshot: "https://football.fansunitedassets.com/player/bd4bc667-8089-4ba1-b096-2876719990bc.jpeg"
            },
            isDeleted: false,
            teams: [
               {
                  id: "fb:t:892",
                  country: {
                     id: "fb:cnt:1522",
                     alias: null,
                     countryCode: "ENG",
                     assets: {
                        flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
                     },
                     name: "England"
                  },
                  gender: "male",
                  assets: {
                     logo: "https://football.fansunitedassets.com/team/a4cb91e9-c357-4392-a07d-2e7d1fbca7c5.png"
                  },
                  name: "Liverpool",
                  code: "LIV",
                  national: false,
                  undecided: false,
                  fullName: null,
                  shortName: null
               }
            ]
         }
      }
   ],
   CORRECT_SCORE: {
      homeGoals: 0,
      awayGoals: 5
   },
   CORRECT_SCORE_ADVANCED: {
      homeGoals: 0,
      awayGoals: 5
   },
   CORRECT_SCORE_HT: {
      homeGoals: 0,
      awayGoals: 4
   },
   OVER_GOALS_0_5: true,
   OVER_GOALS_1_5: true,
   OVER_GOALS_2_5: true,
   OVER_GOALS_3_5: true,
   OVER_GOALS_4_5: true,
   OVER_GOALS_5_5: false,
   OVER_GOALS_6_5: false,
   OVER_CORNERS_6_5: true,
   OVER_CORNERS_7_5: true,
   OVER_CORNERS_8_5: true,
   OVER_CORNERS_9_5: false,
   OVER_CORNERS_10_5: false,
   OVER_CORNERS_11_5: false,
   OVER_CORNERS_12_5: false,
   OVER_CORNERS_13_5: false
}

User related operations

Get user's own predictions

Method: getMyPredictions({})

Gets the currently logged-in user's predictions.

Requires authentication. Not cached.

Options object:

  • limit: number. Number of records to be returned.
  • startAfter: string. The ID of the prediction you want to start the count after.
  • status: string. The status of prediction. Options include: "ACTIVE", "WON", "LOST", "PARTIALLY_WON", "CANCELED".
  • type: string. Type of game for predictions. Options are: "MATCH_QUIZ", "TOP_X" and "SINGLE".
  • matchIds: string[]. Filter the predictions by their matches.
  • gameIds: string[]. Filter the predictions by their games.

Notes:

  1. status, type, matchIds and gameIds can be used only individually
  2. matchIds and gameIds parameters are limited to 10 IDs.
sdk.predictor.getMyPredictions({}).then((responseObject) => {
  // do something with responseObject
});

Example result

{
   meta: {
      pagination: {
         nextPageStartsAfter: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2_p_PLAYER_SCORE_fb:m:219813020",
         itemsPerPage: 20
      }
   },
   data: [
      {
         id: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2_p_PLAYER_SCORE_fb:m:219813020",
         gameInstanceId: null,
         gameType: "SINGLE",
         wager: null,
         totalFixtures: 1,
         settledFixtures: 0,
         userId: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2",
         fixtures: [
            {
               market: "PLAYER_SCORE",
               matchId: "fb:m:219813020",
               matchType: "FOOTBALL",
               matchModel: {}, // Basic Match Model
               prediction: {
                  value: true,
                  playerId: "fb:p:43400",
                  playerModel: {} // Player Model
               },
               result: {
                  settledAt: "2022-02-15T22:11:00Z",
                  resettledAt: null,
                  status: "SETTLED",
                  outcome: "CORRECT",
                  points: 10
               }
            }
         ],
         status: "WON",
         tiebreaker: null,
         points: 10,
         createdAt: "2022-02-15T13:29:22Z",
         updatedAt: "2022-02-15T22:11:03Z"
      }
   ]
}

Get own predictions for specific matches

Method: getMyPredictionsForMatches(matchIds: string[], filters?: PredictionsFilters)

Returns all own predictions for specified list of matches.
Optional filters options:

  • limit: number. Number of records to be returned.
  • startAfter: string. The ID of the prediction you want to start the count after.
const matchIds: string[] = ["1", "2", "3"];
const filters = {
  limit: 1,
  startAfter: "prediction-id"
}

sdk.predictor.getMyPredictionsForMatches(matchIds, filters)
  .then(responseObject => {
  // do something with responseObject
});

Example result

N.B. matchIds parameter is limited to 10 matches. If you provide more than 10, JS SDK throws an exception before even making a request to Prediction API.

Example:

const matchIds: string[] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"];

sdk.predictor.getMyPredictionsForMatches(matchIds)
  .catch(error => {
  // Throws message "Maximum matchIds in PredictionFilters should be 10 or less."
});

Get user's own current predictions

Method: getMyCurrentPredictions(filters?)

Gets the logged-in user's currently active predictions.

Requires authentication. Not cached.

Optional filters options:

  • limit: number. Number of records to be returned.
  • startAfter: string. The ID of the prediction you want to start the count after.
sdk.predictor.getMyCurrentPredictions({}).then((responseObject) => {
  // do something with responseObject
});

Example result

// See the response for getMyPredictions() method

Get user's own past predictions

Method: getMyPastPredictions(filters?)

Gets the logged-in user's past predictions.

Requires authentication. Not cached.

Options filters options:

  • limit: number. Number of records to be returned.
  • startAfter: string. The ID of the prediction you want to start the count after.
sdk.predictor.getMyPastPredictions({}).then((responseObject) => {
  // do something with responseObject
});

Example result

// See the response for getMyPredictions() method

Get user's predictions

Method: getUserPredictions("ID", filters?, disableCache?)

Gets the predictions for a particular user.

  • userId: string. The ID of the user you want to fetch the predictions for
  • filters: object. Optional.
    • limit: number. Number of records to be returned.
    • startAfter: string. The ID of the prediction you want to start the count after.
    • status: string. The status of prediction. Options include: "ACTIVE", "WON", "LOST", "PARTIALLY_WON", "CANCELED".
    • type: string. Type of game for predictions. Options are: "MATCH_QUIZ", "TOP_X" and "SINGLE".
    • matchIds: string[]. Filter the predictions by their matches.
    • gameIds: string[]. Filter the predictions by their games.
  • disableCache: boolean. Default: false. Disables cached response

Notes:

  1. status, type, matchIds and gameIds can be used only individually
  2. matchIds and gameIds parameters are limited to 10 IDs.
sdk.predictor.getUserPredictions('user-id-here', {}, true).then((responseObject) => {
  // do something with responseObject
});

Example result

// See the response for getMyPredictions() method

Get user's predictions for matches

Method: getUserPredictionsForMatches(userId: string, matchIds: string[], filters?: PredictionsFilters, disableCache?: boolean)

Returns all user's predictions for specified list of matches.
Optional filters options:

  • limit: number. Number of records to be returned.
  • startAfter: string. The ID of the prediction you want to start the count after.
const userId = "profile-id";
const matchIds = ["1", "2", "3"];
const filters = {
  limit: 1,
  startAfter: "prediction-id"
};
const disableCache = true;

sdk.predictor.getUserPredictionsForMatches(userId, matchIds, filters, disableCache)
  .then(responseObject => {
  // do something with responseObject
});

Example result

N.B. matchIds parameter is limited to 10 matches. If you provide more than 10, JS SDK throws an exception before even making a request to Prediction API.

Example:

const userId = "profile-id";
const matchIds = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"];

sdk.predictor.getUserPredictionsForMatches(userId, matchIds, filters, disableCache)
  .catch(error => {
  // Throws message "Maximum matchIds in PredictionFilters should be 10 or less."
});

Get user's past predictions

Method: getUserPastPredictions("ID", filters?)

Gets the past predictions for a particular user.

  • userId: string. The ID of the user you want to fetch the predictions for
  • filters: object. Optional.
    • limit: number. Number of records to be returned.
    • startAfter: string. The ID of the prediction you want to start the count after.
sdk.predictor.getUserPastPredictions('user-id-here', {}).then((responseObject) => {
  // do something with responseObject
});

Example result

// See the response for getMyPredictions() method

Get user's current predictions

Method: getUserCurrentPredictions("ID", filters)

Gets the current (active/live and future) predictions of a user.

  • userId: string. The ID of the user you want to fetch the predictions for
  • options: object. Optional.
    • limit: number. Number of records to be returned.
    • startAfter: string. The ID of the prediction you want to start the count after.
sdk.predictor.getUserCurrentPredictions('user-id-here', {}).then((responseObject) => {
  // do something with responseObject
});

Example result

// See the response for getMyPredictions() method

Other operations

Get config

Method: getConfig()

Returns the configuration for the Predictor feature. The matches from competitions listed in fullCoverageCompetitions accept all markets.
The matches in all other competitions accept only the main markets.

The config will be cached in LocalStorage for 4 hours.

sdk.predictor.getConfig().then((responseObject) => {
  // do something with responseObject
});

Example result

{
   fullCoverageCompetitions: [
      "fb:c:1",
      "fb:c:3",
      "fb:c:4",
      "fb:c:5",
      "fb:c:6",
      "fb:c:7",
      "fb:c:8",
      "fb:c:9",
      "fb:c:11",
      "fb:c:12",
      "fb:c:13",
      "fb:c:14",
      "fb:c:15",
      "fb:c:16",
      "fb:c:17",
      "fb:c:18",
      "fb:c:19",
      "fb:c:20",
      "fb:c:21",
      "fb:c:22",
      "fb:c:27",
      "fb:c:28",
      "fb:c:30",
      "fb:c:34",
      "fb:c:37",
      "fb:c:119"
   ],
   markets: {
      main: [
         "FT_1X2",
         "BOTH_TEAMS_SCORE",
         "CORRECT_SCORE",
         "DOUBLE_CHANCE",
         "OVER_GOALS"
      ],
      all: [
         "FT_1X2",
         "HT_1X2",
         "HT_FT",
         "BOTH_TEAMS_SCORE",
         "CORRECT_SCORE",
         "DOUBLE_CHANCE",
         "PLAYER_SCORE",
         "PLAYER_SCORE_TWICE",
         "PLAYER_SCORE_HATTRICK",
         "PLAYER_YELLOW_CARD",
         "PLAYER_RED_CARD",
         "RED_CARD_MATCH",
         "PENALTY_MATCH",
         "OVER_GOALS",
         "OVER_CORNERS",
         "PLAYER_SCORE_FIRST_GOAL",
         "CORNERS_MATCH"
      ]
   }
}

Get prediction by ID

Method: getPredictionById("prediction-id")

Returns prediction's object information

sdk.predictor.getPredictionById("Y44CxUzkpHdypYxcVVlwIQiLNtD2_p_CORRECT_SCORE_ADVANCED_fb:m:152157").then((responseObject) => {
  // do something with responseObject
});

Example result

{
   id: "Y44CxUzkpHdypYxcVVlwIQiLNtD2_p_CORRECT_SCORE_ADVANCED_fb:m:152157",
   gameInstanceId: null,
   gameType: "SINGLE",
   wager: null,
   totalFixtures: 1,
   settledFixtures: 1,
   userId: "Y44CxUzkpHdypYxcVVlwIQiLNtD2",
   fixtures: [
      {
         market: "CORRECT_SCORE_ADVANCED",
         matchId: "fb:m:152157",
         matchType: "FOOTBALL",
         matchModel: MatchBasicModel,
         prediction: {
            value: "1:1",
            playerId: null,
            playerModel: null
         },
         result: {
            settledAt: "2023-05-18T15:15:01Z",
            resettledAt: null,
            status: "SETTLED",
            outcome: "INCORRECT",
            points: 0
         }
      }
   ],
   status: "LOST",
   tiebreaker: null,
   points: 0,
   createdAt: "2023-05-18T10:18:57Z",
   updatedAt: "2023-05-18T15:15:01Z"
}

FAQ about making predictions

Here are all markets supported by JS SDK:

enum MarketEnum {
    FT_1X2 = 'FT_1X2',
    HT_1X2 = "HT_1X2",
    BOTH_TEAMS_SCORE = "BOTH_TEAMS_SCORE",
    DOUBLE_CHANCE = "DOUBLE_CHANCE",
    HT_FT = "HT_FT",
    PLAYER_SCORE = "PLAYER_SCORE",
    PLAYER_YELLOW_CARD = "PLAYER_YELLOW_CARD",
    PLAYER_RED_CARD = "PLAYER_RED_CARD",
    RED_CARD_MATCH = "RED_CARD_MATCH",
    PENALTY_MATCH = "PENALTY_MATCH",
    PLAYER_SCORE_FIRST_GOAL = "PLAYER_SCORE_FIRST_GOAL",
    CORNERS_MATCH = "CORNERS_MATCH",
    CORRECT_SCORE = "CORRECT_SCORE",
    CORRECT_SCORE_HT = "CORRECT_SCORE_HT",
    CORRECT_SCORE_ADVANCED = "CORRECT_SCORE_ADVANCED",
    PLAYER_SCORE_HATTRICK = "PLAYER_SCORE_HATTRICK",
    PLAYER_SCORE_TWICE = "PLAYER_SCORE_TWICE",
    OVER_GOALS_0_5 = "OVER_GOALS_0_5",
    OVER_GOALS_1_5 = "OVER_GOALS_1_5",
    OVER_GOALS_2_5 = "OVER_GOALS_2_5",
    OVER_GOALS_3_5 = "OVER_GOALS_3_5",
    OVER_GOALS_4_5 = "OVER_GOALS_4_5",
    OVER_GOALS_5_5 = "OVER_GOALS_5_5",
    OVER_GOALS_6_5 = "OVER_GOALS_6_5",
    OVER_CORNERS_6_5 = "OVER_CORNERS_6_5",
    OVER_CORNERS_7_5 = "OVER_CORNERS_7_5",
    OVER_CORNERS_8_5 = "OVER_CORNERS_8_5",
    OVER_CORNERS_9_5 = "OVER_CORNERS_9_5",
    OVER_CORNERS_10_5 = "OVER_CORNERS_10_5",
    OVER_CORNERS_11_5 = "OVER_CORNERS_11_5",
    OVER_CORNERS_12_5 = "OVER_CORNERS_12_5",
    OVER_CORNERS_13_5 = "OVER_CORNERS_13_5"
};

And all available values for some of the markets:

enum OneXTwoEnum {
    ONE = "1",
    X = "x",
    TWO = "2"
};

enum DoubleChanceEnum {
    ONE_X = "1x",
    X_TWO = "x2",
    ONE_TWO = "12",
};

enum HalfTimeFullTimeEnum {
    ONE_ONE = "1/1",
    ONE_X = "1/x",
    ONE_TWO = "1/2",
    X_ONE = "x/1",
    X_X = "x/x",
    X_TWO = "x/2",
    TWO_ONE = "2/1",
    TWO_X = "2/x",
    TWO_TWO = "2/2"
};

FT_1X2

For example you want to make a prediction for market FT_1X2 with value "x". Here is an example call:

// Value for prediction must be OneXTwoEnum
const value = 'x'; // For JavaScript
const value = OneXTwoEnum.X; // For TypeScript


sdk.predictor
  .makeFootballPrediction('matchId', 'FT_1X2', value)
  .then((responseObject) => {
    // Do something with responseObject
  })
  .catch((error) => {
    // Handle error
  });

Same goes for HT_1X2 market

DOUBLE_CHANCE

For example you want to make a prediction for market DOUBLE_CHANCE with value "1x". Here is an example call:

// Value for prediction must be DoubleChanceEnum
const value = '1x'; // For JavaScript
const value = DoubleChanceEnum.ONE_X; // For TypeScript

sdk.predictor
  .makeFootballPrediction('matchId', 'DOUBLE_CHANCE', value)
  .then((responseObject) => {
    // Do something with responseObject
  })
  .catch((error) => {
    // Handle error
  });

HT_FT

For example you want to make a prediction for market HT_FT with value "1/x". Here is an example call:

// Value for prediction must be HalfTimeFullTimeEnum
const value = '1/x'; // For JavaScript
const value = HalfTimeFullTimeEnum.ONE_X; // For TypeScript

sdk.predictor
  .makeFootballPrediction('matchId', 'HT_FT', value)
  .then((responseObject) => {
    // Do something with responseObject
  })
  .catch((error) => {
    // Handle error
  });

Player related markets

For example you want to make a prediction for market PLAYER_SCORE_TWICE with playerId and prediction. Here is an example call:

const value = true;
const playerId = 'id of player';

sdk.predictor
  .makeFootballPrediction('matchId', 'PLAYER_SCORE_TWICE', value, playerId)
  .then((responseObject) => {
    // Do something with responseObject
  })
  .catch((error) => {
    // Handle error
  });

Same goes for all other PLAYER related markets

N.B:
You can provide playerId: null OR playerId: "OWN_GOAL" for market PLAYER_SCORE_FIRST_GOAL.
That way we handle the case for Match Quiz play method

BOTH_TEAMS_SCORE

For example you want to make a prediction for market BOTH_TEAMS_SCORE with prediction true. Here is an example call:

const value = true;

sdk.predictor
  .makeFootballPrediction('matchId', 'BOTH_TEAMS_SCORE', value)
  .then((responseObject) => {
    // Do something with responseObject
  })
  .catch((error) => {
    // Handle error
  });

Same goes for RED_CARD_MATCH, PENALTY_MATCH, all OVER_GOALS and OVER_CORNERS sub markets

CORNERS_MATCH

For example you want to make a prediction for market CORNERS_MATCH with prediction some number. Here is an example call:

const value = 9;

sdk.predictor
  .makeFootballPrediction('matchId', 'CORNERS_MATCH', value)
  .then((responseObject) => {
    // Do something with responseObject
  })
  .catch((error) => {
    // Handle error
  });

CORRECT_SCORE, CORRECT_SCORE_HT, CORRECT_SCORE_ADVANCED

For example you want to make a prediction for market CORRECT_SCORE with prediction correct score. Here is an example call:

const value '2:1'; // prediction has to be in this format !!!

sdk.predictor
  .makeFootballPrediction('matchId', 'CORRECT_SCORE', value)
  .then((responseObject) => {
    // Do something with responseObject
  })
  .catch((error) => {
    // Handle error
  });