Fantasy Engine Data API 1.0 / Reference
Recipes
Ready-to-use ways of reading the API: a live scoreboard, a season load, the daily player sync, caching, postponed fixtures and odds.
Live scoreboard#
Last updated: 2026-11-25 · v1.0
- Every 30 seconds (no faster than every 15 seconds; the data changes about once a minute) call the
schedule of a small window:
/{sport}/schedule?from=<yesterday>&to=<tomorrow>(UTC days). Yesterday keeps a game that started before 00:00 UTC (US evening games, late soccer) on the board while it runs. With gzip this is a few KB (NBA: 16 KB plain), against 0.2 - 0.9 MB for/schedule/upcoming, which also drops every game at its start. - For each fixture compare
status,status_code,period,clock,score,confirmedwith what you stored. Only when something changed (and the fixture has started) call/{sport}/stats/{id}for the box score. - Show
status_code:in_progress+period+clockwhile in play;finalwithconfirmed: false= "over, result being confirmed" (about 10-15 minutes);confirmed: true= final. Settle bets, contests or fantasy points only onconfirmed: true. - After the confirmation, read
/stats/{id}again about 1 hour and 24 hours later if you score players: late corrections (assists, ratings, stat corrections) movestats_updated_at.
// Live scoreboard of one sport: one small schedule call per pass, /stats only for fixtures that changed.
const BASE = 'https://data.fantasyengine.net/api/feeds';
const KEY = 'YOUR_API_KEY';
const SPORT = 'nba';
const PASS_SECONDS = 30;
const seen = new Map(); // fixture id -> signature of its last state
async function feed(path) {
const res = await fetch(`${BASE}/${path}`, { headers: { 'X-API-KEY': KEY } });
const body = await res.json();
if (!res.ok) throw new Error(`HTTP ${res.status}: ${body.error.message}`);
return body.data;
}
const utcDay = (offsetDays) => new Date(Date.now() + offsetDays * 86400000).toISOString().slice(0, 10);
async function pass() {
// yesterday .. tomorrow (UTC): a game that started before 00:00 UTC is still listed while it runs
const day = await feed(`${SPORT}/schedule?from=${utcDay(-1)}&to=${utcDay(1)}`);
for (const event of day.matches) {
for (const f of event.fixtures) {
const sig = JSON.stringify([f.status, f.status_code, f.period, f.clock, f.score, f.confirmed]);
if (seen.get(f.id) === sig) continue; // nothing new for this fixture
seen.set(f.id, sig);
if (f.status_code === 'scheduled') continue; // no box score before the start
const stats = await feed(`${SPORT}/stats/${f.id}`);
const state = f.confirmed ? 'FINAL (confirmed)'
: f.status_code === 'final' ? 'final, being confirmed'
: `${f.status_code} ${f.period ?? ''} ${f.clock ?? ''}`;
console.log(f.id, f.name, `${f.score?.home ?? '-'}-${f.score?.away ?? '-'}`, state,
`${(stats.player_stats ?? []).length} player lines`, `stats updated ${stats.fixture.stats_updated_at}`);
}
}
}
// a real client loops for ever: setInterval(pass, PASS_SECONDS * 1000)
await pass();
console.log('--- second pass: only changed fixtures are fetched again');
await pass();
Output on a copy of the data taken during an NBA evening (the finals of that copy stay "being confirmed"):
2319 SAC vs MEM 112-123 FINAL (confirmed) 21 player lines stats updated 2026-10-27 02:34:10
2320 CHA vs WSH 110-103 final, being confirmed 21 player lines stats updated 2026-10-27 02:34:08
...
2326 HOU vs ATL 100-93 in_progress Q4 8:28 19 player lines stats updated 2026-10-27 02:34:08
2327 UTAH vs MEM 57-61 in_progress Q3 10:10 23 player lines stats updated 2026-10-27 02:34:08
2328 DEN vs GS 30-24 in_progress Q1 1:20 18 player lines stats updated 2026-10-27 02:34:08
--- second pass: only changed fixtures are fetched again
A game while it is being confirmed (fixture only):
Example answer (being confirmed){
"id": 2324,
"name": "MIL vs IND",
"status": "In Progress",
"status_code": "final",
"status_detail": "Final",
"score": {
"home": 110,
"away": 102,
"detail": {
"ht": null,
"ft": null,
"et": null,
"pen": null,
"winner": "home",
"aggregate_winner": null,
"periods": {
"q1": [31, 29],
"q2": [19, 32],
"q3": [34, 24],
"q4": [26, 17]
}
}
},
"confirmed": false,
"stats_complete": null,
"final_pending": true,
"confirmed_at": null
}
and once confirmed (/nfl/stats/1801):
{
"id": 1801,
"name": "SEA vs KC",
"status": "Final",
"status_code": "final",
"status_detail": "Final",
"score": {
"home": 20,
"away": 3,
"detail": {
"ht": null,
"ft": null,
"et": null,
"pen": null,
"winner": "home",
"aggregate_winner": null,
"periods": {"q1": [0, 0], "q2": [10, 0], "q3": [3, 3], "q4": [7, 0]}
}
},
"round": {"number": 7, "name": "Week 7"},
"season_type": "regular",
"confirmed": true,
"stats_complete": true,
"final_pending": false,
"confirmed_at": "2026-10-26 04:45:18",
"stats_updated_at": "2026-10-26 04:30:09"
}
How often the service refreshes each sport's live data: soccer scores every minute and box scores every 2 minutes; NBA, NFL, MLB, NHL scores and box scores every minute; F1 every minute during a session; PGA and MMA every 2 minutes. Polling faster than that only returns the same data.
Load a season#
Last updated: 2026-11-25 · v1.0
/settings-> the sport keys you want.- Per sport:
/{sport}/teams,/{sport}/players/positions,/{sport}/players,/{sport}/stats_categories. - The fixtures:
/{sport}/schedule?page=1&per_page=500, thenpage=2... untilpage == paging.last_page(kick-off order; one call is enough for most soccer leagues). Or the whole list without parameters, with gzip. - The results so far: for each fixture with
confirmed: truecall/{sport}/stats/{id}(one at a time, or a few in parallel within your limits; a few requests per second is plenty). Odds of the coming days:/{sport}/odds/{id}for fixtures starting in the next 72 hours. - Then keep it current with the daily sync, the scoreboard and a schedule refresh: once a day, and every
6 hours on match days, re-read
/{sport}/schedule?from=<today>(new dates, moved and postponed fixtures).
Only the current season is served: store what you need before a new season starts (a new season gets a
new schedule id, and the old fixtures leave the lists).
Players and injuries, every day#
Last updated: 2026-11-25 · v1.0
The service updates teams, rosters and schedules once a day per sport family, at these UTC times:
| Sports | Daily update (UTC) | Read after | Extra |
|---|---|---|---|
| Soccer | 05:00 | about 05:30 | injuries come with the squads (status out, no note) |
| NBA, NFL, MLB, NHL | 14:00 | about 14:30 | the injury reports of the teams playing in the next 3 hours are re-read every 2 hours (at :30) |
| MMA | 06:30 | about 07:00 | - |
| F1 | 09:00 | about 09:30 | - |
| PGA | 10:00 | about 10:30 | next round's tee times also in the 6-hourly schedule refresh |
| Horse racing (UK, USA, Australia) | 08:30 | about 09:00 | today's and tomorrow's cards; non-runners and changes in the 6-hourly schedule refresh; /players = the horses on a card in the last 30 days |
- Once a day after the time above:
/{sport}/players(all players; or/players/{team_id}per team). Upsert by playerid; a player who is gone from the list has left every roster. - US sports on game days: about 1 hour before each game, re-read
/{sport}/players/{team_id}of both teams to pick up the latestinjury(status,note,updated_at) androster_status. - Teams change rarely:
/{sport}/teamsonce a day is enough.
Freshness and caching#
Last updated: 2026-11-25 · v1.0
- Answers are cached on the server and rebuilt as soon as the data behind them changes (a live score, a status, a
stats update, a schedule or squad update, a correction). A cached answer is never older than 1 hour;
/schedule/upcomingis rebuilt at least every minute (it depends on the clock). - The same request with the same parameters is the cheapest one: keep your window parameters stable during a day
(
from=<yesterday>&to=<tomorrow>) rather than building a new window every pass. - The answers carry no ETag / Last-Modified; to know whether a box score changed compare
stats_updated_at(in/stats) or the fixture fields of the schedule window. - Suggested polling: scoreboard window every 30 s on match days;
/stats/{id}only on a change, at most every 60 s per fixture in play;/playersdaily (+ injuries before US games); schedule daily and every 6 h on match days;/odds/{id}every 6 hours up to the start;/settingsonce a day (expiry).
Postponed and moved fixtures#
Last updated: 2026-11-25 · v1.0
- Moved before the start (a new date or time): the same fixture
idgets a newstart_date; it may then appear under another event (matches[]day). Re-read the schedule daily and key everything by fixtureid. - Postponed:
statusPostponed,status_codepostponed. It is not over: when the source gives a new date the sameidreturns toScheduledwith the newstart_date(and can then be played and confirmed normally). A postponed fixture with a paststart_dateis in neither/upcomingnor/past: look for it in/schedule. - Abandoned (started and stopped for good):
statusPostponed,status_codeabandoned; counts for nobody. Partial stats may be present. - Canceled:
Canceled/canceled; will not be played (also an MMA bout removed from its card, an F1 session that did not run). - Time to be announced:
start_time_tbd: true; the real start arrives later, at the latest when the game starts. - Interrupted (suspended, rain delay):
status_codeinterrupted, stillIn Progress; it resumes or ends as postponed / abandoned. An MLB game suspended to another day keeps itsid: once the source dates it to the day it resumes, itsstart_datemoves to that FUTURE date whilestatus_codestaysinterrupted(so it can appear under a later day's event); the status changes when the game resumes. Key it byid, not bystart_date. - Never started: a fixture the source kept at "Not Started" well past its start is closed by the
service (no result). If the source later gives it a new date, the same
idreturns toScheduledwith the newstart_date, like a postponed fixture.
On a Fantasy Engine site a postponed fixture is over for its contests: it scores for nobody and
counts as finished, so the site stops reading it and does not follow a later return to Scheduled by
itself. When the match gets its new date, the site admin brings it back in the AdminCP with the event's Update results (the new kick-off
and the status Scheduled, one save); from then on the site reads it from the feed again. A contest already completed
on it keeps its result.
Odds per bookmaker#
Last updated: 2026-11-25 · v1.0
- From the schedule, take the fixtures starting in the next 72 hours (soccer and US sports).
- Every 6 hours call
/{sport}/odds/{id}for each of them (the service refreshes every 6 hours; one call per fixture per refresh is enough). Read them one last time just before the start: after the start they no longer change. - Index by market
idand bookmakerid(stable). For a line market group the prices byline;line_mainmarks the bookmaker's main line(s). Useupdated_atto show how fresh a bookmaker's prices are. - A fixture without odds has no
oddskey: treat a missing key as "none yet".
// best decimal price per outcome of the "Match Winner" market (JavaScript)
const market = data.odds?.find((m) => m.name === 'Match Winner');
const best = {};
for (const bookmaker of market?.bookmakers ?? []) {
for (const price of bookmaker.odd.flat()) {
const v = parseFloat(price.value);
if (!(price.name in best) || v > best[price.name].value) best[price.name] = { value: v, bookmaker: bookmaker.name };
}
}
Change log#
Last updated: 2026-11-25 · v1.0
| Date (GMT+7) | Section | What changed |
|---|---|---|
| 2026-10-27 | all | First version of the Data API reference (a single document), every example answer taken from a test copy of the API. |
| 2026-10-28 to 2026-10-30 | all | Re-checked with every API change of those days (see the API history). |
| 2026-11-25 | all | Moved to the documentation site as this page; every section re-checked against the code of version 1.0 of the Data API (endpoints, parameters, defaults, allowed values, paging, errors, limits, the X-API-KEY header, times in UTC). Confirmed-game example taken again (/nfl/stats/1801); a season load stays within the request limits of the key. |