Markets

After youโ€™ve determined if the bookmaker we have is available, you can check for market availabilities. Just like the bookmakers, the market endpoints will help you set up odds properly on your website/application. This endpoint is very useful for administrative purposes to check and structure the marketsโ€™ availability.

This section will briefly discuss all the options available to request markets.

An overview of all the options available:

  • GET All Markets: returns all the markets available in our football API.

  • GET Markets by ID: returns markets' information from your requested market id.

  • GET Markets by Search by Name: returns the markets that match your search query.

For all the market endpoints the base URL is the same:

https://api.sportmonks.com/v3/odds/markets

Per endpoint the rest of the URL requires additional information. We will explain this per endpoint.

*Important: Please note that the domain in the URL is odds instead of football.

Requesting markets

GET All Markets

he first option is to request all the markets available in our APIs. With this information, you can determine if the markets youโ€™re interested in are available.

The URL to get all markets is the same as the base URL for markets. All you have to do is authorize the request with your API token. Check our authentication section for more info.

https://api.sportmonks.com/v3/odds/markets?api_token=YOUR_TOKEN
Response
{
  "data": [
    {
      "id": 1,
      "legacy_id": 1,
      "name": "Fulltime Result",
      "developer_name": "FULLTIME_RESULT",
      "has_winning_calculations": true
    },
    {
      "id": 2,
      "legacy_id": 63,
      "name": "Double Chance",
      "developer_name": "DOUBLE_CHANGE",
      "has_winning_calculations": false
    },
    {
      "id": 3,
      "legacy_id": null,
      "name": "X Goal",
      "developer_name": "X_GOAL",
      "has_winning_calculations": false
    },
    {
      "id": 4,
      "legacy_id": 28077,
      "name": "Match Goals",
      "developer_name": "MATCH_GOALS",
      "has_winning_calculations": true
    },
    {
      "id": 5,
      "legacy_id": 136703813,
      "name": "Alternative Match Goals",
      "developer_name": "ALTERNATIVE_MATCH_GOALS",
      "has_winning_calculations": true
    },
    {
      "id": 6,
      "legacy_id": 28,
      "name": "Asian Handicap",
      "developer_name": "ASIAN_HANDICAP",
      "has_winning_calculations": false
    },
    //and more

Letโ€™s take a look at what the API returns. You can see the id of the market, the legacy id (what the market id was in our old API), and the market's name. You can also see the indication if the winning odds is calculated during/after the match.

Not all markets we cover have winning odds calculations. Every market has a flag marking whether you can expect winning odds for it.

Now youโ€™ve gathered an overview of the available markets with their unique, you can use this id on the Markets by ID endpoint.

GET Markets by ID

This endpoint returns market' information from your requested market id. All youโ€™ve to do is add the unique id of the market you want.

https://api.sportmonks.com/v3/odds/markets/{market_id}

For example, if youโ€™re interested in the Alternative match goals market (id: 5):

https://api.sportmonks.com/v3/odds/markets/5?api_token=YOUR_TOKEN
Response
{
  "data": {
    "id": 5,
    "legacy_id": 136703813,
    "name": "Alternative Match Goals",
    "developer_name": "ALTERNATIVE_MATCH_GOALS",
    "has_winning_calculations": true
  },

GET Markets by Search by Name

This endpoint returns all the markets based on your search query. This might be handy if you cannot find a market. To search on market name, youโ€™ll need to add /search/{search_query} to the markets base URL:

https://api.sportmonks.com/v3/odds/markets/search/{search_query}

For example, if youโ€™re only interested in markets with โ€œalternativeโ€ in the name, your request will be:

https://api.sportmonks.com/v3/odds/markets/search/alternative?api_token=YOUR_TOKEN
Response
{
  "data": [
    {
      "id": 5,
      "legacy_id": 136703813,
      "name": "Alternative Match Goals",
      "developer_name": "ALTERNATIVE_MATCH_GOALS",
      "has_winning_calculations": true
    },
    {
      "id": 69,
      "legacy_id": 136703825,
      "name": "Alternative Corners",
      "developer_name": "ALTERNATIVE_CORNERS",
      "has_winning_calculations": false
    },
    {
      "id": 81,
      "legacy_id": 137918022,
      "name": "Alternative Total Goals",
      "developer_name": "ALTERNATIVE_TOTAL_GOALS",
      "has_winning_calculations": false
    },
    {
      "id": 94,
      "legacy_id": 137918037,
      "name": "Alternative Handicap Result",
      "developer_name": "ALTERNATIVE_HANDICAP_RESULT",
      "has_winning_calculations": false
    },
    //and more

The more complete your search query is, the more relevant response youโ€™ll get..

Adding useful information

There are no include options available for the market endpoints.

Selecting and filtering

In our filtering tutorial youโ€™ve learnt how to select specific fields or filter only on the data youโ€™re interested in. By default, our API returns a set of data related to the market. We can imagine youโ€™re not interested in all the market data the API returns. Letโ€™s say youโ€™re only interested in the name.

You can add the &select= parameter followed by the fields you want. In our case: name. This results in the below request and response:

https://api.sportmonks.com/v3/odds/markets?api_token=YOUR_TOKEN&select=name
Response
{
  "data": [
    {
      "name": "Fulltime Result",
      "id": 1
    },
    {
      "name": "Double Chance",
      "id": 2
    },
    {
      "name": "X Goal",
      "id": 3
    },
    {
      "name": "Match Goals",
      "id": 4
    },
    {
      "name": "Alternative Match Goals",
      "id": 5
    },
    {
      "name": "Asian Handicap",
      "id": 6
    },
    {
      "name": "Goal Line",
      "id": 7
    },
    //And more

Check our filtering tutorial for more tips and tricks.

Last updated