get api key →

AFL Stats API

A versioned, key-authenticated REST API for AFL match results, player statistics, team data, leaderboards, and more. All responses are JSON.

Current version: v1

New — use this data with Claude. Connect Claude to the database with our MCP server and ask AFL questions in plain English — no SQL or code required. See the Claude / MCP guide →

Authentication

Every request (except Fixture) requires an API key passed via the Authorization header as a Bearer token. Keys are managed on the API Usage page after signing in. Get a free API key →

Header Format

Authorization: Bearer YOUR_API_KEY

Example

curl https://kaliaflstats.com/api/afl/v1/teams \
  -H "Authorization: Bearer a3f9c2d1e8..."

Base URL

https://kaliaflstats.com/api/afl/v1

All endpoint paths below are relative to this base. When running locally, use http://localhost:5173.

Response Format

All successful responses wrap data in a consistent envelope. List endpoints include a meta object for pagination. Single-resource endpoints return { "data": { ... } }.

List Response

{
  "data": [ ... ],
  "meta": {
    "limit":  50,
    "offset": 0,
    "count":  10,
    "total":  142
  }
}

Single Resource Response

{
  "data": {
    "id": "sydney",
    "name": "Sydney Swans",
    "shortName": "SYD"
  }
}

Pagination

All list endpoints support limit and offset query parameters.

ParameterDefaultRangeDescription
limit501 -- 200Number of records to return
offset00+Number of records to skip

To iterate all records, keep fetching pages until offset + meta.count >= meta.total.

# Page 1
GET /players?limit=50&offset=0

# Page 2
GET /players?limit=50&offset=50

# Page 3
GET /players?limit=50&offset=100

Sorting

The player-stats and player-stats-advanced endpoints support dynamic sorting via sort_by and order query parameters.

ParameterTypeDescription
sort_bystringColumn to sort by (see valid values per endpoint)
orderstringasc or desc (default: desc)
# Top goal scorers in 2024, round 10
GET /player-stats?year=2024&round=10&sort_by=goals&order=desc

Errors

Error responses always include an error string.

StatusBodyMeaning
400{"error":"Bad request: ..."}Invalid or malformed query parameter
401{"error":"Unauthorized"}Missing, invalid, or revoked API key
404{"error":"... not found"}Resource with the given ID does not exist
429{"error":"Rate limit exceeded"}Your key's request limit has been reached

Quick Reference

All endpoints at a glance. All require auth unless noted.

MethodPathDescription
GET/teamsList all teams
GET/teams/:idGet single team
GET/teams/:id/statsAggregated team stats per match
GET/playersList players (search, filter)
GET/players/:idGet single player
GET/players/:id/careerCareer totals + averages
GET/players/:id/seasonSeason totals + averages
GET/matchesList matches (filter by team, venue, dates)
GET/matches/:idGet single match
GET/player-statsPer-match player stats (sortable)
GET/player-stats-advancedPer-match advanced stats (sortable)
GET/player-team-assignmentsTransfer / movement history
GET/leaderboardsTop players by any stat
GET/head-to-headMatch history between two teams
GET/venuesAll venues with match counts
GET/standingsSeason ladder
GET/tipsWin-probability tips by round
GET/fixtureSeason schedule (Public — no auth)
GET/predictionsWin-probability predictions (filterable, versioned)
GET/predictions/:idGet a single prediction

Ready to start building?

get a free api key →