# How-to build a betting odds portal

Welcome to the how-to guide about building a betting odds portal.&#x20;

We define a betting odds portal, as a website that is host to various bookmakers being actively compared to each other per market.&#x20;

![](https://1087665238-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MJWcc-TbBVUybJ0WbUQ%2F-MP4T61mVlGrFLsMriOb%2F-MP4XbsfA9YGJbXu3Dfp%2Fimage.png?alt=media\&token=e76a836d-ee48-490a-91a1-6329e1b78f6f)

{% hint style="info" %}
Note, that we will not take live odds into account.
{% endhint %}

## Step 1: Gather the tools&#x20;

You are going to need the following tools:

* Sportmonks API token
* Code editor (Visual studio used in examples)
* Postman (optional)

You can find a link to another article where we discuss the tools in-depth on our [**Developer Tools Guide.**](https://docs.sportmonks.com/v2/how-to-guides/developer-tools)

## Step 2: Decide which bookmakers and markets you want

Do you want to show every single bookmaker or just a few popular ones? The choice is yours. \
\
In this guide, we’ll focus on pre-match odds. If you’re interested in live odds, please refer to our [**how-to build a match page with odds guide.**](https://docs.sportmonks.com/v2/how-to-guides/odds-and-predictions/how-to-build-a-match-page-with-odds)\
\
There are lots of different markets to choose from. You can request all the markets yourself via our [**all markets endpoint**](https://football-postman.sportmonks.com/#1651729b-36f3-46dd-a5bd-455a658a28d1). We've listed a few popular ones below:

* 3-way results (market id: 1)
* Asian Handicap (market id: 28)
* Over/Under (market id: 12)
* Draw no bet (market id: 28082)

The most important part of the odds portal is to compare the bookmakers. You can request all the bookmakers yourself via our [**all bookmakers endpoint**](https://football-postman.sportmonks.com/#ed4c30db-cb45-4d4a-8bec-a067d17fe0e3)**.** We've listed a few popular ones below:

* bet365 (bookmaker id: 2)
* 1xBet (bookmaker id: 25679340)
* Betfair (bookmaker id: 15)
* Betway (bookmaker id: 271057011)
* Unibet (bookmaker id: 97)

We at Sportmonks offer you a large number of markets and bookmakers. If it exists, we offer it!

To see the full list of all the bookmakers and markets we offer, you can simply make API requests with the following endpoints:

* [**Markets endpoint**](https://football-postman.sportmonks.com/#1651729b-36f3-46dd-a5bd-455a658a28d1)
* [**Bookmaker endpoint**](https://football-postman.sportmonks.com/#ed4c30db-cb45-4d4a-8bec-a067d17fe0e3)

{% tabs %}
{% tab title="Request markets" %}

```javascript
https://soccer.sportmonks.com/api/v2.0/markets?api_token={API_TOKEN}
```

{% endtab %}

{% tab title="Request bookmakers" %}

```javascript
https://soccer.sportmonks.com/api/v2.0/bookmakers?api_token={API_TOKEN}
```

{% endtab %}
{% endtabs %}

## Step 3: Choose the correct endpoint

In our [**how-to build a match page with odds guide**](https://docs.sportmonks.com/v2/how-to-guides/odds-and-predictions/how-to-build-a-match-page-with-odds)**,** we worked with `flatOdds` and `inplayOdds` as includes. For this how-to guide, we’ll be working with the include called `oddComparison`(better for comparison) and the endpoint [**fixtures by date**](https://football-postman.sportmonks.com/#3ea72840-e3b7-48fe-9034-3a2132885ce8)**:**

```javascript
https://soccer.sportmonks.com/api/v2.0/fixtures/date/{YYYY-MM-DD}?api_token={API_TOKEN}&include=oddComparison&markets={Market_IDs}&bookmakers={Bookmaker_IDs}
```

This request will return all the fixtures of a certain date with the odds. It’s also possible to filter on the markets and bookmakers you wish to see.&#x20;

## Step 4: Make your request

Ultimately, it’s up to you which bookmakers and markets you want to request. But for now, we’ll go with the following request:

```javascript
https://soccer.sportmonks.com/api/v2.0/fixtures/date/{YYYY-MM-DD}?api_token={API_TOKEN}&include=oddComparison&markets=1,12,28&bookmakers=2,15,97
```

We have included the following bookmakers: bet365, Betfair, and Unibet and the following markets: 3-way result, over/under, and Asian handicap.

## Step 5: The API response

Below we can see the odds of a fixture for the market 3-way result. We can see the bookmakers and their respective odds for a 3-way result. The same data is displayed for the over/under market.

{% tabs %}
{% tab title="Response 3-way result" %}

```javascript
"oddComparison": {
                "data": [
                {
                        "bookmaker_id": 97,
                        "bookmaker_event_id": "1007404195",
                        "market_id": 1,
                        "suspended": false,
                        "odds": [
                            {
                                "value": "1.98",
                                "dp3": "1.980",
                                "us": "-102",
                                "id": "566582618211523",
                                "handicap": null,
                                "total": null,
                                "label": "1",
                                "probability": "50.51%",
                                "american": -103,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.100809",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "value": "3.70",
                                "dp3": "3.700",
                                "us": "270",
                                "id": "566582618231524",
                                "handicap": null,
                                "total": null,
                                "label": "2",
                                "probability": "27.03%",
                                "american": 270,
                                "factional": null,
                                "winning": true,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.100822",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "value": "3.40",
                                "dp3": "3.400",
                                "us": "240",
                                "id": "566582618221525",
                                "handicap": null,
                                "total": null,
                                "label": "X",
                                "probability": "29.41%",
                                "american": 240,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.100831",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            }
                        ]
                    },
                    {
                        "bookmaker_id": 15,
                        "bookmaker_event_id": "30392412",
                        "market_id": 1,
                        "suspended": false,
                        "odds": [
                            {
                                "value": "2.06",
                                "dp3": "2.060",
                                "us": "106",
                                "id": "566582612111523",
                                "handicap": null,
                                "total": null,
                                "label": "1",
                                "probability": "48.54%",
                                "american": 106,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.084430",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "value": "4.00",
                                "dp3": "4.000",
                                "us": "300",
                                "id": "566582612131524",
                                "handicap": null,
                                "total": null,
                                "label": "2",
                                "probability": "25%",
                                "american": 300,
                                "factional": null,
                                "winning": true,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.084452",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "value": "3.65",
                                "dp3": "3.650",
                                "us": "265",
                                "id": "566582612121525",
                                "handicap": null,
                                "total": null,
                                "label": "X",
                                "probability": "27.4%",
                                "american": 265,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.084466",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            }
                        ]
                    },
```

{% endtab %}

{% tab title="Response Over/Under" %}

```javascript
  "oddComparison": {
                "data": [
                    {
                        "bookmaker_id": 36,
                        "bookmaker_event_id": "11317959",
                        "market_id": 12,
                        "suspended": false,
                        "odds": [
                            {
                                "value": "2.60",
                                "dp3": "2.600",
                                "us": "160",
                                "id": "5665826522611523",
                                "handicap": null,
                                "total": null,
                                "label": "1",
                                "probability": "38.46%",
                                "american": 160,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.193800",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "value": "4.20",
                                "dp3": "4.200",
                                "us": "320",
                                "id": "5665826522631524",
                                "handicap": null,
                                "total": null,
                                "label": "2",
                                "probability": "23.81%",
                                "american": 320,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.193812",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "value": "2.13",
                                "dp3": "2.130",
                                "us": "113",
                                "id": "5665826522621525",
                                "handicap": null,
                                "total": null,
                                "label": "X",
                                "probability": "46.95%",
                                "american": 112,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.193821",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            }
                        ]
                    },
```

{% endtab %}

{% tab title="Response Asian Handicap" %}

```javascript
  "oddComparison": {
                "data": [                    
                    {
                        "bookmaker_id": 15,
                        "bookmaker_event_id": "30392412",
                        "market_id": 28,
                        "suspended": false,
                        "odds": [
                            {
                                "handicap": null,
                                "value": "2.41",
                                "dp3": "2.410",
                                "us": "141",
                                "id": "566582642111528",
                                "total": null,
                                "label": "1",
                                "probability": "41.49%",
                                "american": 141,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.160122",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "handicap": null,
                                "value": "8.68",
                                "dp3": "8.680",
                                "us": "768",
                                "id": "566582642121549",
                                "total": null,
                                "label": "2",
                                "probability": "11.52%",
                                "american": 768,
                                "factional": null,
                                "winning": true,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.160354",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "handicap": null,
                                "value": "2.27",
                                "dp3": "2.270",
                                "us": "127",
                                "id": "566582642121539",
                                "total": null,
                                "label": "2",
                                "probability": "44.05%",
                                "american": 127,
                                "factional": null,
                                "winning": true,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.160301",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
                            {
                                "handicap": null,
                                "value": "1.41",
                                "dp3": "1.410",
                                "us": "-244",
                                "id": "566582642111540",
                                "total": null,
                                "label": "1",
                                "probability": "70.92%",
                                "american": -244,
                                "factional": null,
                                "winning": false,
                                "stop": false,
                                "last_update": {
                                    "date": "2021-04-07 01:59:35.160308",
                                    "timezone_type": 3,
                                    "timezone": "UTC"
                                }
                            },
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sportmonks.com/v2/how-to-guides/odds-and-predictions/how-to-build-a-betting-odds-portal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
