Events API

League

GET/v3/league

Leagues of a sport. Esoccer and Ebasketball leagues belong to their real sport.

Parameters

Send every parameter in the query string, including token.

Query parameters
NameTypeRequiredDescription
tokenstringRequiredYour API token.
sport_idintegerRequiredR-SportID.
ccstringOptionalR-Countries, e.g. 'co' for Colombia.
max_idstringOptionalOnly return leagues with id < max_id.

Notes

Data is returned by id DESC. Call without max_id first, then pass the smallest id as max_id until the result is empty.

Request

Call https://api.odds-data-api.com/v3/league with your token. The examples read it from the ODDS_DATA_API_TOKEN environment variable.

curl "https://api.odds-data-api.com/v3/league?sport_id=1&cc=gb&token=$ODDS_DATA_API_TOKEN"

Response

JSON with success: 1 and results. Values are strings unless shown otherwise. See Response format and R-Pager.

application/json
{
  "success": 1,
  "pager": {
    "min_id": "10041237"
  },
  "results": [
    {
      "id": "10041282",
      "name": "England Premier League",
      "cc": "gb",
      "has_leaguetable": 1,
      "has_toplist": 1
    },
    {
      "id": "10041237",
      "name": "Scotland Premiership",
      "cc": "gb",
      "has_leaguetable": 0,
      "has_toplist": 0
    }
  ]
}

Errors

A failed call returns success: 0 with an error code. This endpoint can return:

Error codes
errorMeaning
AUTHORIZE_FAILEDToken is not provided or is incorrect.
TOO_MANY_REQUESTSAPI rate limit exceeded. See X-RateLimit-Reset.
PERMISSION_DENIEDYour plan does not include this call. Contact support if this is wrong.
PARAM_REQUIREDA required param is missing. Check error_detail.
PARAM_INVALIDA param is invalid. Check error_detail.
Failed call · application/json
{
  "success": 0,
  "error": "PARAM_REQUIRED",
  "error_detail": "sport_id"
}

Like every endpoint, it can also return INTERNAL_SERVER_ERROR, METHOD_NOT_ALLOWED and UNDER_MAINTENANCE. See R-Errors.

Try it

GEThttps://api.odds-data-api.com/v3/league?sport_id=1&cc=gb&token=YOUR-TOKEN
sport_id
1
cc
gb
token
YOUR-TOKEN (from the dashboard)

Requests run with your own token and count toward your hourly limit.