LogoLogo
Quick StartFootball APIContactAPI 3.0
  • Welcome
  • Changelog
  • Getting Started
    • Get Started
    • Documentation for the documentation
  • Endpoint overview
    • Continents
      • GET All Continents
      • GET Continent by ID
    • Countries
      • GET All Countries
      • GET Country by ID
    • Leagues
      • GET All Leagues
      • GET League by ID
      • GET Leagues by Country ID
      • Search Leagues by Name
    • Seasons
      • GET All Seasons
      • GET Season by ID
    • Fixtures
      • GET Fixture by ID
      • GET Last Updated Fixtures
      • GET Fixtures by Date
      • GET Fixtures by Date Range
      • GET Fixtures by Date Range for Team
      • GET Fixtures by Multiple ID's
      • GET Deleted Fixtures
    • Statistics
    • Livescores
      • GET All Livescores
      • GET All In play Livescores
    • News API
      • GET All News
      • GET News For Upcoming Fixtures
      • GET News by Season ID
    • Commentaries
      • Commentaries by Fixture ID
    • Video Highlights
      • Get Video Highlights by Fixture ID
    • Head 2 Head
      • GET Head 2 Head by Team IDs
    • Standings
      • GET Standings by Season ID
      • GET LIVE Standings
      • GET Standings by Season ID and Round ID
      • GET Standings by Season and Date(time)
      • GET Standings Corrections by Season ID
    • Teams
      • GET Team by ID
      • GET Teams by Country ID
      • GET Teams by Season ID
      • Search Team by Name
      • GET Current Leagues by Team ID
      • Get All Leagues by Team ID
    • Players
      • GET Player by ID
      • GET Players by Country ID
      • Search Player by Name
    • Topscorers
      • GET Topscorers by Season ID
      • GET Topscorers Aggregated by Season ID
    • Rivals
      • GET Rivals by Team ID
    • Venues
      • GET Venue by ID
      • GET Venues by Season ID
    • Rounds
      • GET Rounds by Season ID
      • GET Round by ID
    • Odds
      • GET Odds by Fixture ID and Bookmaker ID
      • GET Odds by Fixture ID and Market ID
      • GET Odds by Fixture ID
      • GET Inplay Odds by Fixture ID
    • Coaches
      • GET Coach by ID
    • Stages
      • GET Stage by ID
      • GET Stages by Season ID
    • Bookmakers
      • GET All Bookmakers by Fixture ID
      • GET All Bookmakers
      • GET Bookmaker by ID
    • Markets
      • GET All Fixtures by Market ID
      • GET All Markets
      • GET Market by ID
    • Team Squads
      • GET Team Squad by Team and Season ID
    • TV Stations
      • GET TV Station by Fixture ID
    • Prediction API
      • GET Leagues and Performances
      • GET Probabilities
      • GET Probabilities by Fixture ID
      • GET Value Bets
      • GET Value Bet by Fixture ID
  • Tutorials
    • Introduction to our API
      • Make your first request
      • Set your time zone
      • Pagination
    • Enriching your response
      • Includes
      • Nested includes
    • Filtering, limiting & sorting
      • Filtering
      • Limiting
      • Sorting
    • Schedule, fixtures & livescores
      • Season schedule
      • Fixtures
      • Livescores
    • Statistics
      • Match statistics
      • Team statistics
      • Player statistics
      • Season statistics
    • League & topscorers standings
      • League standings
      • Topscorers standings
    • Odds & predictions
      • Odds
        • Odds by fixture, bookmaker and market id
        • FlatOdds
        • InplayOdds
      • Predictions
  • MySportmonks
    • How-to build a custom plan
    • ID Finder
  • How-to Guides
    • Get Started with our how-to guides
      • How-to build your API requests
    • Livescores & fixtures
      • How-to build a livescore website
      • How-to build a schedule page
    • Match & team pages
      • How-to build a match page with events and statistics
      • How-to build a match page with line-ups/formations
      • How-to build a team page with season stats and squads
    • How-to build standings and topscorer standings
      • League standings
      • Topscorer standings
    • Odds & predictions
      • How-to build a match page with odds
      • How-to build a betting odds portal
      • How-to use the predictions API
    • How-to build a fantasy game
    • Developer tools
      • How-to use Sportmonks' APIs in Postman
    • How-to keep your database in sync
    • World Cup 2022
    • EURO 2024
    • Football widgets
      • How-to set up football widgets in your web application
      • Configurations
      • Widgets overview
        • Livescore widget
        • International Cup widgets
  • API References
    • API reference guide
    • Data features
    • ID Finder
    • Code libraries
    • Demo response files
    • Statuses and definitions
    • API Rate limiting
    • Response codes
    • Meta description
  • General
  • Sportmonks
  • Plans & pricing
  • FAQ
  • Contact
Powered by GitBook
On this page
  • Step 1: Gather the tools
  • Step 2: Decide which leagues you want to display
  • Step 3: Choose the data you want to show
  • Step 4: Choose the correct endpoint
  • Step 5: Enrichment
  • Step 6: Evaluate the response
  • Step 7: Advanced requests
  • Filtering
  • Country flag

Was this helpful?

Export as PDF
  1. How-to Guides
  2. Livescores & fixtures

How-to build a livescore website

PreviousLivescores & fixturesNextHow-to build a schedule page

Last updated 3 years ago

Was this helpful?

Welcome to our how-to guide about building a livescore website. Livescore websites are one of the most popular applications for . But, what exactly is a livescore website?

As its name suggests, livescore websites are website applications primarily focused on showing the livescores of sports matches. Furthermore, livescores are updated in real-time. So, a football livescore website should, for instance, tell you the real-time live score, minute of the match, current score, and its starting time.

Step 1: Gather the tools

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 in our

Step 2: Decide which leagues you want to display

Now that we have all our tools, we can start planning what we want to show our audience. Which leagues pique your interest? Do you want to show as many leagues as possible? Or do you only want to show specific leagues, like the English Premier League?

These are all things to consider, but you have to make sure that the leagues you choose are available in your plan. See our to see which leagues are included per plan. You can request all the leagues in your current plan via our .

If there are no ongoing matches in your plan, the livescore API will return nothing back.

Step 3: Choose the data you want to show

Now that you have decided on which leagues you would like to show, the next step is to choose what data would be useful to offer.

Most livescore websites show:

  • Date of the match

  • What time the match starts

  • The home and away teams

  • Status of the game: first half, half time, match has ended, minute by minute, etc.

  • Live score

  • Events such as goals, cards

  • Team logos, league logos, country flag

Step 4: Choose the correct endpoint

Our API 2.0 has two endpoints for getting livescores:

The first request will give you all the fixtures of the current day. While the second one will provide you with all the fixtures that are currently in-play.

https://soccer.sportmonks.com/api/v2.0/livescores/now?api_token={API_TOKEN}

Step 5: Enrichment

Now that we have the request ready, it’s time to enrich the URL with various includes, based on the choices you made in step 3.

An example of a very common request is to include home and visitor teams, goals scored, substitutions, and yellow/red cards. For convenience’s sake, we have assembled these three includes into one include called events. However, if you only want to show goals and cards, you can simply replace events with goals and cards.

https://soccer.sportmonks.com/api/v2.0/livescores/now?api_token={API_TOKEN}&include=localTeam,visitorTeam,events
https://soccer.sportmonks.com/api/v2.0/livescores/now?api_token={API_TOKEN}&include=localTeam,visitorTeam,goals,cards

Ultimately, you will be the one to build the livescore website, so feel free to add whatever includes you want. You can add as many or as little as you would like.

Step 6: Evaluate the response

For example, we’ll analyze a match (fixture id: 16475287) in the Scottish Premiership between Celtic (team id: 53) and Hamilton Academical (team id: 338). Below you can find the response with its events. We used the livescore request at the time, but you can refer to the fixture by id request for the same output:

https://soccer.sportmonks.com/api/v2.0/livescores/now?api_token={API_TOKEN}&include=localTeam,visitorTeam,events
https://soccer.sportmonks.com/api/v2.0/fixtures/16475287?api_token={API_TOKEN}&include=localTeam,visitorTeam,events
 "events": {
            "data": [
                {
                    "id": 16475287001,
                    "team_id": "338",
                    "type": "yellowcard",
                    "var_result": null,
                    "fixture_id": 16475287,
                    "player_id": 174161,
                    "player_name": "S. Martin",
                    "related_player_id": null,
                    "related_player_name": null,
                    "minute": 17,
                    "extra_minute": null,
                    "reason": null,
                    "injuried": null,
                    "result": null
                },
                {
                    "id": 16475287002,
                    "team_id": "53",
                    "type": "goal",
                    "var_result": null,
                    "fixture_id": 16475287,
                    "player_id": 96792,
                    "player_name": "O. Édouard",
                    "related_player_id": 173080,
                    "related_player_name": "G. Taylor",
                    "minute": 20,
                    "extra_minute": null,
                    "reason": null,
                    "injuried": null,
                    "result": "1-0"
                },
                {
                    "id": 16475287003,
                    "team_id": "53",
                    "type": "goal",
                    "var_result": null,
                    "fixture_id": 16475287,
                    "player_id": 8403182,
                    "player_name": "J. Frimpong",
                    "related_player_id": 173080,
                    "related_player_name": "G. Taylor",
                    "minute": 31,
                    "extra_minute": null,
                    "reason": null,
                    "injuried": null,
                    "result": "2-0"
                },
                {
                    "id": 16475287004,
                    "team_id": "338",
                    "type": "own-goal",
                    "var_result": null,
                    "fixture_id": 16475287,
                    "player_id": 32761,
                    "player_name": "C. Jullien",
                    "related_player_id": null,
                    "related_player_name": null,
                    "minute": 34,
                    "extra_minute": null,
                    "reason": null,
                    "injuried": null,
                    "result": "2-1"
                },
                {
                    "id": 16475287005,
                    "team_id": "338",
                    "type": "yellowcard",
                    "var_result": null,
                    "fixture_id": 16475287,
                    "player_id": 173774,
                    "player_name": "R. Callachan",
                    "related_player_id": null,
                    "related_player_name": null,
                    "minute": 36,
                    "extra_minute": null,
                    "reason": null,
                    "injuried": null,
                    "result": null
                },
                {
                    "id": 16475287006,
                    "team_id": "338",
                    "type": "substitution",
                    "var_result": null,
                    "fixture_id": 16475287,
                    "player_id": 111635,
                    "player_name": "M. Ogkmpoe",
                    "related_player_id": 173093,
                    "related_player_name": "R. Hughes",
                    "minute": 42,
                    "extra_minute": null,
                    "reason": null,
                    "injuried": null,
                    "result": null

Events will show all the goals, cards, and substitutions. Here we can see that player S. Martin got a yellow card in the 17th minute and that the first goal was made by O. Edouard in the 20th minute for Celtic.

Step 7: Advanced requests

Filtering

https://soccer.sportmonks.com/api/v2.0/livescores/now?api_token={API_TOKEN}&include=localTeam,visitorTeam,events&leagues=8

In the example above, we request all the livescores that are in play, but only for the English Premier League (league id: 8). The main advantage is that the return of data is many times faster than when you request everything available in your plan.

By the same logic, you can also specify specific fixtures:

https://soccer.sportmonks.com/api/v2.0/livescores/now?api_token={API_TOKEN}&include=localTeam,visitorTeam,events&fixtures=16475285

Now, it will only show the fixture with fixture id 16475285.

Country flag

Showing the national flag of a league is always handy. You can request the country flag with a nested include:

https://soccer.sportmonks.com/api/v2.0/livescores/now?api_token={API_TOKEN}&include=localTeam,visitorTeam,events,league.country

All of this seems like a lot of data to request but fear not because our will be able to return all of that data in a speedy and accurate manner. Moreover, the API is highly flexible, since it only returns the data you requested.

If you require more match data such as lineups and match statistics, please refer to the .

In the the fixtures will be available 15 mins before the match has started and 15 mins after it has ended.

In this how-to guide, we’ll go with .

For a full list of possible includes on livescores, see our

Let's say, we want to make a dedicated page just for the (league id: 8) on our livescore website, but our plan has over 600 different leagues. On Saturdays, there are a lot of active games. However, we only want the data pertaining to the English Premier League (league id: 8), so we can filter out everything else. We have discussed filtering in a previous . An example of such a request with filter:

sports data
Developer Tools Guide.
coverage page
get all leagues endpoint
livescore API
how-to build a match page with events and statistics
Livescores
Livescores/now
livescores/now endpoint,
livescores/now endpoint
API reference guide.
English Premier League
tutorial