# Ice hockey odds API

Ice hockey leagues, markets and prices through one REST API.

Ice hockey has the sport key `ice_hockey`. Its events are between two teams, `home` and `away`.

## Leagues

| League | Key | Bookmakers delivering |
| --- | --- | --- |
| [NHL](https://sockodds.com/leagues/nhl-odds-api/) | `nhl` | 15 |

## Request the leagues

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

```javascript
const response = await fetch("https://api.sockodds.com/v1/leagues?sport=ice_hockey", {
  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=ice_hockey",
    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": "nhl",
      "name": "NHL",
      "sport": "ice_hockey",
      "region": "us",
      "periods": [
        "full",
        "regulation",
        "period_1",
        "period_2",
        "period_3"
      ]
    }
  ],
  "meta": {
    "count": 1,
    "cursor": null
  },
  "links": {
    "next": null
  }
}
```

## Markets

18 market types are defined for ice hockey: `result_pair`, `total_goals_odd_even`, `result_exact_score`, `winner`, `result`, `handicap`, `total_goals`, `team_goals_over_under`, `team_shots_on_goal_over_under`, `player_goals_anytime`, `player_goals_first` and `player_goals_last` and more. Each league page lists the markets and periods that apply to it, and [Markets](https://sockodds.com/docs/markets/) lists them all.
