PitchAPIDocumentation

Football data API reference

A read-only REST API for football data. Everything the product returns is documented here — every field, every metric and every error.

Base URLhttps://api.pitchapi.devv1
Fundamentals

Quickstart

PitchAPI is a read-only REST API for football data.

Grab a day of fixtures, take a match ID, and drill into shots, momentum, events, player stats, lineups, and the advanced analytics built on the raw event feed. You just need an API key.

curl https://api.pitchapi.dev/v1/date/2025-11-09 \
  -H "X-API-KEY: $PITCH_KEY"
Base URLhttps://api.pitchapi.dev

All requests must use HTTPS. Requests over plain HTTP are refused rather than redirected so that a misconfigured client never leaks its key.

The whole contract is also published as an OpenAPI 3.1 document if you generate clients rather than read prose.

Fundamentals

SDKs

Official client libraries wrap the REST API so you work with typed objects instead of raw JSON. They unwrap the response envelope, map errors to typed exceptions, and retry on 429 and 5xx with the Retry-After delay honoured.

Python and TypeScript are available today. Every method returns the same fields documented in this reference, so the endpoint pages below are the field-level reference for the SDKs too.

If the caller is an assistant rather than your code, there is also an MCP server: nine read-only tools over the same API on the Pro and Data plans, installed with npx -y pitchapi-mcp.

Install — Python
pip install pitchapi
Requirements

Python 3.9+, one dependency (httpx). The key can be passed as api_key= or read from the PITCHAPI_API_KEY environment variable — keep it server-side, never in client code. Responses are plain dataclasses and the package ships type information, so editors complete every field.

View on PyPI →
Synchronous
from pitchapi import PitchAPI

with PitchAPI(api_key="pk_live_...") as client:
    # A day of fixtures
    day = client.date.get("2025-11-09")
    for m in day.matches:
        print(m.home_team.name, m.score_home, "-", m.score_away, m.away_team.name)

    # Drill into a match
    match = client.matches.get("m_B8x2K9")
    shots = client.matches.shots(match.id)
    advanced = client.matches.advanced(match.id)  # PPDA, field tilt, xG timeline
Asynchronous
import asyncio
from pitchapi import AsyncPitchAPI

async def main():
    async with AsyncPitchAPI() as client:  # key from PITCHAPI_API_KEY
        league = await client.leagues.get("l_0bfbkO")
        matches = await client.leagues.matches(league.id, season="2025/2026")

asyncio.run(main())

Both clients expose the same five namespaces. AsyncPitchAPI is the exact twin of PitchAPI: same names, same arguments, same models, awaited.

Namespaces
client.date
get(date, status=None) — every match on a day. date takes a YYYY-MM-DD string or a datetime.date.
client.matches
get, shots, shot, events, lineups, momentum, stats, players, player, players_halves, player_halves, player_shots, h2h, advanced, advanced_network, advanced_players, advanced_player, heatmaps.
client.leagues
list, get, matches(id, season=None, status=None) — season defaults to the latest one with data.
client.teams
get — the team profile.
client.players
get — the player profile.

Two behaviours are worth knowing before you reach for them. Match listings are historical by default, and a lineup published before kickoff may still be a prediction.

Upcoming fixtures
# Listings return played matches by default. Ask for scheduled ones:
for m in client.date.get("2025-11-16", status="upcoming").matches:
    print(m.time_utc, m.home_team.name, "vs", m.away_team.name)
    # m.score_home is None until the match is played

# Within a season — "all" returns results and fixtures together
client.leagues.matches("l_0bfbkO", season="2025/2026", status="all")
Predicted lineups
lineups = client.matches.lineups("m_B8x2K9")

# Before kickoff the XI may be a prediction rather than the real one
if lineups.home.confirmed:
    print(lineups.home.formation, [p.name for p in lineups.home.starters])
else:
    print("predicted only:", lineups.home.lineup_type)

Every exception derives from PitchAPIError and carries code, status_code and request_id where the API supplied them — quote the request ID in any support thread. Retries are automatic, so a RateLimitError means the client already backed off and tried again.

Error handling
from pitchapi import NotFoundError, PlanUpgradeRequiredError, RateLimitError

try:
    client.matches.advanced("m_B8x2K9")
except NotFoundError as e:
    print(e.code, e.request_id)   # RESOURCE_NOT_FOUND, ANALYTICS_UNAVAILABLE, ...
except PlanUpgradeRequiredError:
    ...                           # the league is Pro-only
except RateLimitError as e:
    print("retry after", e.retry_after, "s")
Fundamentals

Authentication

Pass your API key in the X-API-KEY header on every request. Keys use the pk_live_ prefix. You get one when you sign up, and it is shown once on the key page — we store only its hash, so afterwards it cannot be displayed again, only replaced.

Authenticated request
curl https://api.pitchapi.dev/v1/matches/m_B8x2K9 \
  -H "X-API-KEY: pk_live_xxxxxxxxxxxxxxxxxxxxxxxx"

Your API key is a bearer credential: anyone holding it can spend your quota. Keep it server-side and never ship it in client code or a public repository. We only store a SHA-256 hash of your key, so a lost key must be replaced.

Fundamentals

Responses

Every response is wrapped in a single JSON envelope. Success carries a data key, failure carries an error key. The two never appear together, so branch on whichever is present.

200 OK
{
  "data": {
    "id": "m_B8x2K9",
    "status": "finished",
    "score_home": 3,
    "score_away": 1
  }
}
404 Not Found
{
  "error": {
    "code": "RESOURCE_NOT_FOUND",
    "message": "match not found"
  }
}

Timestamps are RFC 3339 in UTC, dates are YYYY-MM-DD. Optional fields are omitted when unavailable. Lists return an empty array when there is nothing to report. A null is never a zero: it means the value is undefined, which for a rate means an empty denominator and for an average means nothing to average.

Fundamentals

Resource IDs

Every public ID is a short opaque token: a resource prefix, an underscore, and exactly six base62 characters. IDs are stable and non-sequential. Treat them as opaque strings and never parse them for meaning.

PrefixResourceExample
m_Matchm_B8x2K9
s_Shots_Q1pR6z
p_Playerp_7YtX4q
t_Teamt_9aB2xQ
l_Leaguel_4Kd0Wq
wh_Webhook endpointwh_R2mQ7d
ex_Export jobex_T4nV8s

Shot IDs are the one exception to global uniqueness: they are scoped to their match, so the same value in different matches refers to different shots.

Fundamentals

Plans and coverage

Every plan reaches every data endpoint, every league in the catalogue and the same JSON. Free reads the current season and the one before it — 2025/2026 and 2026/2027 today, or 2025 and 2026 for a calendar-year league — plus next season's fixtures as soon as they are published. Pro opens the whole archive back to 2021, removes the daily cap, raises the per-minute limit to 1,200 and the live-snapshot limit to 600, and adds live streaming, outbound webhooks and the MCP server. Data is Pro plus bulk exports in NDJSON and Parquet.

Streaming, webhooks, exports, the MCP server and the older seasons are plan features rather than separate services: a Pro or Data key calls the same endpoints as any other, and a Free key gets 403 PLAN_UPGRADE_REQUIRED naming the season it asked for and the oldest one that is free. Everything else — every league, every endpoint, the same fields — is identical on all three plans.

The daily allowance resets at 00:00 UTC. Exceeding it returns 429 DAILY_QUOTA_EXCEEDED with Retry-After; exceeding a per-minute rate returns 429 RATE_LIMIT_EXCEEDED. The first names the limit and links to the plans, so a client that logs the message still ends up somewhere useful.

Free€0
15,000requests/day

All 77 leagues and every data endpoint, for the current season and the one before it (2025/2026 and 2026/2027 today). 15,000 requests a day, 600 a minute, and 60 a minute on the live snapshot. No card, no expiry.

Pro€4.99
Unlimitedrequests · €4.99/month

The whole archive back to 2021, no daily allowance, 1,200 requests a minute, and 600 a minute on the live snapshot. Includes live match streaming, outbound webhooks and the MCP server for Claude, Cursor and VS Code. Priority email support.

Data€9.99
Unlimitedrequests + exports · €9.99/month

Everything in Pro, plus bulk exports: sixteen datasets including the advanced analytics, filtered by league, season or date, as NDJSON or Parquet. 25 exports a day, files kept for 7 days.

Daily usage is reported in X-Quota-Limit, X-Quota-Remaining and X-Quota-Reset.

There is never an overage charge: the API refuses the request instead. Pro and Data have no daily allowance, so only the per-minute guard applies.

Fundamentals

Error codes

Errors use conventional HTTP status codes alongside a stable machine-readable code. Branch on the code, not the message — messages are for humans and may be reworded.

Three of them are 404s and mean different things. RESOURCE_NOT_FOUND says the ID does not exist; ANALYTICS_UNAVAILABLE says the match does, and we never rated it; HALVES_UNAVAILABLE says the match does, and we have no per-half player stats for it.

StatusCodeMeaning
401UNAUTHORIZEDThe X-API-KEY header is missing or the key is invalid.
429RATE_LIMIT_EXCEEDEDThe per-minute rate guard was hit. Retry-After gives the seconds to back off for.
429DAILY_QUOTA_EXCEEDEDThe free plan's daily allowance (15,000 requests, reset at 00:00 UTC) is used up. The message names the limit and links to the plans; Retry-After gives the seconds until it resets. Pro and Data have no daily cap.
403PLAN_UPGRADE_REQUIREDThe key's plan does not include this feature or resource. Free reads the current season and the one before it, so anything older is Pro; webhooks are Pro and above; bulk exports are Data only. The message names the season that is out of reach and the oldest one that is free.
403SUBSCRIPTION_SUSPENDEDThe subscription is not active: cancelled, unpaid, or past the seven-day grace period after a failed renewal. The key is still valid; the billing state is not.
503LIVE_UNAVAILABLEThe live snapshot has no data for this match right now. Try the finished-match endpoints, or retry shortly before kickoff.
400INVALID_PLANCheckout only. The requested plan does not exist. Expected `pro` or `data`.
503PLAN_UNAVAILABLECheckout only. The plan exists but this deployment has no Stripe price configured for it.
503BILLING_UNAVAILABLECheckout only. The billing provider could not be reached, so the API refused to open a checkout rather than risk a second subscription. Retry in a moment.
400INVALID_URLWebhooks only. The URL is not a public HTTPS endpoint. Loopback, private ranges and the cloud metadata address are refused at registration and again at delivery time.
429WEBHOOK_LIMIT_REACHEDWebhooks only. The account already has ten endpoints, which is the maximum.
429EXPORT_QUOTA_EXCEEDEDExports only. The account has created 25 exports today. The allowance resets at 00:00 UTC.
503EXPORTS_UNAVAILABLEExports only. Bulk export storage is not configured on this deployment.
400INVALID_PARAMETERA path or query parameter isn't in the expected format (date, ID pattern, etc.).
409ALREADY_SUBSCRIBEDCheckout only. The account is already on this plan or a higher one; open the billing portal to change or cancel it. Upgrading to a higher plan is allowed and cancels the plan it replaces.
404RESOURCE_NOT_FOUNDNo resource exists with that ID.
404ANALYTICS_UNAVAILABLEAdvanced analytics routes only. The match exists but was never rated — event-feed coverage is not universal, so this is an ordinary answer rather than an error on your side. Kept separate from RESOURCE_NOT_FOUND so you can tell it from a bad match ID.
404HALVES_UNAVAILABLEPlayer-halves routes only. The match exists but has no per-half player stats. Kept separate from RESOURCE_NOT_FOUND so you can tell it from a bad match ID.
500INTERNAL_SERVER_ERRORSomething went wrong on our side. Retry with backoff.
Reference

Every resource, one page each

The reference is split by what you are looking for, so a search for an endpoint lands on the page that documents it. Start with the resource you hold an ID for, or take the catalogue pages if you are starting from a date or a competition.

Something missing or wrong? That is a bug in the docs.Get a free key
On this page