# Australian football odds API

Australian football leagues, markets and prices through one REST API.

Australian football has the sport key `australian_football`. Its events are between two teams, `home` and `away`.

## Leagues

| League | Key | Bookmakers delivering |
| --- | --- | --- |
| [AFL](https://sockodds.com/leagues/afl-odds-api/) | `afl` | 0 |
| [AFL Women's](https://sockodds.com/leagues/aflw-odds-api/) | `aflw` | 3 |

## Request the leagues

```bash
curl -sS "https://api.sockodds.com/v1/leagues?sport=australian_football" \
  -H "Authorization: Bearer $SOCKODDS_API_KEY"
```

```javascript
const response = await fetch("https://api.sockodds.com/v1/leagues?sport=australian_football", {
  headers: { Authorization: `Bearer ${process.env.SOCKODDS_API_KEY}` },
});
console.log(JSON.stringify(await response.json(), null, 2));
```

```python
import json, os, urllib.request

request = urllib.request.Request(
    "https://api.sockodds.com/v1/leagues?sport=australian_football",
    headers={"Authorization": "Bearer " + os.environ["SOCKODDS_API_KEY"]},
)
with urllib.request.urlopen(request) as response:
    print(json.dumps(json.load(response), indent=2))
```

Response (from a local copy of the API with invented test prices):

```json
{
  "data": [
    {
      "key": "afl",
      "name": "AFL",
      "sport": "australian_football",
      "region": "au",
      "periods": [
        "full",
        "half_1",
        "half_2",
        "quarter_1",
        "quarter_2",
        "quarter_3",
        "quarter_4"
      ]
    },
    {
      "key": "aflw",
      "name": "AFL Women's",
      "sport": "australian_football",
      "region": "au",
      "periods": [
        "full",
        "half_1",
        "half_2",
        "quarter_1",
        "quarter_2",
        "quarter_3",
        "quarter_4"
      ]
    }
  ],
  "meta": {
    "count": 2,
    "cursor": null
  },
  "links": {
    "next": null
  }
}
```

## Markets

16 market types are defined for australian football: `winner`, `handicap`, `total_points`, `total_goals`, `team_points_over_under`, `team_goals_over_under`, `player_goals_anytime`, `player_goals_first`, `player_goals_last`, `player_goals_over_under`, `player_disposals_over_under` and `player_kicks_over_under` and more. Each league page lists the markets and periods that apply to it, and [Markets](https://sockodds.com/docs/markets/) lists them all.
