How to Query AFL Odds and Player Props
A walkthrough of the /v2/events endpoint using the AFL as the example: basic requests, filtering player props with oddID, and the parameters that keep responses fast.
If you're new to querying the SockOdds API, this guide is designed to help you hit the ground running. We'll use the AFL as the example to walk through the /v2/events endpoint, from basic requests to filtering player props with oddID.
For full market coverage see the AFL odds API page, or the Aussie rules odds API if you also need AFLW. Every query pattern here works for the AFLW by swapping the leagueID.
Endpoint examples
If you want events with player props, the easiest way is:
https://api.sockodds.com/v2/events?apiKey=YOUR_API_KEY&oddsAvailable=true&leagueID=AFL&limit=10This returns player props in addition to every other market. To get more fine-grained:
https://api.sockodds.com/v2/events?apiKey=YOUR_API_KEY&oddsAvailable=true&leagueID=AFL&oddID=goals-PLAYER_ID-2h-ou-over&includeOpposingOdds=trueThat gives you goals over/unders for all players. PLAYER_ID is a special value meaning "any playerID"; substitute a real playerID to get one player.
OddIDs take the form {statID}-{statEntityID}-{periodID}-{betTypeID}-{sideID}. Five parts: the statistic, the entity, the period, the bet type and the side.
A few extra notes
- Trim the list of oddIDs to the ones you're actually interested in.
- Add a
bookmakerIDparam (e.g.bookmakerID=sportsbet,tab,pointsbet) — both greatly speed up the response. includeOpposingOdds=truemeans you only list the over side and get the under too.includeAltLines=truegets the alt lines but slows the response and grows the payload.
Next steps
Read more: Every AFL Betting Market in the SockOdds API