Football fixtures API in JavaScript

A short, working walkthrough: get an API key, request upcoming football fixtures, filter by date and league, and read the prediction for a match. About five minutes.

1. Get an API key

Start a 14-day trial (card required, nothing charged until it ends). Your key appears after signup and on your dashboard, and switches on when the trial starts. Keep it in an environment variable (PREDICTIQ_KEY) and call the API from a server, not from browser code.

2. Fetch fixtures

Send the key in the Authorization: Token header. Filter with status, date_from, date_to and league_id. A filtered request returns up to 200 fixtures, oldest kickoff first. To find a league id, open its page, for example /football-api/eredivisie.

// Run this on a server (Node 18+, a serverless function or a backend route).
// Never put your key in browser JavaScript: anyone could copy it.
const API = "https://api.predictiqpro.com";
const headers = { Authorization: `Token ${process.env.PREDICTIQ_KEY}` };

const day = (offset) =>
  new Date(Date.now() + offset * 86400000).toISOString().slice(0, 10);

const qs = new URLSearchParams({
  status: "NS",              // not started
  date_from: day(0),
  date_to: day(7),
  // league_id: "0",         // optional: an id from /standings/ or a /football-api/<league> page
});
const res = await fetch(`${API}/fixtures/?${qs}`, { headers });
if (!res.ok) throw new Error(`HTTP ${res.status}`); // a missing or invalid key is refused here

const { count, results } = await res.json();
console.log(count, "fixtures"); // up to 200 per request
for (const f of results.slice(0, 10)) {
  console.log(f.id, f.kickoff_time, f.home_team, "vs", f.away_team);
}

3. Read the prediction for a match

Pass a fixture id to /predictions/{id}. You get a probability for home, draw and away, and a basis field that says whether it is the bookmaker consensus (market_consensus) or the model (statistical_model). The track record is public on the accuracy page.

// Use a fixture id from the list above
const fixtureId = results[0].id;

const pr = await fetch(`${API}/predictions/${fixtureId}`, { headers });
if (!pr.ok) throw new Error(`HTTP ${pr.status}`);
const pred = await pr.json();

console.log(pred.prob_home, pred.prob_draw, pred.prob_away, "| basis:", pred.basis);

4. Respect the limits

Responses carry rate-limit headers (X-RateLimit-Remaining-Hourly, X-RateLimit-Remaining-Daily, X-RateLimit-Remaining-Monthly), so you can back off before you hit a 429. A header can be missing if your plan has no limit of that kind.

console.log("left this hour: ", res.headers.get("X-RateLimit-Remaining-Hourly"));
console.log("left today:     ", res.headers.get("X-RateLimit-Remaining-Daily"));
console.log("left this month:", res.headers.get("X-RateLimit-Remaining-Monthly"));
if (res.status === 429) console.log("Quota reached - back off or upgrade");

Ready to build?

Full endpoint reference is in the docs; plans are on the pricing page. Related: live scores in JavaScript, football API by league.

Start 14-day trial