Links

How-to build a match page with odds

Welcome to the how-to guide for building a match page with odds. In this how-to guide, we’ll walk you through the steps of creating a match page that displays pre-match and live odds.

Step 1: Gather the tools

You will once again need:
  • Sportmonks API token
  • A Code editor (Visual studio used in examples)
  • Postman or your browser
On our Developer Tools Guide, you'll find a link to another article where we discuss the tools in greater detail.

Step 2: Decide which market and bookmaker you want to use

There are thousands of different markets, such as 3-way results, home/away, first card received, and Asian handicap.
Besides choosing an appropriate market, you also have to choose between various bookmakers, such as 10bet, bet365, 188bet, and many more.
For a full overview of all the markets and bookmakers we offer, use these two endpoints:
The requests for those endpoints look like this
Markets
Bookmakers
https://api.sportmonks.com/v3/odds/markets?api_token=YOUR_TOKEN
https://api.sportmonks.com/v3/odds/bookmakers?api_token=YOUR_TOKEN
Please note that the domain in the URL is odds instead of football.

Step 3: Choose the correct endpoint

Our API provides multiple different odds endpoints:
Many users, however, prefer to request pre-match or in-play odds alongside the fixture by id endpoint and then include odds or in-play odds. This request allows the user to filter on the parameters "bookmakers" and "markets" at the same time, rather than only being able to choose either bookmaker or market.

Step 4: Make your request

For this example, we’ll be requesting the 3-way result market (market id: 1) and bet365 as our bookmaker (bookmaker id: 2).
We’ll be analyzing a World Cup match between Portugal and Uruguay (id=18494085), which at the time of writing, has not been played yet.
We’ll show you both live and pre-match odds:
Pre match odds
Live odds
https://api.sportmonks.com/v3/football/fixtures/18494085?api_token=YOUR_TOKEN&include=odds&filters=bookmakers:2;markets:1
https://api.sportmonks.com/v3/football/fixtures/18494085?api_token=YOUR_TOKEN&include=inplayOdds&filters=bookmakers:2;markets:1

Step 5: The API response

Response (Pre match odds)
{
"data": {
"id": 18494085,
"sport_id": 1,
"league_id": 732,
"season_id": 18017,
"stage_id": 77452386,
"group_id": 246698,
"aggregate_id": null,
"round_id": 269276,
"state_id": 5,
"venue_id": 343341,
"name": "Portugal vs Uruguay",
"starting_at": "2022-11-28 19:00:00",
"result_info": "Portugal won after full-time.",
"leg": "1/1",
"details": null,
"length": 90,
"placeholder": false,
"last_processed_at": "2023-03-02 17:49:00",
"has_odds": true,
"starting_at_timestamp": 1669662000,
"odds": [
{
"id": 496361498,
"fixture_id": 18494085,
"market_id": 1,
"bookmaker_id": 2,
"label": "1",
"value": "1.95",
"name": "1",
"sort_order": null,
"market_description": "Fulltime Result",
"probability": "51.28%",
"dp3": "1.950",
"fractional": "39/20",
"american": "-106",
"winning": true,
"stopped": true,
"total": null,
"handicap": null,
"participants": "18701",
"created_at": "2022-11-04T16:22:07.000000Z",
"updated_at": "2023-01-11T22:20:33.000000Z",
"original_label": null,
"latest_bookmaker_update": "2022-11-27 17:05:13"
},
// And more
You can see the betting values per possible outcome. As you know, the 3-way result market has three possible outcomes: Home team wins (label 1), draw (label X), and visitor team wins (label 2).
The value that is received, represents the odds at the time of requesting.
inplayOdds will show you the same output format as odds but will be changed actively throughout the match.
More information is available in our predictions tutorial and how-to use the predictions API guide.

Step 6: Example match pages with odds

Congratulations! You now have all the tools ready to create your own odds page. Have a look at this fantastic website for some inspiration!