Football fixtures API in Python

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), not in your source 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, or call /standings/ with no league_id for the leagues that played recently.

import os
from datetime import date, timedelta

import requests

API = "https://api.predictiqpro.com"
HEADERS = {"Authorization": f"Token {os.environ['PREDICTIQ_KEY']}"}

params = {
    "status": "NS",                                    # not started
    "date_from": date.today().isoformat(),
    "date_to": (date.today() + timedelta(days=7)).isoformat(),
    # "league_id": 0,   # optional: an id from /standings/ or a /football-api/<league> page
}
r = requests.get(f"{API}/fixtures/", headers=HEADERS, params=params, timeout=15)
r.raise_for_status()  # a missing or invalid key is refused here
data = r.json()

print(data["count"], "fixtures")  # up to 200 per request
for f in data["results"][:10]:
    print(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
fixture_id = data["results"][0]["id"]

p = requests.get(f"{API}/predictions/{fixture_id}", headers=HEADERS, timeout=15)
p.raise_for_status()
pred = p.json()

print(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.

r = requests.get(f"{API}/fixtures/", headers=HEADERS, params=params, timeout=15)
print("left this hour: ", r.headers.get("X-RateLimit-Remaining-Hourly"))
print("left today:     ", r.headers.get("X-RateLimit-Remaining-Daily"))
print("left this month:", r.headers.get("X-RateLimit-Remaining-Monthly"))
if r.status_code == 429:
    print("Quota reached - back off or upgrade")

Ready to build?

Full endpoint reference is in the docs; plans are on the pricing page. Related: predictions in Python, standings in Python, football API by league.

Start 14-day trial