Live now!

Progress of current post

Harness the Power of Sportmonks’ Football API with GO

GO is a versatile and powerful programming language that allows programmers to build dynamic cloud, web applications, and web services, among many others. In this guide, we’ll explore how to harness the capabilities of Sportmonks Football API using GO. Our football API covers as many as 2,200 leagues, including the Premier League, Serie A, Bundesliga, and La LigaLigue 1 is also offered.

Time to read 15 min
Published 26 August 2024
Last updated 14 March 2025
Wesley Van Rooij
Harness the Power of Sportmonks’ Football API with GO
Contents

Having appeared in late 2009, GO’s speed and extensive documentation empowers it an ideal choice for accessing our API, which offers more than 60 endpoints, making it the perfect tool for rookies and seasoned programmers alike.

So, no matter your skillset or comfort zone in programming, you too can build an eye-catching app for betting, fantasy football, or match analysis.

While we have many well-written blogs on harnessing the power of Sportmonks API using multiple programming languages such as Python, PHP, and Java, in this blog we will focus on GO.

Why Choose Sportmonks’ Football API?

Sportmonks’ Football API offers a comprehensive set of endpoints with quality data at pocket-friendly prices, which you can easily integrate with minimal effort. We provide more than 60 endpoints, covering leagues, teams, matches, players, and much more.

Our well-thought-out flexible API allows you to interact with these endpoints to retrieve up-to-date information for as many as 2,200 leagues, eye-catching data for mind-blowing mobile apps, and football-related services for professionals and fans alike.

Our unbeatable coverage for the Premier League, Serie A, Ligue 1, UEFA Champions League, and continental football competitions such as the European Championship has attracted as many as 30,000 users.

We will go through a number of subtopics to help you navigate conveniently.

Why GO?

Originally published in November 2009, GO is an open-source programming language that was developed by a team at Google. With code efficiency, quick turnaround time, and faster software development, GO is an ideal choice for many forward-thinking companies, with the likes of Google, Apple, and Facebook being a few of the companies where it is in use.

GO is concise, fast, clean, and efficient and compiles quickly to machine code. An extensive depth of its standard library such as HTTP requests and JSON makes it ideal for easy interaction with web APIs such as our robust Football API.

What is possible with GO?

With GO, you can build cloud, network, command line interfaces and also web services. Thanks to its memory performance and support for several IDEs, GO can be used in building fast and scalable web applications. While programming can be daunting for many, GO’s extensive documentation comes in handy for rookie programmers, mid-level skilled and seasoned developers.

By harnessing the power of GO, developers can efficiently integrate Sportmonks’ Football API into their projects to query more than 60 endpoints.

Here WE GO!

In the following chapters, we’ll guide you through setting up your development environment, making basic API requests, retrieving information about football leagues, fetching matches, and incorporating odds data.

In each chapter, we will feature practical examples and code snippets to illustrate key concepts and also help you understand how to use Sportmonks’ API with GO. Each chapter will leave you with the knowledge and skills to harness Sportmonks’ Football API’s full potential.

And in the familiar catchphrase of the well-known Italian transfer journalist Fabrizio Romano, ‘Here We GO.’

Chapter 1: Setting up your environment

Successfully using Sportmonks’ Football API with GO requires setting up your environment correctly. This chapter will guide you through those important steps.

1.1 Installing GO.

To begin, make sure you install the proper release suitable for your system; options are available for Linux, Mac & Windows from GO’s website.

Follow the instructions for your preferred version based on your operating system. As an alternative, you can install an IDE to get you up and running. Head over to JetBrains GoLang and download the IDE. You can also choose to download Visual Studio Code (VS Code) developed by Microsoft. While running your GO code on VS Code might require futher installation, VS Code is an IDE with support for as many languages including PHP, C#, C++, Python and of course GO.

1.2 Initializing your GO environment

Now that you have a proper working environment to run your GO code depending on whatever option you chose. Let’s get on with the task at hand. To make request to Sportmonks Football API, you will need the HTTP package. An HTTP package forms part of GO’s library, allowing clients to make HTTP requests.

In addition, you will need to initialize your environment by importing the required libraries.

package main  
import (   

"fmt"   

"io/ioutil"   

"log"   

"net/http" //http package  

)  

Once you have this in place, get yourself an API Token for authentication.

1.3 Obtaining your API token

To use the API, sign up for a 14-day free trial on Sportmonks and create an API Token, which you must keep private. An API Token is required for authentication and accessing the data endpoints.

More information about authentication is available on our documentation page.

With your environment set up, you’re ready to start making requests to Sportmonks’ Football API.

Chapter 2: Making basic API requests

Wasn’t that easy? Now that you have arrived at Chapter 2, [phew!], let’s dive into getting you up to speed in making API requests to Sportmonks’ Football API using GO.

2.1 Here’s an HTTP Get Request in GO

In the vast universe of APIs, the famous GET request, is considered king. An overview of all endpoints can be found on our documentation page.

In the sample code, replace “API_ENDPOINT_URL_HERE” with the specific football endpoint URL along with your API Token.

package main  
import (  

    "fmt"  

    "io/ioutil"  

    "net/http"  

)  

   

func main() {  

    // URL to send the request to  

    url := "API_ENDPOINT_URL_HERE"  

    // Making the GET request  

    response, err := http.Get(url)  

    if err != nil {  

        fmt.Printf("The HTTP request failed with error: %s\n", err)  

        return  
    }  

    defer response.Body.Close()    

    // Reading the response body  

    body, err := ioutil.ReadAll(response.Body)  

    if err != nil {  

        fmt.Printf("Failed to read response body: %s\n", err)  

        return  

    }  

   

    // Printing the response body  

    fmt.Println(string(body))  

}   

An http.Get(url) sends a GET request to the specified URL. The function returns the expected http.Response or an error. The response contains the server’s response to the request which was made via the url.

2.2 Parsing JSON Responses

Since the response appears in JSON format, we must parse it properly. We will have to make a modification on the previous example of making an HTTP GET request by adding JSON parsing.

We’ll send a request to a URL that returns JSON data and parse that data into a GO struct.

package main    

import (  

"encoding/json"  

"fmt"  

"io/ioutil"  

"net/http"  

) 

// Define a struct that matches the structure of the JSON response.  

type Post struct {  

UserID int `json:"userId"`  

ID int `json:"id"`  

Title string `json:"title"`  

Body string `json:"body"`  

}  

func main() {  

// URL to send the GET request to  

url := "https://jsonplaceholder.typicode.com/posts/1"  

// Create a new HTTP request.  

req, err := http.NewRequest("GET", url, nil)  

if err != nil {  

fmt.Printf("Failed to create request: %s\n", err)  

return  

}  

 // Set custom headers if needed  

req.Header.Set("User-Agent", "Go-http-client/1.1")  

req.Header.Set("Accept", "application/json")  

// Use the default HTTP client to send the request  

client := &http.Client{}  

resp, err := client.Do(req)  

if err != nil {  

fmt.Printf("Failed to make request: %s\n", err)  

return  

}  

defer resp.Body.Close()  

   

// Read the response body  

body, err := ioutil.ReadAll(resp.Body)  

if err != nil {  

fmt.Printf("Failed to read response body: %s\n", err)  

return  

}  

   

// Parse the JSON response into the Post struct  

var post Post  

err = json.Unmarshal(body, &post)  

if err != nil {  

fmt.Printf("Failed to parse JSON response: %s\n", err)  

return  

}  

// Print the parsed data  

fmt.Printf("Post ID: %d\n", post.ID)  

fmt.Printf("Title: %s\n", post.Title)  

fmt.Printf("Body: %s\n", post.Body)  

} 

2.2.1 A quick Explanation

You need to define a Post struct that matches the JSON structure of the response you expect from the HTTP Get request. Use struct tags like `json:”userId”` to map JSON fields to struct fields. These tags tell the json package which JSON field corresponds to which struct field.

After getting the response, read the body using ioutil.ReadAll.

Use json.Unmarshal(body, &post) to parse the JSON data into the Post struct. The Unmarshal function takes the JSON data and a pointer to a struct, map, or interface where the data should be stored.

Once the JSON is successfully parsed, you can easily access the data using the struct fields (post.ID, post.Title, post.Body, etc.).

Chapter 3: Retrieving league information

In this chapter, we’ll explore how to retrieve information about football leagues by making a request to the appropriate endpoint. That way we can obtain the relevant data about many of the different leagues Sportmonks provides.

3.1 Understanding the structure of league data

Before making any attempt to retrieve league information, it is advised that the structure of the JSON data to be returned by our Football API is understood.

Each league object typically contains details such as the league ID, name, and country, just to mention a few. Here is the url.https://api.sportmonks.com/v3/football/leagues?api_token=API_TOKEN

You may go ahead and paste this url on your browser’s address bar; replace the API_TOKEN with your actual API Token. Should your token be compromised, you could easily delete it and create a new one on your Sportmonks account.

3.2 Implementing a function to retrieve All Leagues

We’ll create a function in GO to get all available leagues from our Football API.

This function will send a GET request to the league endpoint and parse the JSON response to extract the list of requested leagues. We can retrieve and display detailed information for each league that our subscription supports by iterating through the list of leagues and accessing their respective fields.

package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

// Define structs to match the expected JSON response from the API
type League struct {
	ID             int    `json:"id"`
	Sport_id       int    `json:"sport_id"`
	Country_id     int    `json:"country_id"`
	Name           string `json:"name"`
	Active         bool   `json:"active"`
	Short_code     string `json:"short_code"`
	Image_path     string `json:"image_path"`
	Type           string `json:"type"`
	Sub_type       string `json:"sub_type"`
	Last_played_at string `json:"last_played_at"`
	Category       int    `json:"category"`
}

type ApiResponse struct {
	Data []League `json:"data"`
}

func main() {
	// URL to send the GET request to
	
      url := "https://api.sportmonks.com/v3/football/leagues?api_token=YOUR_API_KEY"  
	// Create a new HTTP request
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		fmt.Printf("Failed to create request: %s\n", err)
		return
	}

	// Set custom headers if needed
	req.Header.Set("User-Agent", "Go-http-client/1.1")
	req.Header.Set("Accept", "application/json")

	// Use the default HTTP client to send the request
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Printf("Failed to make request: %s\n", err)
		return
	}
	defer resp.Body.Close()

	// Check the HTTP response status
	if resp.StatusCode != http.StatusOK {
		fmt.Printf("Unexpected status code: %d\n", resp.StatusCode)
		return
	}

	// Read the response body
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("Failed to read response body: %s\n", err)
		return
	}

	// Parse the JSON response into the ApiResponse struct
	var apiResponse ApiResponse
	err = json.Unmarshal(body, &apiResponse)
	if err != nil {
		fmt.Printf("Failed to parse JSON response: %s\n", err)
		return
	}

	// Print the parsed data

	fmt.Print("Leagues:\n")
	for _, League := range apiResponse.Data {
		fmt.Printf("ID: %d\n", League.ID)
		fmt.Printf("Sport_id: %d\n", League.Sport_id)
		fmt.Printf("Country_id: %d\n", League.Country_id)
		fmt.Printf("Name: %s\n", League.Name)
		fmt.Printf("Active: %t\n", League.Active)
		fmt.Printf("Short_code: %s\n", League.Short_code)
		fmt.Printf("Image_path: %s\n", League.Image_path)
		fmt.Printf("Type: %s\n", League.Type)
		fmt.Printf("Sub_type: %s\n", League.Sub_type)
		fmt.Printf("Last_played_at: %s\n", League.Last_played_at)
		fmt.Printf("Category: %d\n", League.Category)
		fmt.Printf("---\n")
	}
}

Leagues:
ID: 8
Sport_id: 1
Country_id: 462
Name: Premier League
Active: true
Short_code: UK PL
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/8/8.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-25 15:30:00
Category: 1
---
ID: 72
Sport_id: 1
Country_id: 38
Name: Eredivisie
Active: true
Short_code: NLD E
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/72.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-25 14:45:00
Category: 1
---
ID: 82
Sport_id: 1
Country_id: 11
Name: Bundesliga
Active: true
Short_code: GER BI
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/18/82.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-25 15:30:00
Category: 1
---
ID: 271
Sport_id: 1
Country_id: 320
Name: Superliga
Active: true
Short_code: DNK SL
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/271.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-26 17:00:00
Category: 2
---
ID: 301
Sport_id: 1
Country_id: 17
Name: Ligue 1
Active: true
Short_code: FRA L1
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/13/301.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-25 18:45:00
Category: 1
---
ID: 384
Sport_id: 1
Country_id: 251
Name: Serie A
Active: true
Short_code: ITA SA
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/0/384.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-26 18:45:00
Category: 1
---
ID: 462
Sport_id: 1
Country_id: 20
Name: Liga Portugal
Active: true
Short_code: PRT PL
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/14/462.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-25 19:30:00
Category: 1
---
ID: 501
Sport_id: 1
Country_id: 1161
Name: Premiership
Active: true
Short_code: SCO P
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/501.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-25 14:00:00
Category: 2
---
ID: 564
Sport_id: 1
Country_id: 32
Name: La Liga
Active: true
Short_code: ESP PL
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/20/564.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-29 19:30:00
Category: 1
---
ID: 600
Sport_id: 1
Country_id: 404
Name: Super Lig
Active: true
Short_code: TUR SL
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/24/600.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-25 18:45:00
Category: 2
---
ID: 636
Sport_id: 1
Country_id: 44
Name: Liga Profesional de Fútbol
Active: true
Short_code: ARG PD
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/28/636.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-27 00:00:00
Category: 2
---
ID: 648
Sport_id: 1
Country_id: 5
Name: Serie A
Active: true
Short_code: BRA CB
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/648.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-28 22:30:00
Category: 2
---
ID: 672
Sport_id: 1
Country_id: 353
Name: Liga BetPlay
Active: true
Short_code: COL PA
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/0/672.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-29 01:30:00
Category: 4
---
ID: 743
Sport_id: 1
Country_id: 458
Name: Liga MX
Active: true
Short_code: MEX AL
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/7/743.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-25 18:00:00
Category: 2
---
ID: 764
Sport_id: 1
Country_id: 338
Name: Primera Division
Active: true
Short_code: PER PD
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/28/764.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-27 01:00:00
Category: 3
---
ID: 779
Sport_id: 1
Country_id: 3483
Name: Major League Soccer
Active: true
Short_code: USA MLS
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/11/779.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-28 23:30:00
Category: 2
---
ID: 989
Sport_id: 1
Country_id: 5618
Name: Super League
Active: true
Short_code: CHN SL
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/29/989.png
Type: league
Sub_type: domestic
Last_played_at: 2024-08-17 12:00:00
Category: 4
---
ID: 1356
Sport_id: 1
Country_id: 98
Name: A-League Men
Active: true
Short_code: AUS AL
Image_path: https://cdn.sportmonks.com/images/soccer/leagues/12/1356.png
Type: league
Sub_type: domestic
Last_played_at: 2024-05-25 09:45:00
Category: 2
---

Easy Peasy, Lemon Squeezy, eh?! Moments ago, querying our API appeared daunting. Now all you have to do is copy and paste the code above. But it doesn’t stop there. Now let’s add another notch to your belt. In the next section, we will fetch data for each match.

Chapter 4: Fetching Match Data

We will now focus on fetching match data from Sportmonks’ API using GO. This will retrieve information about matches based on different parameters such as league, date, and match status.

4.1 Exploring Match Endpoints

While we provide 60+ endpoints, including match data, which covers match status such as upcoming matches, finished matches, and matches by specific parameters. We will take a look at how to retrieve data from some of these endpoints.

4.2 How to Retrieve Match Information

We will write another function in GO to retrieve fixtures from the 30th of August until the 3rd of September 2024 for the Premier League with player, team information, venue, and more.

Here is the URL to retrieve match information for a specific league. In this case, the Premier League (ID 8), as seen below.

https://api.sportmonks.com/v3/football/fixtures/between/2024-08-30/2024-09-03?api_token=YOUR_API_KEY&filters=fixtureLeagues:8

All you need to do is make a few changes to our previous piece of code and you should be ready to GO (pun intended). Replace the URL with the match endpoint URL and ‘YOUR_API_KEY’ with your actual Sportmonks API Token for authentication.

package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

// Define structs to match the expected JSON response from the API
type Fixture struct {
	Id                  int    `json:"id"`
	SportId             int    `json:"sport_id"`
	LeagueId            int    `json:"league_id"`
	SeasonId            int    `json:"season_id"`
	StageId             int    `json:"stage_id"`
	GroupId             int    `json:"group_id"`
	AggregateId         int    `json:"aggregate_id"`
	RoundId             int    `json:"round_id"`
	StateId             int    `json:"state_id"`
	VenueId             int    `json:"venue_id"`
	Name                string `json:"name"`
	StartingAt          string `json:"starting_at"`
	ResultInfo          string `json:"result_info"`
	Leg                 string `json:"leg"`
	Details             string `json:"details"`
	Length              int    `json:"length"`
	Placeholder         bool   `json:"placeholder"`
	HasOdds             bool   `json:"has_odds"`
	HasPremiumOdds      bool   `json:"has_premium_odds"`
	StartingAtTimestamp int    `json:"starting_at_timestamp"`
}

type ApiResponse struct {
	Data []Fixture `json:"data"`
}

func main() {
	// URL to send the GET request to with filtering by league_id

	url := fmt.Sprintf("https://api.sportmonks.com/v3/football/fixtures/between/2024-08-30/2024-09-03?api_token=YOUR_API_KEY&filters=fixtureLeagues:8")
	//Example league ID to filter by

	// Create a new HTTP request
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		fmt.Printf("Failed to create request: %s\n", err)
		return
	}

	// Set custom headers if needed
	req.Header.Set("User-Agent", "Go-http-client/1.1")
	req.Header.Set("Accept", "application/json")

	// Use the default HTTP client to send the request
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Printf("Failed to make request: %s\n", err)
		return
	}
	defer resp.Body.Close()

	// Check the HTTP response status
	if resp.StatusCode != http.StatusOK {
		fmt.Printf("Unexpected status code: %d\n", resp.StatusCode)
		return
	}

	// Read the response body
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("Failed to read response body: %s\n", err)
		return
	}

	// Parse the JSON response into the ApiResponse struct
	var apiResponse ApiResponse
	err = json.Unmarshal(body, &apiResponse)
	if err != nil {
		fmt.Printf("Failed to parse JSON response: %s\n", err)
		return
	}

	fmt.Print("Fixtures:\n")
	for _, Fixture := range apiResponse.Data {
		fmt.Printf("Id: %d\n", Fixture.Id)
		fmt.Printf("SportId: %d\n", Fixture.SportId)
		fmt.Printf("LeagueId: %d\n", Fixture.LeagueId)
		fmt.Printf("SeasonId: %d\n", Fixture.SeasonId)
		fmt.Printf("StageId: %d\n", Fixture.StageId)
		fmt.Printf("GroupId: %d\n", Fixture.GroupId)
		fmt.Printf("AggregateId: %d\n", Fixture.AggregateId)
		fmt.Printf("RoundId: %d\n", Fixture.RoundId)
		fmt.Printf("StateId: %d\n", Fixture.StateId)
		fmt.Printf("VenueId: %d\n", Fixture.VenueId)
		fmt.Printf("Name: %s\n", Fixture.Name)
		fmt.Printf("StartingAt: %s\n", Fixture.StartingAt)
		fmt.Printf("ResultInfo: %s\n", Fixture.ResultInfo)
		fmt.Printf("Leg: %s\n", Fixture.Leg)
		fmt.Printf("Details: %s\n", Fixture.Details)
		fmt.Printf("Length: %d\n", Fixture.Length)
		fmt.Printf("Placeholder: %t\n", Fixture.Placeholder)
		fmt.Printf("HasOdds: %t\n", Fixture.HasOdds)
		fmt.Printf("HasPremiumOdds: %t\n", Fixture.HasPremiumOdds)
		fmt.Printf("StartingAtTimestamp: %d\n", Fixture.StartingAtTimestamp)
		fmt.Printf("---\n")
	}
}
Fixtures:
Id: 19134473
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 204
Name: Arsenal vs Brighton & Hove Albion
StartingAt: 2024-08-31 11:30:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725103800
---
Id: 19134474
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 338817
Name: Brentford vs Southampton
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
Id: 19134476
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 12
Name: Everton vs AFC Bournemouth
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
Id: 19134477
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 504
Name: Ipswich Town vs Fulham
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
Id: 19134478
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 117
Name: Leicester City vs Aston Villa
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
Id: 19134481
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 542
Name: Nottingham Forest vs Wolverhampton Wanderers
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
Id: 19134482
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 214
Name: West Ham United vs Manchester City
StartingAt: 2024-08-31 16:30:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725121800
---
Id: 19134475
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 321614
Name: Chelsea vs Crystal Palace
StartingAt: 2024-09-01 12:30:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725193800
---
Id: 19134480
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 449
Name: Newcastle United vs Tottenham Hotspur
StartingAt: 2024-09-01 12:30:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725193800
---
Id: 19134479
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 206
Name: Manchester United vs Liverpool
StartingAt: 2024-09-01 15:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725202800
---

Chapter 5: Integrating Odds Data

It’s time to add a feather to your cap! In this chapter, we will take a look at how to retrieve odds data from Sportmonks API using GO. This will be the final exercise in this blog, but not to worry, we’ve got several other how-tos on easily retrieving data from our API.

5.1 Fetching Odds for Upcoming Matches

We’ll implement functions in GO to retrieve odds data for upcoming matches in the Premier League. Just like we did in Chapter 4, these functions will send GET requests to the appropriate endpoint and parse the JSON responses to display odds information, alongside others.

Here is the query that retrieves odds data.

https://api.sportmonks.com/v3/football/fixtures/18854206?api_token=YOUR_API_KEY&include=odds&filters=bookmakers:2;markets:1

package main

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

// Define structs to match the expected JSON response from the API

type Participant struct {
	Id           int    `json:"id"`
	SportId      int    `json:"sport_id"`
	CountryId    int    `json:"country_id"`
	VenueId      int    `json:"venue_id"`
	Gender       string `json:"gender"`
	Name         string `json:"name"`
	ShortCode    string `json:"short_code"`
	ImagePath    string `json:"image_path"`
	Founded      int    `json:"founded"`
	Type         string `json:"type"`
	Placeholder  bool   `json:"placeholder"`
	LastPlayedAt string `json:"last_played_at"`
}

type Odds struct {
	Id                    int64  `json:"id"`
	FixtureId             int    `json:"fixture_id"`
	MarketId              int    `json:"market_id"`
	BookmakerId           int    `json:"bookmaker_id"`
	Label                 string `json:"label"`
	Value                 string `json:"value"`
	Name                  string `json:"name"`
	SortOrder             int    `json:"sort_order"`
	MarketDescription     string `json:"market_description"`
	Probability           string `json:"probability"`
	Dp3                   string `json:"dp3"`
	Fractional            string `json:"fractional"`
	American              string `json:"american"`
	Winning               bool   `json:"winning"`
	Stopped               bool   `json:"stopped"`
	Total                 string `json:"total"`
	Handicap              string `json:"handicap"`
	Participants          string `json:"participants"`
	CreatedAt             string `json:"created_at"`
	OriginalLabel         string `json:"original_label"`
	LatestBookmakerUpdate string `json:"latest_bookmaker_update"`
}

type Fixture struct {
	Id                  int           `json:"id"`
	SportId             int           `json:"sport_id"`
	LeagueId            int           `json:"league_id"`
	SeasonId            int           `json:"season_id"`
	StageId             int           `json:"stage_id"`
	GroupId             int           `json:"group_id"`
	AggregateId         int           `json:"aggregate_id"`
	RoundId             int           `json:"round_id"`
	StateId             int           `json:"state_id"`
	VenueId             int           `json:"venue_id"`
	Name                string        `json:"name"`
	StartingAt          string        `json:"starting_at"`
	ResultInfo          string        `json:"result_info"`
	Leg                 string        `json:"leg"`
	Details             string        `json:"details"`
	Length              int           `json:"length"`
	Placeholder         bool          `json:"placeholder"`
	HasOdds             bool          `json:"has_odds"`
	HasPremiumOdds      bool          `json:"has_premium_odds"`
	StartingAtTimestamp int           `json:"starting_at_timestamp"`
	Participants        []Participant `json:"participants"`
	Odds                []Odds        `json:"odds"`
}
type ApiResponse struct {
	Data []Fixture `json:"data"`
}

func main() {
	// URL to send the GET request to
	url := "https://api.sportmonks.com/v3/football/fixtures/between/2024-08-30/2024-09-03?api_token=YOUR_TOKEN&filters=fixtureLeagues:8;bookmakers:2;markets:1&include=participants;odds"

	// Create a new HTTP request
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		fmt.Printf("Failed to create request: %s\n", err)
		return
	}

	// Set custom headers if needed
	req.Header.Set("User-Agent", "Go-http-client/1.1")
	req.Header.Set("Accept", "application/json")

	// Use the default HTTP client to send the request
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Printf("Failed to make request: %s\n", err)
		return
	}

	// Ensure resp is not nil before deferring resp.Body.Close()
	if resp != nil {
		defer resp.Body.Close()
	}

	// Check the HTTP response status
	if resp.StatusCode != http.StatusOK {
		fmt.Printf("Unexpected status code: %d\n", resp.StatusCode)
		return
	}

	// Read the response body
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("Failed to read response body: %s\n", err)
		return
	}

	// Parse the JSON response into the ApiResponse struct
	var apiResponse ApiResponse
	err = json.Unmarshal(body, &apiResponse)
	if err != nil {
		fmt.Printf("Failed to parse JSON response: %s\n", err)
		return
	}

	fmt.Print("Odds:\n")
	for _, Fixture := range apiResponse.Data {
		fmt.Printf("Id: %d\n", Fixture.Id)
		fmt.Printf("SportId: %d\n", Fixture.SportId)
		fmt.Printf("LeagueId: %d\n", Fixture.LeagueId)
		fmt.Printf("SeasonId: %d\n", Fixture.SeasonId)
		fmt.Printf("StageId: %d\n", Fixture.StageId)
		fmt.Printf("GroupId: %d\n", Fixture.GroupId)
		fmt.Printf("AggregateId: %d\n", Fixture.AggregateId)
		fmt.Printf("RoundId: %d\n", Fixture.RoundId)
		fmt.Printf("StateId: %d\n", Fixture.StateId)
		fmt.Printf("VenueId: %d\n", Fixture.VenueId)
		fmt.Printf("Name: %s\n", Fixture.Name)
		fmt.Printf("StartingAt: %s\n", Fixture.StartingAt)
		fmt.Printf("ResultInfo: %s\n", Fixture.ResultInfo)
		fmt.Printf("Leg: %s\n", Fixture.Leg)
		fmt.Printf("Details: %s\n", Fixture.Details)
		fmt.Printf("Length: %d\n", Fixture.Length)
		fmt.Printf("Placeholder: %t\n", Fixture.Placeholder)
		fmt.Printf("HasOdds: %t\n", Fixture.HasOdds)
		fmt.Printf("HasPremiumOdds: %t\n", Fixture.HasPremiumOdds)
		fmt.Printf("StartingAtTimestamp: %d\n", Fixture.StartingAtTimestamp)
		fmt.Printf("---\n")
		for _, Odd := range Fixture.Odds {
			fmt.Printf("	Id: %d\n", Odd.Id)
			fmt.Printf("	FixtureId: %d\n", Odd.FixtureId)
			fmt.Printf("	MarketId: %d\n", Odd.MarketId)
			fmt.Printf("	BookmakerId: %d\n", Odd.BookmakerId)
			fmt.Printf("	Label: %s\n", Odd.Label)
			fmt.Printf("	Value: %s\n", Odd.Value)
			fmt.Printf("	Name: %s\n", Odd.Name)
			fmt.Printf("	SortOrder: %d\n", Odd.SortOrder)
			fmt.Printf("	MarketDescription: %s\n", Odd.MarketDescription)
			fmt.Printf("	Probability: %s\n", Odd.Probability)
			fmt.Printf("	Dp3: %s\n", Odd.Dp3)
			fmt.Printf("	Fractional: %s\n", Odd.Fractional)
			fmt.Printf("	American: %s\n", Odd.American)
			fmt.Printf("	Winning: %t\n", Odd.Winning)
			fmt.Printf("	Stopped: %t\n", Odd.Stopped)
			fmt.Printf("	Total: %s\n", Odd.Total)
			fmt.Printf("	Handicap: %s\n", Odd.Handicap)
			fmt.Printf("	Participants: %s\n", Odd.Participants)
			fmt.Printf("	CreatedAt: %s\n", Odd.CreatedAt)
			fmt.Printf("	OriginalLabel: %s\n", Odd.OriginalLabel)
			fmt.Printf("	LatestBookmakerUpdate: %s\n", Odd.LatestBookmakerUpdate)
			fmt.Printf("	---\n")
		}
	}
}

Odds:
Id: 19134473
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 204
Name: Arsenal vs Brighton & Hove Albion
StartingAt: 2024-08-31 11:30:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725103800
---
	Id: 121282396080
	FixtureId: 19134473
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 7.00
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 14.29%
	Dp3: 7.000
	Fractional: 7
	American: 600
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:36.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:04:01
	---
	Id: 121282396079
	FixtureId: 19134473
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 5.75
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 17.39%
	Dp3: 5.750
	Fractional: 23/4
	American: 475
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:36.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:04:01
	---
	Id: 121282396077
	FixtureId: 19134473
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 1.33
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 75.02%
	Dp3: 1.333
	Fractional: 4/3
	American: -301
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:36.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:04:01
	---
Id: 19134474
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 338817
Name: Brentford vs Southampton
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
	Id: 121282498530
	FixtureId: 19134474
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 4.50
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 22.22%
	Dp3: 4.500
	Fractional: 9/2
	American: 350
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:04:36
	---
	Id: 121282498527
	FixtureId: 19134474
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 4.00
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 25%
	Dp3: 4.000
	Fractional: 4
	American: 300
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:04:36
	---
	Id: 121282498525
	FixtureId: 19134474
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 1.72
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 57.9%
	Dp3: 1.727
	Fractional: 19/11
	American: -138
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:04:36
	---
Id: 19134476
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 12
Name: Everton vs AFC Bournemouth
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
	Id: 121282497676
	FixtureId: 19134476
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 2.55
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 39.22%
	Dp3: 2.550
	Fractional: 51/20
	American: 154
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:04:20
	---
	Id: 121282497675
	FixtureId: 19134476
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 3.40
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 29.41%
	Dp3: 3.400
	Fractional: 17/5
	American: 240
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:04:20
	---
	Id: 121282497674
	FixtureId: 19134476
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 2.75
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 36.36%
	Dp3: 2.750
	Fractional: 11/4
	American: 175
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:04:20
	---
Id: 19134477
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 504
Name: Ipswich Town vs Fulham
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
	Id: 121282498087
	FixtureId: 19134477
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 2.25
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 44.44%
	Dp3: 2.250
	Fractional: 9/4
	American: 125
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:04:28
	---
	Id: 121282498086
	FixtureId: 19134477
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 3.50
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 28.57%
	Dp3: 3.500
	Fractional: 7/2
	American: 250
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:04:28
	---
	Id: 121282498084
	FixtureId: 19134477
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 3.10
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 32.26%
	Dp3: 3.100
	Fractional: 31/10
	American: 210
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:04:28
	---
Id: 19134478
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 117
Name: Leicester City vs Aston Villa
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
	Id: 121282498876
	FixtureId: 19134478
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 1.72
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 57.9%
	Dp3: 1.727
	Fractional: 19/11
	American: -138
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:04:20
	---
	Id: 121282498875
	FixtureId: 19134478
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 3.90
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 25.64%
	Dp3: 3.900
	Fractional: 39/10
	American: 290
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:04:20
	---
	Id: 121282498874
	FixtureId: 19134478
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 4.50
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 22.22%
	Dp3: 4.500
	Fractional: 9/2
	American: 350
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:04:20
	---
Id: 19134481
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 542
Name: Nottingham Forest vs Wolverhampton Wanderers
StartingAt: 2024-08-31 14:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725112800
---
	Id: 121282497262
	FixtureId: 19134481
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 3.60
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 27.78%
	Dp3: 3.600
	Fractional: 18/5
	American: 260
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:04:36
	---
	Id: 121282497261
	FixtureId: 19134481
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 3.70
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 27.03%
	Dp3: 3.700
	Fractional: 37/10
	American: 270
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:04:36
	---
	Id: 121282497260
	FixtureId: 19134481
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 2.00
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 50%
	Dp3: 2.000
	Fractional: 2
	American: 100
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:04:36
	---
Id: 19134482
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 214
Name: West Ham United vs Manchester City
StartingAt: 2024-08-31 16:30:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725121800
---
	Id: 121282394284
	FixtureId: 19134482
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 1.40
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 71.43%
	Dp3: 1.400
	Fractional: 7/5
	American: -251
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:35.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:05:03
	---
	Id: 121282394282
	FixtureId: 19134482
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 5.50
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 18.18%
	Dp3: 5.500
	Fractional: 11/2
	American: 450
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:35.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:05:03
	---
	Id: 121282394281
	FixtureId: 19134482
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 7.00
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 14.29%
	Dp3: 7.000
	Fractional: 7
	American: 600
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:35.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:05:03
	---
Id: 19134475
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 321614
Name: Chelsea vs Crystal Palace
StartingAt: 2024-09-01 12:30:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725193800
---
	Id: 121282498567
	FixtureId: 19134475
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 5.00
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 20%
	Dp3: 5.000
	Fractional: 5
	American: 400
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:06:06
	---
	Id: 121282498566
	FixtureId: 19134475
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 4.33
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 23.08%
	Dp3: 4.333
	Fractional: 13/3
	American: 333
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:06:06
	---
	Id: 121282498565
	FixtureId: 19134475
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 1.60
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 62.5%
	Dp3: 1.600
	Fractional: 8/5
	American: -167
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:06:06
	---
Id: 19134480
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 449
Name: Newcastle United vs Tottenham Hotspur
StartingAt: 2024-09-01 12:30:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725193800
---
	Id: 121282499561
	FixtureId: 19134480
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 2.50
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 40%
	Dp3: 2.500
	Fractional: 5/2
	American: 150
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:06:07
	---
	Id: 121282499560
	FixtureId: 19134480
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 4.00
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 25%
	Dp3: 4.000
	Fractional: 4
	American: 300
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:06:07
	---
	Id: 121282499559
	FixtureId: 19134480
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 2.50
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 40%
	Dp3: 2.500
	Fractional: 5/2
	American: 150
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:43:10.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:06:07
	---
Id: 19134479
SportId: 1
LeagueId: 8
SeasonId: 23614
StageId: 77471288
GroupId: 0
AggregateId: 0
RoundId: 339237
StateId: 1
VenueId: 206
Name: Manchester United vs Liverpool
StartingAt: 2024-09-01 15:00:00
ResultInfo: 
Leg: 1/1
Details: 
Length: 90
Placeholder: false
HasOdds: true
HasPremiumOdds: true
StartingAtTimestamp: 1725202800
---
	Id: 121282408579
	FixtureId: 19134479
	MarketId: 1
	BookmakerId: 2
	Label: Away
	Value: 1.85
	Name: 
	SortOrder: 2
	MarketDescription: Full Time Result
	Probability: 54.05%
	Dp3: 1.850
	Fractional: 37/20
	American: -118
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:39.000000Z
	OriginalLabel: 2
	LatestBookmakerUpdate: 2024-08-30 09:06:27
	---
	Id: 121282408578
	FixtureId: 19134479
	MarketId: 1
	BookmakerId: 2
	Label: Draw
	Value: 4.20
	Name: 
	SortOrder: 1
	MarketDescription: Full Time Result
	Probability: 23.81%
	Dp3: 4.200
	Fractional: 21/5
	American: 320
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:39.000000Z
	OriginalLabel: Draw
	LatestBookmakerUpdate: 2024-08-30 09:06:27
	---
	Id: 121282408576
	FixtureId: 19134479
	MarketId: 1
	BookmakerId: 2
	Label: Home
	Value: 3.70
	Name: 
	SortOrder: 0
	MarketDescription: Full Time Result
	Probability: 27.03%
	Dp3: 3.700
	Fractional: 37/10
	American: 270
	Winning: false
	Stopped: false
	Total: 
	Handicap: 
	Participants: 
	CreatedAt: 2024-08-22T11:42:39.000000Z
	OriginalLabel: 1
	LatestBookmakerUpdate: 2024-08-30 09:06:27
	---

Here’s the wrap: Unlocking the Power of Sportmonks’ Football API with GO

Now that you’ve gone from zero to hero in just a bit while using GO, you can see how easy it is to retrieve data from Sportmonks API. As a summary, let’s go over all we did together.

This developer’s guide covers essential topics such as installing GO, making basic API requests, retrieving league and match data, and incorporating odds information into your applications. We looked at Sportmonks Football API structure and its features while using the HTTP package with GET to retrieve basic information from the web API and the JSON package for handling data for football leagues, match data, and odds.

Those are just a few of the comprehensive set of endpoints that our Football API provides, not to mention news, xG, in-play events, live scores, and many more. Due to its robustness and flexibility, you too can build a mind-blowing football app using the API without breaking the bank.

While these few code snippets can get you up and running in little to no time, GO’s simplicity, readability, and extensive library support enables it as a preferred language of choice among many. GO’s extensive documentation also makes it accessible to users of all skill levels, whether you’re a rookie or programming rock star. Whether you are a sports analyst, journalist, hobbyist, or professional, you too can build the future of sports.

What are you waiting for? Sign up for your free trial now.

Sportmonks’ Football API with Postman

Ready to get started? Read our Postman Guide to help you get started quickly.

FAQ

What data can I access through Sportmonks Football API?
The Football API offers a wide range of football-related data, including match fixtures, live scores, player statistics, team information, standings, and more. You can retrieve data for current and upcoming matches, as well as historical data for past matches, tournaments, and leagues. Please visit our coverage page for an overview of all leagues and features.
Can I customise the data retrieved from Sportmonks Football API?
Yes, you can customise the data retrieved from the Football API to suit your specific requirements. The API allows you to filter data based on various parameters, such as date, team, player, league, and more. Additionally, you can specify which fields you want to include or exclude in the API responses to minimize bandwidth usage and optimize performance. Check our documentation for more information.
Is there a limit to the number of API requests I can make?
We offers different subscription plans with varying levels of access and usage limits. While the Free plan has certain restrictions on the number of API requests allowed per day, higher-tier plans offer increased usage (3,000 API calls per entity per hour) allowances and additional features. If you require more API requests than your current plan allows, you can consider upgrading to a higher-tier plan or contacting support for customised solutions tailored to your needs.
What is an API-token?
Sportmonks makes use of API-tokens for authorization of our API. You are required to add the parameter 'api_token' to your API requests. The parameter's value is the actual token you received when you created it in My Sportmonks. Without this key, you cannot use our APIs.

Written by Wesley Van Rooij

Wesley van Rooij is a marketing and football expert with over 5 years of industry experience. His comprehensive knowledge of the Sportmonks Football API and a focused approach to APIs in the Sports Data industry allow him to offer insights and support to enthusiasts and businesses. His outstanding marketing and communication skills and technical writing expertise enable him to empathise with developers. He understands their needs and challenges to facilitate the development of cutting-edge football applications that stand out in the market.