Events API
League
/v3/leagueLeagues of a sport. Esoccer and Ebasketball leagues belong to their real sport.
Parameters
Send every parameter in the query string, including token.
| Name | Type | Required | Description |
|---|---|---|---|
| token | string | Required | Your API token. |
| sport_id | integer | Required | R-SportID. |
| cc | string | Optional | R-Countries, e.g. 'co' for Colombia. |
| max_id | string | Optional | Only 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.
{
"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 | Meaning |
|---|---|
| AUTHORIZE_FAILED | Token is not provided or is incorrect. |
| TOO_MANY_REQUESTS | API rate limit exceeded. See X-RateLimit-Reset. |
| PERMISSION_DENIED | Your plan does not include this call. Contact support if this is wrong. |
| PARAM_REQUIRED | A required param is missing. Check error_detail. |
| PARAM_INVALID | A param is invalid. Check error_detail. |
{
"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
https://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.
