Pre-match card of two teams
const url = 'https://foxleague.ai/api/matches/pre-match-data?home_user_id=1';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://foxleague.ai/api/matches/pre-match-data?home_user_id=1' \ --header 'Authorization: Bearer <token>'The pre-match card of a pairing: for each side its name, badge, formation, overall ratings, record, recent form, rating, league and lineup, plus the head-to-head of the two players. Leave out away_user_id for an AI opponent.
With match_id the card shows the lineups, formations and ratings recorded for that match; an AI opponent keeps its recorded name and rating. Without it the card reads the teams as they are now: an AI opponent is generated afresh and the other side’s lineup and formation stay empty.
Who: a signed-in player who is one of the two sides.
- With
match_id: you play in that ranked or casual match andhome_user_idandaway_user_idare its two sides. A tournament or challenge match answers like an unknown id, before and after its broadcast. - Without
match_id: you are the home side whenaway_user_idis left out; otherwise you are one of the two sides and a match between them exists.
Refusals:
You are not a participant in this match: one of the conditions above fails, including a tournament or challenge match asked by its match id.Home user not found: no account hashome_user_id.Home team not found: the home account has no team.Away user not found: no account hasaway_user_id.Away team not found: the away account has no team.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Account id of the home side.
Account id of the away side; leave it out for an AI opponent.
The match the card is for. With it the card shows what was recorded for that match.
Responses
Section titled “ Responses ”Success or a refusal: read success (the refusals are in the description).
object
A machine-readable reason next to error, set only where the caller must act differently. tx_pending: the payment was not refused but could not be verified yet; keep the transaction hash and confirm again with the same hash, never pay twice.
The answer. Present when success is true.
object
The away side.
object
Badge URI; absent when the team has none (always for an AI team).
Rating; the one recorded for the match when the card is for a match.
Formation, for example 4-3-3; empty when not known.
The team’s place on the leaderboard (1 is first), by the same ranking as GET /api/leaderboard. Absent for an AI side or when it cannot be read.
How many teams the leaderboard holds, as total in GET /api/leaderboard. Present with leaderboard_place.
League: Bronze, Silver, Gold, Platinum or Diamond.
The lineup, in slot order; empty when not known.
A player on a pre-match card.
object
Country index; 0 for an AI player.
The player’s name.
Overall rating: the average of the seven attributes.
GK, DEF, MID or FWD; an AI player reads Goalkeeper, Defender, Midfielder or Forward.
Common, Uncommon, Rare, Epic or Legendary.
Shirt number.
Latest results whose match is public, newest first: W, D or L, at most 5. An AI team shows five generated results.
The player’s wins, draws and losses. An AI team shows a generated record.
object
Draws.
Losses.
Wins.
Average overall of the five best players, one decimal.
Team name.
Average overall of the listed players, one decimal.
The record between the two players.
object
Matches the away side won.
Draws.
Matches the home side won.
Matches between the two players whose result is public, developer tournaments left out; 0 against an AI team.
The home side.
object
Badge URI; absent when the team has none (always for an AI team).
Rating; the one recorded for the match when the card is for a match.
Formation, for example 4-3-3; empty when not known.
The team’s place on the leaderboard (1 is first), by the same ranking as GET /api/leaderboard. Absent for an AI side or when it cannot be read.
How many teams the leaderboard holds, as total in GET /api/leaderboard. Present with leaderboard_place.
League: Bronze, Silver, Gold, Platinum or Diamond.
The lineup, in slot order; empty when not known.
A player on a pre-match card.
object
Country index; 0 for an AI player.
The player’s name.
Overall rating: the average of the seven attributes.
GK, DEF, MID or FWD; an AI player reads Goalkeeper, Defender, Midfielder or Forward.
Common, Uncommon, Rare, Epic or Legendary.
Shirt number.
Latest results whose match is public, newest first: W, D or L, at most 5. An AI team shows five generated results.
The player’s wins, draws and losses. An AI team shows a generated record.
object
Draws.
Losses.
Wins.
Average overall of the five best players, one decimal.
Team name.
Average overall of the listed players, one decimal.
Why the request was refused, in plain words. Present when success is false.
true when the request did what it asked. false is a refusal: read error.
Example
{ "data": { "away": { "badge": "ipfs://bafybeih5jkqz2o4r7wq3a6sxn4kq2l3m5ve6yt7ofsbc2j3dw2p3wrzwxa/badge.png", "elo_rating": 1261, "formation": "4-4-2", "league": "Silver", "players": [ { "country": 19, "name": "Teo Brandt", "overall": 65, "position": "GK", "rarity": "Rare", "shirt_number": 1 } ], "recent_form": [ "L", "W", "W", "W", "D" ], "record": { "drawn": 6, "lost": 11, "won": 20 }, "stars_overall": 69.4, "team_name": "Night Owls", "team_overall": 62.8 }, "head_to_head": { "away_wins": 1, "draws": 1, "home_wins": 1, "last_result": { "away_score": 2, "date": "2026-09-27", "home_score": 2 }, "total_matches": 3 }, "home": { "badge": "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/badge.png", "elo_rating": 1254, "formation": "4-3-3", "league": "Silver", "players": [ { "country": 12, "name": "Vulpes Keeper", "overall": 63, "position": "GK", "rarity": "Uncommon", "shirt_number": 1 }, { "country": 31, "name": "Ion Lupu", "overall": 59, "position": "DEF", "rarity": "Common", "shirt_number": 4 }, { "country": 7, "name": "Marco Vela", "overall": 71, "position": "FWD", "rarity": "Rare", "shirt_number": 9 } ], "recent_form": [ "W", "L", "W", "D", "W" ], "record": { "drawn": 4, "lost": 9, "won": 12 }, "stars_overall": 68.2, "team_name": "Red Foxes", "team_overall": 61.4 } }, "success": true}No valid session. The body is plain text: Missing Authorization header, Invalid Authorization format, Invalid session token or Session expired or invalid. Sign in again.
Example
Session expired or invalid