PitchAPI
PitchAPI is a football data API covering 77 leagues: matches, shot-level expected goals with pitch coordinates, events, lineups, per-player and per-team match statistics, live snapshots and advanced analytics. The free plan is complete — every league and every endpoint — so the paid tiers add capacity and bulk delivery, not data.
ingestr supports PitchAPI as a keyed source. The REST tables read a date range or a league-season one match at a time; the _bulk tables read the Data plan's export API, which builds one Parquet file per dataset — the only practical way to load a full history.
Implementation: pkg/source/pitchapi. For the API surface, plan limits and implementation notes, see the PitchAPI source research.
URI format
pitchapi://?api_key=<api-key>URI parameters:
api_key: PitchAPI key,pk_live_...orpk_test_.... Required.days: How many days the REST tables look back when no interval is given. Defaults to3.league: Anl_league id, for examplel_B8x2K9. Narrows discovery to that league-season instead of a date range.season:2025/2026for a season that crosses the new year, or2026for a calendar year. Used withleague, and as the filter for the_bulktables.base_url: Overrides the API base URL. Defaults tohttps://api.pitchapi.dev/v1.
The API key is sent in the X-API-KEY header, not Authorization.
Examples
Load the last three days of matches into DuckDB:
ingestr ingest \
--source-uri 'pitchapi://?api_key=<api-key>' \
--source-table 'matches' \
--dest-uri 'duckdb:///pitch.duckdb' \
--dest-table 'football.matches'Load one league-season of shots, refreshing as it goes:
ingestr ingest \
--source-uri 'pitchapi://?api_key=<api-key>&league=l_B8x2K9&season=2025/2026' \
--source-table 'shots' \
--dest-uri 'duckdb:///pitch.duckdb' \
--dest-table 'football.shots'Backfill every shot in a season from a bulk export (Data plan):
ingestr ingest \
--source-uri 'pitchapi://?api_key=<api-key>&season=2025/2026' \
--source-table 'shots_bulk' \
--dest-uri 'duckdb:///pitch.duckdb' \
--dest-table 'football.shots'Tables
| Table | PK | Inc Key | Inc Strategy | Details |
|---|---|---|---|---|
leagues | id | - | replace | The league catalogue from GET /leagues. |
teams | id | - | replace | Every team in every league, taken from the match lists (name, image_url). |
players | id | - | merge | The players of the matches in the window, hydrated through GET /players/{id}. |
matches | id | date | merge | Matches for the date range, or for league+season when given. |
shots | match_id, id | date | delete+insert | Per-match shots, with xG, xGOT, coordinates and the scorer as JSON. |
events | match_id, event_type, minute, minute_added, team_id, player_id | date | delete+insert | Goals, cards and substitutions, with player names as JSON. |
lineups | match_id, team_id | - | merge | One row per team: formation, coach, confirmed, and starters/subs as JSON. |
player_stats | match_id, player_id | - | merge | One row per player per match; stats is JSON and varies by position. |
match_stats | match_id, period, group_name, key | date | delete+insert | Team statistics in long form, one row per period, group and key. |
matches_bulk | id | - | replace | One export file of matches. |
shots_bulk | match_id, id | - | replace | One export file of shots. |
events_bulk | match_id, event_type, minute, minute_added, team_id, player_id | - | replace | One export file of events. |
lineups_bulk | match_id, team_id | - | replace | One export file of team sheets. |
player_stats_bulk | match_id, player_id | - | replace | One export file of player statistics. |
match_stats_bulk | match_id, period, key | - | replace | One export file of team statistics. |
teams_bulk | id | - | replace | The whole team catalogue; takes no filters. |
players_bulk | id | - | replace | The whole player catalogue; takes no filters. |
Use these as the --source-table parameter in the ingestr ingest command.
Notes
- Discovery. Without
league, the per-match tables read every match in--interval-start..--interval-end, or the lastdaysdays when there is no interval. Withleagueandseason, they read that league-season and ignore the interval. - One destination table per
league/season.leagueandseasonscope every table read with that URI, so load each league-season into its own destination table. Two different filters writing to one table delete each other's rows:teamsreplaces the table, andshots,eventsandmatch_statsdelete every row in the dates they read. delete+insertondateforshots,eventsandmatch_stats. Each run replaces the days it read, so a corrected scorer or minute, or a disallowed goal, does not leave a stale row behind. Withleague, the whole season is read and replaced, and the interval is ignored.mergeformatches,players,lineupsandplayer_stats. Their keys are stable, and a rescheduled match keeps itsidwhile itsdatechanges.- Per-match 404s are not failures. A match that was never rated, has no lineups yet, or has no shots yields no rows for that table.
- Rate limits. Free is 600 requests a minute and 15,000 a day; Pro and Data are 1,200 a minute with no daily cap. The source paces itself at 8 requests a second and retries a
429twice, honouringRetry-After, before failing. - Bulk tables need the Data plan (€9.99/month). Each read queues one export job, polls it, downloads the Parquet file and deletes the job afterwards. Allow 30 seconds to 5 minutes for a season, longer for shots.
- Exports take
league,seasonandfrom/to;fromandtomust be sent together and span at most five years. - 25 jobs per UTC day. A file is downloadable for 7 days and a signed URL is valid for 15 minutes; the source downloads it and deletes the job, so neither matters to a run.
- One file is capped at 2 GiB. A job that would exceed it fails with
export exceeds the size limit; narrow the filter (a season, or a date range) rather than retrying. teams_bulkandplayers_bulkare whole-table datasets and refuse a filter, so removeleagueandseasonfrom the URI for those two.- Bulk files carry the internal integer ids (
shots.match_idjoinsmatches.id) and the opaque tokens (id_token) onmatches,teamsandplayers. Parquet keeps NULLs as NULL: an undefined rate is not zero.
- Exports take