Skip to content
Player leaderboards

Football cards leaders API for disciplinary leaderboards

Discipline is part of every season story: the midfielder one booking from a ban, the defender with three red cards. The cards feed returns a competition's disciplinary leaderboard as supplied. This page covers labelling, the limits of suspension tracking and how to present disciplinary data without turning it into a hall of shame.

Primary endpoint

GET/api/v1/football/cards

  • leagueId required, numeric string, e.g. 1204

Access: All plans; Starter limited to your five saved leagues. Header: X-API-Key.

Illustration of a referee's notebook and pencil beside two blank card shapes, one amber and one red, on a grass texture.
Disciplinary leaderboards record cards as the source supplies them; suspension rules are separate.
01

A disciplinary leaderboard per competition

The cards feed takes one required parameter, leagueId, a positive numeric competition identifier sent as a string, and returns that competition's disciplinary leaderboard. It is cached for about fifteen minutes. Responses use the standard envelope, with data holding the leaderboard as supplied and meta recording the feed, UTC fetch time, cache time and qualification. Identifiers are strings and source attributes keep their at-sign prefix.

How card types are represented, and whether second yellows that lead to a red are counted separately, is something to read from a real response for the competitions you cover. Label every count with the card type the source gives it. A column headed cards with a single number is ambiguous; a column headed yellow cards or red cards, matching the source, is not.

02

Labels that cannot be misread

Disciplinary numbers are easy to misread because readers bring assumptions. Some assume a red card count includes dismissals for two yellows; some assume it does not. Some assume yellow counts reset at a point in the season; the data does not do that for you. Your labels and a short explanatory note carry the burden of clarity.

Keep the competition visible too. A player's card count in a league says nothing about their cards in a cup, and suspensions in many competitions are tracked per competition. A leaderboard heading that names the competition and season prevents a reader from adding numbers that should not be added.

  • Use the card-type labels the source supplies.
  • Name the competition and season in the heading.
  • Explain how second-yellow dismissals appear, based on your sample.
  • Keep the supplied order rather than re-sorting.
Disciplinary data in contextFlow: request cards by leagueId, label each count by card type as supplied, apply competition suspension rules only from documented rules you hold, and present the list neutrally.01cardsleagueId02Label typesas supplied03Rulesyours, documented04Neutral viewno shaming
Disciplinary data in context. Counts come from the feed; suspension thresholds come from competition rules you document yourself.
03

Suspension tracking needs rules you own

A popular feature is a warning that a player is one booking away from a suspension. The cards feed supplies counts; it does not supply suspension thresholds, amnesty dates or the disciplinary decisions of a competition authority. Those come from the competition's rules, which differ between leagues and can change between seasons.

If you build the feature, document the rules you apply for each competition, cite where they come from, and show the reader that the warning is your calculation. Never state that a player is suspended on the basis of a count alone; a suspension is a decision by a governing body, and the count may not reflect appeals, rescinded cards or other adjustments.

04

Fetching and annotating

The example fetches a cards leaderboard and passes it to a function that adds your own annotations from a rules file you maintain. Keeping the rules in a separate, versioned file makes it obvious which parts of the page come from data and which from your interpretation.

Node.js: supplied counts plus your documented rulesjavascript
const res = await fetch(
  "https://footballapi.net/api/v1/football/cards?leagueId=1204",
  { headers: { "X-API-Key": process.env.FOOTBALLAPI_KEY } },
);
const body = await res.json();
if (!res.ok) throw new Error(`${body.code} ${body.requestId}`);

const rules = await loadRules("1204");          // your own, cited and versioned
const rows = annotate(readRows(body.data), rules); // keep supplied order
await saveLeaderboard("1204", rows, body.meta.fetchedAt);
05

Presenting discipline fairly

A disciplinary leaderboard can easily become a list of villains. Positions and roles shape card counts: defensive midfielders and full-backs collect more bookings than wingers, and a player with many minutes will accumulate more than a substitute. If you present the list, keep the tone neutral. Avoid headlines that rank players as the dirtiest or most reckless on the basis of counts alone.

Context helps. If the source supplies appearances or minutes for the same competition, showing them next to card counts lets readers judge rates for themselves. If you compute a rate, label it as your calculation.

06

Rescinded cards and late changes

Cards are occasionally rescinded on appeal or reassigned when a referee booked the wrong player. Those changes reach the leaderboard only when the source records them, which may be days after the match. Refresh the leaderboard after each round and again a day or two later, and store each copy with its fetch time so you can see when a count went down.

If a card count falls, do not treat it as an error. It is often the most accurate update you will receive.

07

Discipline and officiating are different questions

Card counts are sometimes used to discuss referees: which officials show the most cards, which matches were the most heated. The cards feed is a player leaderboard and does not attribute cards to officials. If you want to write about refereeing, you need other data, and you should be careful that a player-level leaderboard does not become an implied criticism of officials it says nothing about.

Similarly, a team's total cards can be computed by summing player rows that share a club, but that sum is your calculation, and players who moved clubs mid-season will distort it. Label any team totals as derived and explain how transfers are handled.

08

Cards in fantasy scoring

Many fantasy games deduct points for bookings and dismissals. If your tool uses the cards feed to inform those deductions, remember that the leaderboard is a season total, not a per-match record. Per-match scoring needs match-level data, which comes from match statistics or match detail where your plan includes them. Using leaderboard deltas between refreshes to infer which match a card came from is fragile, because corrections and refresh timing can misattribute it.

Use the leaderboard for what it does well: showing who has accumulated the most cards in a competition so far, as the source records it.

09

Compact layouts for small screens

Disciplinary tables have more columns than most leaderboards: one or more card types, perhaps appearances, perhaps your own rate. On a phone, show the player, club and the most important supplied count, and let readers expand a row for the rest. Use text labels rather than coloured squares alone to indicate card types, because colour by itself is not accessible to everyone. A small amber or red marker beside a written label works for all readers.

10

Testing with saved responses

Keep saved cards responses for each competition you cover and test your table component against them, including a response early in a season when lists are short and one where several players share a total. Assert that rows render in the supplied order and that card types are labelled in words. Those tests protect you from regressions when you redesign the table.

11

Metric labels

Always state the competition and the card type in the table heading, so a screenshot shared out of context still makes sense.

12

Plan scope

Cards is league addressed and available on all three plans for entitled leagues. Starter at EUR 29 a month covers your five saved leagues. Growth at EUR 99 and Pro at EUR 249 cover all available package leagues. Player profiles and images for row enrichment are global services not included in Starter.

Refreshing after each round and once more the next day is a handful of successful requests a week per league. Requests above the daily inclusion cost EUR 0.002 each on the monthly EUR invoice; failed and denied requests are not billed. No free trial is offered.

Questions developers ask

Does the cards feed tell me who is suspended?
No. It supplies card counts. Suspensions are decisions by competition authorities under their own rules.
Are second-yellow dismissals counted as reds?
Check how your sample represents them for each competition, and explain it in your labels.
Why did a player's card count go down?
Cards can be rescinded or reassigned after a match. The leaderboard reflects what the source records.
What parameter does cards require?
leagueId, a positive numeric competition identifier sent as a string.
Is the cards feed on Starter?
Yes, for your five saved leagues.

Check the plan before you write the integration.

Starter EUR 29, Growth EUR 99, Pro EUR 249 per month. No free trial. No VAT currently charged.