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
  • What is a fantasy game?
  • Step 1: Determine the league(s)
  • Step 2: Gather the information
  • Season statistics
  • Participating teams and players
  • Player selection and statistics
  • Step 3: It’s kick-off time!
  • Step 4: Determine your fantasy points system
  • Conclusion

Was this helpful?

Export as PDF
  1. How-to Guides

How-to build a fantasy game

PreviousHow-to use the predictions APINextDeveloper tools

Last updated 3 years ago

Was this helpful?

What is a fantasy game?

A popular application for our football data is football fantasy games. Fantasy games are games where participants assemble a cast of real-life characters for a virtual team. This virtual team mimics their real-life counterparts. Everything is statistic-based.

If, for instance, you have Cristiano Ronaldo in your fantasy team and he manages to score a hattrick during an actual match, then this increase in performance will be reflected on your virtual Cristiano Ronaldo.

The player of a fantasy game is able to draft, trade, and drop players from their teams. The end goal is to assemble a team that is able to win the championship, which is very akin to real sports.

In this how-to guide, we’ll show you the most important features of a good sports fantasy game and why our SportMonks APIs are perfectly suited for the job of building a fantasy game.

Step 1: Determine the league(s)

So, you’ve decided to create your own fantasy game. One of the first things you will need to do for yourself is to determine the leagues you want to include in your fantasy game.

Many existing fantasy games base their game on one big league. However, you can also choose to combine multiple leagues.

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

However, please keep in mind that the coverage is not the same for every league.

Step 2: Gather the information

Season statistics

The Season statistics endpoint gives you great insight into how ‘attractive’ the league is. It gives you information about the average goals scored per match, average cards per match, and the average player rating. Especially the average player rating is interesting because you can show your app users this rating. More about this later.

Let’s say you’ve chosen to make a fantasy game for the German Bundesliga (league id: 82). You now need to gather the right information. Since you want to build a live fantasy game, the active season id might be a good starting point.

As you know, you can request the active season id by enriching your request with include=season

https://soccer.sportmonks.com/api/v2.0/leagues/82?api_token={API_TOKEN}&include=season

Now that you have the season's current id, you can request the corresponding information like season statistics, participating teams and, of course, the players.

https://soccer.sportmonks.com/api/v2.0/seasons/17361?api_token={API_TOKEN}&include=stats
https://soccer.sportmonks.com/api/v2.0/leagues/82?api_token={API_TOKEN}&include=season.stats

Now that we have all the season statistics, we need to gather all the teams and the squads participating in this season.

Participating teams and players

https://soccer.sportmonks.com/api/v2.0/teams/season/17361?api_token={API_TOKEN}

This request will give you all the teams participating in this season with their basic team information.

Now, you can also include all the team squads in this season:

https://soccer.sportmonks.com/api/v2.0/teams/season/17361?api_token={API_TOKEN}&include=squad

It might be good to use a nested include as well to get extra player information in the response:

https://soccer.sportmonks.com/api/v2.0/teams/season/17361?api_token={API_TOKEN}&include=squad.player

Now you can show your users all the players that are participating in the season. With this information, you can give the users an overview of the active players, after which they can select their own team.

Player selection and statistics

Now the essential part of a fantasy game: selecting the players. The user can select their own team (i.e. 11 players + 5 on the bench) based on the rules you decide for yourself. Some of the most used key principles:

Set a max of X players of the same team

Naturally, you need to limit the number of players from the same club. You want to avoid that one user chooses the whole squad of Bayern Munich, as they will probably score a lot of points with that team. The game needs to be challenging and fun at the same time. Therefore most existing fantasy games have a rule of max 2 players from the same team. Of course, you can determine your own guidelines.

Value the players

Each player has his own value (€). You need to determine this value yourself, which you can do by using our data. For example, you can look at the player transfer history, but the better option is to look at the player rating of the previous season. E.g. the player rating and stats of Robert Lewandowski (id: 31000) for the 2019/2020 Bundesliga season (id: 16264):

https://soccer.sportmonks.com/api/v2.0/players/31000?api_token={API_TOKEN}&include=stats&seasons=16264

Now you know that he had a rating of 7.67 in the previous season. That’s pretty high. Therefore, he is more valuable (€) than, for instance, a player with an average rating of 5.65. Get the idea?

Determine starting budget

As discussed, some players represent a different value than other players. To avoid users choosing the best players possible, you will need to set a budget. Within this budget, they can select their team.

Players will be restricted by their budget and will have to spend it wisely on a decent team.

Step 3: It’s kick-off time!

Your application users have assembled their dream team. Now it’s time for them to select their starting 11. They will need to know which teams are playing against each other to make their selection. You can retrieve the upcoming season matches for this.

https://soccer.sportmonks.com/api/v2.0/seasons/17361?api_token=YOURTOKEN&include=upcoming

Now, they can determine which players will earn the most points for the upcoming playing round. But how can you assign fantasy points to the players?

Step 4: Determine your fantasy points system

Just like with the player selection, you can decide for yourself what kind of fantasy point system you’re going to apply. Some of the most used key principles are:

Points based on starting eleven

The first and most used method is to assign points to the players that are in the starting eleven. You can see this as a sort of starting bonus. Players who start the game will get an 'X' amount of basic points. This also encourages your users to keep a good eye on the injured/suspended players and the predicted line-up.

You can request the starting eleven with thelineupinclude on our livescores and fixtures endpoints. You need to add thebenchinclude as well if you want the players that are on the bench.

Points based on minutes played

Of course, every player that starts the game deserves some starting points. But what if a player is injured or gets a red card in the first few minutes? Logically speaking, players who do not play the full match receive fewer points. You can see how many minutes a player has played in the stats of each player. You can use the lineup and bench include for this.

Win points based on stats

Also available in the lineup and bench include are the statistics. Players who have scored or assisted a goal earn more fantasy points than players who didn't. It’s good to take the position of a player into consideration as well: a defender who scores or assists with a goal deserves more points than a striker, don’t you think?

Lose points based on stats

A player not only earns points but is also able to lose them. What if they conceded many goals, received a yellow or even a red card? These are all things you need to take into consideration and can be found in the lineup and bench include.

Conclusion

We hope this has given you some inspiration for your own fantasy game. Please do not hesitate to contact our support team with any questions you might have.

With more than 1200+ leagues to choose from, we definitely have one or multiple leagues you can base your fantasy game on. You can request all the leagues we have via our :

For a fantasy game, you want to gather as much data as possible. Therefore, we suggest checking out our and only select leagues with minimum basic player statistics, but detailed statistics are recommended. Of course, for all major leagues, detailed statistics are available.

You can request the season statistics by using the with &include=stats

However, to save yourself from making an extra request, you can also use the nested include season.stats on our

The squads are one of the most important pieces of data you need to gather if you want to build a fantasy game. Eventually, your application users need to select their own team with the players participating in this season. The fastest and most efficient way to retrieve all the teams of one season is to use our

with the upcoming include:

all leagues endpoint
coverage page
season by id endpoint
league by id endpoint:
teams by season id endpoint:
Season by id endpoint