Fantasy Engine Data API 1.0 / Start
Getting started
The Fantasy Engine Data API in five minutes: where to send requests, how to send your key, which sports there are and what a first answer looks like.
Base URL and key#
Last updated: 2026-11-25 · v1.0
Every call is an HTTPS GET to
https://data.fantasyengine.net/api/feeds/<path>
The base URL is the same for every customer; only the key differs. Send your key in the request header
X-API-KEY on every call (the key is never read from the query string):
X-API-KEY: YOUR_API_KEY
- Use your live key on the production site and your dev key on local and staging sites (Live key and dev key).
- Keep the key on your server. The API answers browsers too (
Access-Control-Allow-Origin: *), but a key used from a web page is visible to everyone who opens it. - Answers are JSON (
Content-Type: application/json), UTF-8. A successful answer is{"data": ...}with HTTP 200; a refused one is{"error": {...}}with a 4xx status (Errors). - There is no write endpoint: the feed is read only.
- To try every endpoint without writing code, import the Postman collection.
The Data API is a plan made for Fantasy Engine sites: a Fantasy Engine site reads it with the key entered in its AdminCP, and this guide is for the developer who reads the same data from their own code. What a plan includes, the free trial and renewals are on the page Access, keys, limits and errors.
Sport keys#
Last updated: 2026-11-25 · v1.0
Every data endpoint starts with a sport key: /api/feeds/epl/teams, /api/feeds/nba/schedule.
GET /settings lists the keys your account can use. Today they are (the names as /settings answers them; a name can change, a key never does - match on the key):
Group (sport_groups[].key) | Sport key | Name | team_sport | Fixture kind | quality |
|---|---|---|---|---|---|
soccer | epl | English Premier League | true | match | stable |
bundesliga | Bundesliga | true | stable | ||
laliga | LaLiga | true | stable | ||
seriea | Serie A | true | stable | ||
ligue1 | Ligue 1 | true | stable | ||
ucl | Uefa Champions League | true | stable | ||
uel | Uefa Europa League | true | stable | ||
basketball | nba | NBA | true | match | stable |
football | nfl | NFL | true | match | stable |
baseball | mlb | MLB | true | match | stable |
hockey | nhl | NHL | true | match | stable |
fighting | mma | MMA | true | bout | stable |
racing | f1 | Formula 1 | true | session | beta |
golf | pga | PGA | false | round | beta |
horse_racing | horse_aus | Horse Australia | false | race | beta |
horse_uk | Horse Uk | false | beta | ||
horse_usa | Horse Usa | false | beta |
Soccer, NBA, NFL, MLB, NHL and MMA are stable; golf, Formula 1 and horse racing (UK, USA and Australia) are beta. Read the list from /settings rather than hard-coding it: a sport can be added, and an unknown or
switched-off key answers 404. team_sport tells whether fixtures carry home_team /
away_team and players carry a position; quality is explained in
Quality: stable and beta.
First request#
Last updated: 2026-11-25 · v1.0
List your sports and their expiry, then the NBA games of today. The same calls with curl and as a short program in three languages.
curl#
curl --compressed -H "X-API-KEY: YOUR_API_KEY" https://data.fantasyengine.net/api/feeds/settings
curl --compressed -H "X-API-KEY: YOUR_API_KEY" "https://data.fantasyengine.net/api/feeds/nba/schedule?from=2026-10-26&to=2026-10-26"
The first call answers (trimmed):
Example answer, trimmed ("..." marks removed parts){
"data": {
"sport_groups": [
{
"key": "soccer",
"name": "Soccer",
"sports": [
{
"key": "epl",
"name": "English Premier League",
"abbr": "EPL",
"team_sport": true,
"expire_at": "2027-12-31 23:59:59",
"is_expired": false,
"buy_url": "https://fantasyengine.net/data-api-pricing",
"quality": "stable"
},
...
]
},
...,
{
"key": "golf",
"name": "Golf",
"sports": [
{
"key": "pga",
"name": "PGA",
"abbr": "PGA",
"team_sport": false,
"expire_at": "2027-12-31 23:59:59",
"is_expired": false,
"buy_url": "https://fantasyengine.net/data-api-pricing",
"quality": "beta"
}
]
},
...
]
}
}
JavaScript (Node.js 18 or later, or any runtime with fetch; run as an ES module, e.g. first.mjs)#
// Node.js 18+ (built-in fetch; it asks for gzip and unpacks it by itself)
const BASE = 'https://data.fantasyengine.net/api/feeds';
const KEY = 'YOUR_API_KEY';
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 settings = await feed('settings');
for (const group of settings.sport_groups) {
for (const sport of group.sports) {
console.log(sport.key, sport.quality, 'expires', sport.expire_at);
}
}
const today = new Date().toISOString().slice(0, 10);
const day = await feed(`nba/schedule?from=${today}&to=${today}`);
for (const event of day.matches) {
for (const f of event.fixtures) {
console.log(f.id, f.name, f.start_date, f.status_code, f.score ? `${f.score.home}-${f.score.away}` : '');
}
}
PHP 8 (curl extension)#
<?php
// PHP 8 with the curl extension
const BASE = 'https://data.fantasyengine.net/api/feeds';
const KEY = 'YOUR_API_KEY';
function feed(string $path): array
{
$ch = curl_init(BASE.'/'.$path);
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['X-API-KEY: '.KEY],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '', // ask for gzip and unpack it
CURLOPT_TIMEOUT => 30,
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
$body = json_decode((string) $raw, true);
if ($status !== 200) {
throw new RuntimeException("HTTP $status: ".($body['error']['message'] ?? 'no answer'));
}
return $body['data'];
}
foreach (feed('settings')['sport_groups'] as $group) {
foreach ($group['sports'] as $sport) {
echo $sport['key'], ' ', $sport['quality'], ' expires ', $sport['expire_at'], "\n";
}
}
$today = gmdate('Y-m-d');
foreach (feed("nba/schedule?from=$today&to=$today")['matches'] as $event) {
foreach ($event['fixtures'] as $f) {
$score = $f['score'] ? $f['score']['home'].'-'.$f['score']['away'] : '';
echo $f['id'], ' ', $f['name'], ' ', $f['start_date'], ' ', $f['status_code'], ' ', $score, "\n";
}
}
Python 3 (standard library only)#
# Python 3.8+, standard library only
import gzip, json, urllib.error, urllib.request
from datetime import datetime, timezone
BASE = 'https://data.fantasyengine.net/api/feeds'
KEY = 'YOUR_API_KEY'
def feed(path):
req = urllib.request.Request(f'{BASE}/{path}', headers={'X-API-KEY': KEY, 'Accept-Encoding': 'gzip'})
try:
with urllib.request.urlopen(req, timeout=30) as res:
raw = res.read()
if res.headers.get('Content-Encoding') == 'gzip':
raw = gzip.decompress(raw)
return json.loads(raw)['data']
except urllib.error.HTTPError as e:
raise RuntimeError(f"HTTP {e.code}: {json.loads(e.read())['error']['message']}")
for group in feed('settings')['sport_groups']:
for sport in group['sports']:
print(sport['key'], sport['quality'], 'expires', sport['expire_at'])
today = datetime.now(timezone.utc).strftime('%Y-%m-%d')
for event in feed(f'nba/schedule?from={today}&to={today}')['matches']:
for f in event['fixtures']:
score = f"{f['score']['home']}-{f['score']['away']}" if f['score'] else ''
print(f['id'], f['name'], f['start_date'], f['status_code'], score)
The program prints one line per sport, then one per game (here the first two of 17 sports and the games of 26 October 2026 UTC):
epl stable expires 2027-12-31 23:59:59
bundesliga stable expires 2027-12-31 23:59:59
...
489 SAC vs MEM 2026-10-26 01:00:00 final 112-123
490 CHA vs WSH 2026-10-26 23:00:00 scheduled
491 CLE vs MIN 2026-10-26 23:00:00 scheduled
492 BOS vs CHI 2026-10-26 23:30:00 scheduled
493 MIA vs DAL 2026-10-26 23:30:00 scheduled
With a wrong key it stops with HTTP 401: Invalid api key.
The Python program was run against a test copy of the API on 2026-11-25 (with the date of 26 October 2026, which that copy holds) and printed the lines above; the JavaScript and PHP programs make the same two calls.
Times and dates#
Last updated: 2026-11-25 · v1.0
- Every date-time in an answer is UTC, written
YYYY-MM-DD HH:MM:SS(no zone suffix):"start_date": "2026-10-24 11:30:00". Convert to your users' zone yourself. - Dates you send (
from,to) are UTC days,YYYY-MM-DD. - A date that is not known is
nullin the newer fields and an empty string""in a few older ones (expire_atof a sport you never bought). - A kick-off that is announced without a time has
start_time_tbd: true; see the fixture object.
Compression (please ask for gzip)#
Last updated: 2026-11-25 · v1.0
Ask for compressed answers: send Accept-Encoding: gzip (curl --compressed; Node's
fetch, PHP curl with CURLOPT_ENCODING => '' and most HTTP libraries do it for you). JSON
shrinks 8 to 28 times. Sizes measured on a server with the same data volume:
| Call | Plain | gzip |
|---|---|---|
/epl/schedule (whole season) | 308 KB | 14 KB |
/nba/schedule (whole season) | 978 KB | 40 KB |
/nba/schedule/upcoming | 863 KB | 34 KB |
/mlb/schedule (whole season) | 2.35 MB | 83 KB |
/pga/schedule (whole season, every round with its field) | about 5 MB | about 0.5 MB |
/epl/stats/{id} (a match in play) | 89 KB | 7 KB |
/epl/players | 131 KB | 15 KB |
/epl/schedule?from=<today>&to=<tomorrow> | 16 KB | 2 KB |
/nba/odds/{id} or /nfl/odds/{id} (every player prop) | 1.4 - 2 MB | much smaller |
The size is the reason the recipes use the date filters instead of whole-season lists.
Postman collection#
Last updated: 2026-11-25 · v1.0
A Postman collection with every endpoint of this guide, ready to send:
- fantasy-engine-data-api.postman_collection.json - the twelve requests of the eleven endpoints in four folders (Account, Teams and players, Schedules, Box scores and odds), every path and query parameter with its allowed values, and one saved example answer per request.
- fantasy-engine-data-api.postman_environment.json
- the environment with
base_url=https://data.fantasyengine.netand an emptyapi_key.
In Postman choose Import and drop both files.
Select the environment Fantasy Engine Data API (top right) and paste your key into the Current value of
api_key. Use your dev key for tests (its limits are lower, and it never counts against your live site).Open Account / Your sports and expiry and press Send.
What you should see: status 200 and
{"data": {"sport_groups": [...]}}. A 401Invalid api keymeans the key is empty or not copied in full.
The key is sent by the collection itself (its authorization: header X-API-KEY = {{api_key}}), so
no request needs a header of its own. Path variables such as :sport and :fixture_id are filled in on
the Params tab; the optional query parameters of the schedule lists are there too, switched off until you tick
them. Keep the Current value of api_key only: Postman does not share current values when you share
the collection or the environment.
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). Base URL https://data.fantasyengine.net in every example; quality of golf, Formula 1 and UK horse racing is beta in the sport table; the first-request example run again; a section on the Postman collection and its environment (downloads). |