Contents
Why build a World Cup fantasy game?
The World Cup is the perfect event for fantasy football:
– Global audience: Billions of viewers worldwide, creating a massive potential user base
– Short duration: 4-6 week tournament keeps users highly engaged without season-long fatigue
– High engagement: Matches span multiple time zones with multiple games daily during group stages
– Universal appeal: Even casual fans participate in World Cup fantasy leagues
– Viral potential: Friends, families, and colleagues naturally form competing leagues
What you’ll build
This guide covers building a complete fantasy platform with:
– Player database: All 1,100+ World Cup players with detailed statistics
– Team builder: Squad selection with budget constraints and formation rules
– Live scoring: Real-time points calculation based on player performance
– League management: Private and public leagues with rankings
– Transfer system: Player trades and substitutions between matchdays
– Expected lineups: Predictions for matchday lineups
Prerequisites
Sportmonks API Setup
– Create account: Sign up at my.sportmonks.com
– Choose plan: Select a plan with World Cup 2026 coverage (Season ID: 26618)
– Get API token: Retrieve your authentication token from the dashboard
– Check coverage: Verify you have access to player statistics (goals, assists, ratings, etc.), Live match events, Team squads, Match fixtures and Expected lineups
Required data features
For a complete fantasy experience, ensure your plan includes:
– Detailed player statistics: Goals, assists, clean sheets, cards, minutes played
– Player ratings: Match-by-match performance ratings
– Live updates: Real-time event and statistics updates
– Squad information: Official team squads and player positions
– Expected lineups: Pre-match starting XI predictions (optional but valuable)
Understanding the fantasy football data API
The Sportmonks API is designed for fantasy football, providing all the data you need through a flexible includes system.
Base URL
https://api.sportmonks.com/v3/football
Core Endpoints for Fantasy
Step 1: Building your player database
The foundation of any fantasy game is a comprehensive player database. You need every player participating in the 2026 World Cup, including their statistics, positions, and team affiliations.
Approach: Two-step process
Due to the API including depth limits (maximum 2 nested includes on squads endpoint), you’ll need a two-step process:
- Get basic squad and player information
- Fetch detailed player statistics separately
Step 1.1: Fetch all teams for the World Cup season
First, get all teams participating in the World Cup:
GET https://api.sportmonks.com/v3/football/seasons/26618 ?api_token=YOUR_TOKEN &include=teams
Step 1.2: Fetch each team’s squad with basic player data
For each team, fetch the squad with player profiles (limited to 2 nested includes):
https://api.sportmonks.com/v3/football/squads/seasons/26618/teams/{team_id}
?api_token=YOUR_TOKEN
&include=player.position
This returns squad entries with:
– Player ID, team ID, position ID, jersey number
– Player profile (name, display_name, image_path, height, weight, date_of_birth)
– Player position (goalkeeper, defender, midfielder, attacker)
Step 1.3: Fetch player statistics separately
To get detailed statistics for each player, you have two options:
Option A: Get statistics per player
GET https://api.sportmonks.com/v3/football/players/{player_id}
?api_token=YOUR_TOKEN
&include=statistics.details.type
&filters=playerStatisticSeasons:26618
Option B: Get all statistics via fixtures/lineups (recommended for live data)
During matches, player statistics are available through fixture lineups:
GET https://api.sportmonks.com/v3/football/fixtures/{fixture_id}
?api_token=YOUR_TOKEN
&include=lineups.details.type
This provides match-specific player stats, including goals, assists, ratings, minutes played, and more.
Key statistics for fantasy points
The player stats API provides all the statistics you need for point calculation:
Offensive stats
– Goals scored (type_id: 52)
– Assists (type_id: 79)
– Shots on target (type_id: 45)
– Key passes
Defensive stats
– Clean sheets (for defenders and goalkeepers)
– Tackles
-Interceptions
– Clearances
– Saves (for goalkeepers)
Discipline
– Yellow cards (type_id: 84)
– Red cards (type_id: 83)
– Minutes played (type_id: 119)
Performance
– Match rating (type_id: 118) – Average, highest, and lowest
– Appearances (type_id: 321)
Filtering player statistics
To get only specific statistics and reduce response size:
?include=player.statistics.details.type &filters=playerStatisticSeasons:26618,playerStatisticDetailTypes:52,79,84,83,118
This filters for: goals, assists, yellow cards, red cards, and ratings only.
Step 2: Creating player valuations
Every fantasy game needs a budget system that assigns values to players. Sportmonks provides several data points to help you determine player valuations:
Using player ratings
The rating statistic (type_id: 118) provides an excellent basis for valuation:
{
"type": {
"name": "Rating",
"code": "rating"
},
"value": {
"average": 7.85,
"highest": 9.5,
"lowest": 6.2
}
}
Suggested valuation formula
function calculatePlayerValue(player) {
const rating = player.statistics.details.find(s => s.type_id === 118)?.value.average || 6.0;
const goals = player.statistics.details.find(s => s.type_id === 52)?.value.total || 0;
const assists = player.statistics.details.find(s => s.type_id === 79)?.value.total || 0;
// Base value on rating (60-95M range)
let baseValue = (rating - 5) * 10; // 10M per rating point above 5
// Bonus for goals and assists
const performanceBonus = (goals * 0.5) + (assists * 0.3);
// Position multiplier (attackers are more valuable in fantasy)
const positionMultiplier = {
1: 0.9, // Goalkeeper
2: 1.0, // Defender
3: 1.1, // Midfielder
4: 1.2 // Attacker
}[player.position_id] || 1.0;
return Math.round((baseValue + performanceBonus) * positionMultiplier * 1000000) / 1000000;
}
Alternative: transfer market values
Some fantasy games use real-world transfer values or create tier-based pricing:
Tier system
– Premium Players (9.0+ rating): $12-15M
– Quality Players (7.5-8.9 rating): $8-12M
– Standard Players (6.5-7.4 rating): $5-8M
– Budget Players (<6.5 rating): $4-5M
Step 3: Building the squad selection interface
Users need to build squads within constraints similar to real fantasy games.
Standard fantasy rules
Budget constraint
– Total team budget: $100 million
– Must select exactly 15 players (11 starters + 4 substitutes)
Squad composition
– Goalkeepers: 2
– Defenders: 5
– Midfielders: 5
– Forwards: 3
Team restrictions
– Maximum 3 players from any single World Cup team
– Prevents users from stacking one dominant team
Formation rules
Allow users to choose formations (starters only):
Common formations:
– 4-4-2: 1 GK, 4 DEF, 4 MID, 2 FWD
– 4-3-3: 1 GK, 4 DEF, 3 MID, 3 FWD
– 3-5-2: 1 GK, 3 DEF, 5 MID, 2 FWD
– 3-4-3: 1 GK, 3 DEF, 4 MID, 3 FWD
– 5-3-2: 1 GK, 5 DEF, 3 MID, 2 FWD
Fetching players by position
To display players by position for team building:
GET https://api.sportmonks.com/v3/football/squads/seasons/26618/teams/{team_id}
?api_token=YOUR_TOKEN
&include=player.position
Filter by position_id:|
– 1: Goalkeeper
– 2: Defender
– 3: Midfielder
– 4: Attacker
Step 4: Implementing live scoring
The heart of fantasy football is watching your players earn points in real-time during matches.
Point system design
A typical point system might look like:
All players
– Appearance (60+ minutes): +2 points
– Appearance (less than 60 minutes): +1 point
Goalkeepers & defenders
– Clean sheet (no goals conceded): +4 points
– Goal scored: +6 points
– Assist: +3 points
– Every 3 saves: +1 point
Midfielders
– Clean sheet: +1 point
– Goal scored: +5 points
– Assist: +3 points
Forwards
– Goal scored: +4 points
– Assist: +3 points
All players (Negative)
– Yellow card: -1 point
– Red card: -3 points
– Own goal: -2 points
– Penalty miss: -2 points
– Every 2 goals conceded (GK/DEF): -1 point
Bonus points
– Man of the Match (highest rating): +3 points
– Hat-trick: +3 bonus points
Fetching live match data
During live matches, poll for updates:
GET /v3/football/fixtures/latest ?api_token=YOUR_TOKEN &filters=fixtureSeasons:26618 &include=participants;scores;state;events.player;lineups.details.type;statistics.type
The /fixtures/latest endpoint returns fixtures updated within the last 10 seconds, making it ideal for efficient polling.
Polling strategy
– Poll every 15-30 seconds during live matches
– Use the has_more flag in meta to check for additional updates
– Cache fixture IDs to track which matches are live
Calculating points from match data
Extract fantasy-relevant data from match responses:
function calculateFantasyPoints(fixtureData, playerId) {
let points = 0;
// Find player in lineups
const lineup = fixtureData.lineups.find(l => l.player_id === playerId);
if (!lineup) return 0;
// Minutes played
const minutes = lineup.details.find(d => d.type.code === 'minutes')?.value || 0;
points += minutes >= 60 ? 2 : (minutes > 0 ? 1 : 0);
// Goals
const goals = lineup.details.find(d => d.type.code === 'goals')?.value.scored || 0;
const position = lineup.position_id;
if (position === 1 || position === 2) points += goals * 6; // GK/DEF
else if (position === 3) points += goals * 5; // MID
else points += goals * 4; // FWD
// Assists
const assists = lineup.details.find(d => d.type.code === 'assists')?.value || 0;
points += assists * 3;
// Clean sheet
const goalsConceded = lineup.details.find(d => d.type.code === 'goals-conceded')?.value || 0;
if (goalsConceded === 0 && minutes >= 60) {
if (position === 1 || position === 2) points += 4; // GK/DEF
else if (position === 3) points += 1; // MID
}
// Cards from events
const playerEvents = fixtureData.events.filter(e => e.player_id === playerId);
const yellowCards = playerEvents.filter(e => e.type.code === 'YELLOWCARD').length;
const redCards = playerEvents.filter(e => e.type.code === 'REDCARD').length;
points -= (yellowCards * 1 + redCards * 3);
return points;
}
Real-time points updates
Display live point changes as events happen:
// Poll for updates every 8-10 seconds during live matches
setInterval(async () => {
const updates = await fetch(
`https://api.sportmonks.com/v3/football/livescores/inplay` +
`?api_token=${token}` +
`&filters=fixtureSeasons:26618` +
`&include=participants;scores;state`
);
const data = await updates.json();
// Update fantasy scores for affected fixtures
if (data.data && data.data.length > 0) {
data.data.forEach(fixture => {
updateFantasyScores(fixture);
notifyUsersOfChanges(fixture);
});
}
}, 10000); // Poll every 10 seconds
Note: Use `/livescores/inplay` to get currently live matches, then fetch detailed player data with `/fixtures/{id}` including `lineups.details.type` and `events.player` for point calculation.
Step 5: Using top scorers for Leaderboards
The topscorers API is perfect for displaying tournament leaders and helping users make transfer decisions.
Fetching top scorers
GET /v3/football/topscorers/seasons/26618 ?api_token=YOUR_TOKEN &include=player;participant;type &filters=seasontopscorerTypes:208 &per_page=25
Type IDs
– 208: Goals
– 209: Assists
– 83: Cards (yellow=1 point, red=2 points)
Display tournament leaders
Show top performers across categories:
// Get top scorers
const topScorers = await fetch(
`https://api.sportmonks.com/v3/football/topscorers/seasons/26618` +
`?api_token=${token}&include=player;participant&filters=seasontopscorerTypes:208&per_page=10`
);
// Get top assisters
const topAssisters = await fetch(
`https://api.sportmonks.com/v3/football/topscorers/seasons/26618` +
`?api_token=${token}&include=player;participant&filters=seasontopscorerTypes:209&per_page=10`
);
Response structure:
{
"data": [
{
"id": 1527652,
"season_id": 26618,
"player_id": 154421,
"type_id": 208,
"position": 1,
"total": 8,
"participant_id": 9,
"player": {
"name": "Erling Haaland",
"image_path": "https://cdn.sportmonks.com/images/..."
},
"participant": {
"name": "Norway",
"image_path": "https://cdn.sportmonks.com/images/..."
}
}
]
}
Using top scorers for recommendations
Recommend high-performing players to users:
function getPlayerRecommendations(position, budget) {
// Fetch top scorers for position
const topPlayers = getTopScorersByPosition(position);
// Filter by budget
const affordable = topPlayers.filter(p => p.value <= budget);
// Sort by points per million
return affordable.sort((a, b) => {
const aValue = a.points / (a.value / 1000000);
const bValue = b.points / (b.value / 1000000);
return bValue - aValue;
}).slice(0, 5);
}
Step 6: Expected lineups for strategy
Help users make informed decisions with predicted starting lineups.
Fetching expected lineups
GET /v3/football/expected-lineups/teams/{team_id}
?api_token=YOUR_TOKEN
&include=fixture;expected.player
Using Expected Lineups
Display to users before the deadline:
async function getExpectedStarters(teamId) {
const response = await fetch(
`https://api.sportmonks.com/v3/football/expected-lineups/teams/${teamId}` +
`?api_token=${token}&include=expected.player`
);
const data = await response.json();
// Filter for starting XI
const starters = data.data.expected
.filter(p => p.formation_position <= 11)
.map(p => p.player);
return starters;
}
User benefits
– Know which players are likely to start
– Avoid selecting bench players
– Plan captain choices based on expected starters
Step 7: Performance optimisation
Caching strategy
Static Data (cache for days):
– Player profiles
– Team information
– Season structure
Semi-Static Data (cache for hours):
– Squad lists
– Player statistics (update daily)
– Fixture schedules
Dynamic Data (cache for minutes):
– Expected lineups (update every 2 hours before the match)
– Top scorers (update hourly)
Real-Time Data (no caching):
– Live scores
– Live player statistics
– Live standings
Monetisation strategies
Free-to-play with premium features
Free features
– Join public leagues
– Standard scoring
– Basic statistics
Premium Features ($4.99/tournament):
– Create private leagues
– Advanced statistics and insights
– Ad-free experience
– Early access to expected lineups
– Transfer suggestions powered by AI
Sponsored leagues
Partner with brands to offer:
– Branded prize leagues
– Sponsor-specific scoring bonuses
– Co-marketing opportunities
In-app purchases
– Extra wildcard chips
– League customisation options
– Historical statistics access
– Premium badges and achievements
Best Practices Summary
– Use the squads API to build your player database efficiently
– Poll /fixtures/latest every 15-30 seconds for live updates
– Cache player statistics and only update once daily
– Use topscorers endpoint for leaderboards and recommendations
– Implement expected lineups to help users make informed decisions
– Calculate points server-side to prevent cheating
– Monitor rate limits with the rate_limit object in responses
– Batch API requests where possible to reduce call volume
– Test thoroughly with historical World Cup data
– Optimise database queries for league standings
Common pitfalls to avoid
- Not handling player injuries: Always check lineup data before matches
- Ignoring substitute players: Track bench players who come on
- Inefficient polling: Use /fixtures/latest instead of polling all fixtures
- Poor mobile experience: Most users will access via mobile
- Complicated rules: Keep scoring simple and transparent
- Slow leaderboard updates: Cache league standings and update incrementally
- No social features: Leagues need interaction to stay engaging
- Forgetting time zones: World Cup 2026 spans the USA, Canada, and Mexico time zones
Conclusion
Building a World Cup 2026 fantasy game with the SportMonks API gives you access to professional-grade football data trusted by fantasy platforms worldwide. The API’s comprehensive fantasy football data features, including a detailed player stats API with over 100 statistics, a squads API for complete team rosters, and real-time updates, make it the perfect foundation for an engaging fantasy experience.
By following this guide, you now understand how to:
– Build a complete player database with statistics and valuations
– Implement real-time fantasy scoring with live match data
– Create transfer systems and league management
– Use top scorers and expected lineups for strategic features
– Optimise performance for tournament-scale traffic
– Engage users with social features and notifications
The World Cup 2026 fantasy football opportunity is massive. With 48 teams, billions of viewers, and month-long engagement, your fantasy platform can capture the excitement of the world’s biggest sporting event.
Additional resources
– API Documentation: docs.sportmonks.com/v3
– Fantasy Guide: sportmonks.com/blogs/how-to-build-a-fantasy-game
– ID Finder: my.sportmonks.com/resources/id-finder
– Postman Collection: postman.sportmonks.com
– Support: [email protected]
Ready to launch your World Cup 2026 fantasy game? Sign up for Sportmonks and start building today. The tournament kicks off soon, get your platform ready to engage millions of fantasy football fans worldwide!


