CrunchClash API
Premier League API for Python Developers
Executable Python patterns for authentication, Premier League requests, JSON parsing, pandas, and matplotlib — using the real /v1 contract.
Python dependency installation
setup
python -m venv .venv
source .venv/bin/activate # Windows: .venv\\Scripts\\activate
pip install requests pandas matplotlibAPI account registration and key creation
- Register at the API signup page and verify email.
- Create an API key in the portal (secret shown once).
- Store the key in an environment variable — never commit it.
Environment variable configuration
.env
# .env (never commit real keys)
CRUNCHCLASH_API_KEY=YOUR_API_KEY
CRUNCHCLASH_API_BASE=https://api.crunchclash.comAuthentication and first API request
client.py
import os
import time
import requests
import pandas as pd
BASE = os.environ.get("CRUNCHCLASH_API_BASE", "https://api.crunchclash.com")
API_KEY = os.environ["CRUNCHCLASH_API_KEY"]
session = requests.Session()
session.headers.update({"x-api-key": API_KEY})
def api_get(path: str, params: dict | None = None) -> dict:
"""GET helper with timeout and basic rate-limit retry."""
url = f"{BASE}{path}"
for attempt in range(3):
r = session.get(url, params=params or {}, timeout=30)
if r.status_code == 429:
time.sleep(2 ** attempt)
continue
r.raise_for_status()
return r.json()
raise RuntimeError("Rate limited after retries")
# First request — current season
season = api_get("/v1/seasons/current")
print(season["data"])Actual JSON response shape
GET/v1/seasons/current
Season 2026 sample — illustrative fixture, not live data
Request URL
https://api.crunchclash.com/v1/seasons/current
Auth: x-api-key: YOUR_API_KEY or Authorization: Bearer YOUR_API_KEY
cURL
curl -s -H "x-api-key: YOUR_API_KEY" \
"https://api.crunchclash.com/v1/seasons/current"JSON response
application/json
{
"data": {
"id": "2026",
"competition_id": 8,
"label": "2025/26",
"is_active": true
},
"meta": {
"request_id": "req_fixture_example",
"credit_cost": 1
}
}Player statistics retrieval
python
# Player statistics (season performance)
player_id = "2001" # replace with a real player id from /v1/players
perf = api_get(
f"/v1/players/{player_id}/performance",
{"season": "2026", "select": "goals,assists,expectedGoals,minutes"},
)
print(perf["data"])Match results retrieval and pandas DataFrame
python
# Match results with filters
matches = api_get(
"/v1/matches",
{"season": "2026", "status": "verified", "take": "25"},
)
rows = matches["data"]
df = pd.DataFrame([
{
"id": m["id"],
"matchweek": m["matchweek"],
"home": m["home"]["name"] if m.get("home") else None,
"away": m["away"]["name"] if m.get("away") else None,
"home_score": m["home"]["score"] if m.get("home") else None,
"away_score": m["away"]["score"] if m.get("away") else None,
"status": m["status"],
}
for m in rows
])
print(df.head())League standings retrieval
python
# League standings
table = api_get("/v1/league-table", {"season": "2026", "context": "overall"})
standings_df = pd.DataFrame(table["data"]["rows"])
print(standings_df[["position", "name", "played", "won", "drawn", "lost", "points"]])Advanced filtering, metric selection, and pagination
python
# Advanced filtering + metric selection
leaders = api_get(
"/v1/performance/players",
{
"season": "2026",
"metrics": "goals,expectedGoals,minutes",
"sort_by": "goals",
"min_minutes": "450",
"take": "20",
},
)
# Pagination: pass meta.next_after as after= on the next request when has_more is true
print(leaders["meta"])Football data visualization with matplotlib
python
import matplotlib.pyplot as plt
chart_df = standings_df.head(10)
plt.figure(figsize=(8, 4))
plt.bar(chart_df["name"], chart_df["points"], color="#84cc16")
plt.xticks(rotation=45, ha="right")
plt.title("Premier League points (sample fixture)")
plt.tight_layout()
plt.show()Error handling and rate limits
python
try:
payload = api_get("/v1/league-table", {"season": "2026"})
except requests.HTTPError as exc:
resp = exc.response
body = resp.json() if resp is not None else {}
print(body.get("error", {}).get("code"), body.get("error", {}).get("message"))
# Common codes: UNAUTHORIZED, RATE_LIMITED, INSUFFICIENT_CREDITS, BAD_REQUESTProduction tips: keep keys server-side, set timeouts on every request, respect RPM headers, monitor X-Credits-Remaining, and use cursor pagination via after when meta.has_more is true.
Frequently asked questions
- How can I access Premier League data using Python?
- Install requests (and optionally pandas/matplotlib), set CRUNCHCLASH_API_KEY in your environment, and call https://api.crunchclash.com/v1 endpoints with the x-api-key header.
- Where do I create an API key?
- Sign up on api.crunchclash.com, then create a key in the Developer Portal. Never hard-code secrets in source.
- How are rate limits handled?
- Responses include rate-limit headers. On HTTP 429, back off and retry. Free accounts are limited to 10 requests per minute.
Related API solutions
Start building with the Premier League API
Create a developer account on the CrunchClash API, receive 5,000 one-time free credits, generate an API key, and call REST endpoints under /v1.