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.
| Parameter | Default | Range | Description |
|---|---|---|---|
| limit | 50 | 1 -- 200 | Number of records to return |
| offset | 0 | 0+ | 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.
| Parameter | Type | Description |
|---|---|---|
| sort_by | string | Column to sort by (see valid values per endpoint) |
| order | string | asc 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.
| Status | Body | Meaning |
|---|---|---|
| 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.
| Method | Path | Description |
|---|---|---|
| GET | /teams | List all teams |
| GET | /teams/:id | Get single team |
| GET | /teams/:id/stats | Aggregated team stats per match |
| GET | /players | List players (search, filter) |
| GET | /players/:id | Get single player |
| GET | /players/:id/career | Career totals + averages |
| GET | /players/:id/season | Season totals + averages |
| GET | /matches | List matches (filter by team, venue, dates) |
| GET | /matches/:id | Get single match |
| GET | /player-stats | Per-match player stats (sortable) |
| GET | /player-stats-advanced | Per-match advanced stats (sortable) |
| GET | /player-team-assignments | Transfer / movement history |
| GET | /leaderboards | Top players by any stat |
| GET | /head-to-head | Match history between two teams |
| GET | /venues | All venues with match counts |
| GET | /standings | Season ladder |
| GET | /tips | Win-probability tips by round |
| GET | /fixture | Season schedule (Public — no auth) |
| GET | /predictions | Win-probability predictions (filterable, versioned) |
| GET | /predictions/:id | Get a single prediction |
Ready to start building?
get a free api key →