API service
The API service is based on the REST architecture and supports a number of resources accessed with HTTP protocol. The client should send an HTTP GET request and in return will receive a return list document in JSON format. API support multiple simultaneous requests from authenticated customers.
We have standardized the output for ALL sports, so we offer the same format and data structure. However, for each sports, there are different event details, incidents, and statistics that are explained in more detail in the Sports data structure section.
Please note that new event details, incidents, and statistics could be added in the future. Whenever new features are added to the API you will find a description in the API change log.
Authentication
Access to the API is based on the oAuth 2.0 authorization method. This means access is given using a unique token without any IP's restriction.
The client is authenticated using a GET request including query string parameters: client_id and secret_key. These parameters are assigned to you by our sales department. On confirmation of the client_id/secret_key combination, the special oAuth token is then returned. The maximum period of time the token is valid is 24 hours from the time it was generated. This token should be sent with all subsequent requests.
Example token request:
https://api.statscore.com/v2/oauth?client_id=<YOUR_CLIENT_ID>&secret_key=<YOUR_SECRET_KEY>
Retrieving data
For access to the feed it is necessary to send a URL request containing the following segments:
Base URL: https://api.statscore.com/<api_version>/<resource_name>?token=<YOUR_TOKEN>
api_version | Defines which version of API you want to use. The segment is required. Current API version: v2 |
---|---|
resource_name | Defines requested resource_name. The segment is required. |
your_token | The valid token generated during the authentication process |
In the event you would like additional filtering of the data, you can request a combination of the resource query parameters. For example, the following URL returns all events for basketball (sport_id=1): https://api.statscore.com/<api_version>/events?token=<YOUR_TOKEN>&sport_id=1. The possible parameters for all resources are described in the detailed specifications.
Feed structure
All responses to a successful request (HTTP status code = 200) have the same structure:
"api": { "ver": "2.146.0", "timestamp": 1575991564, "method": { "parameters": { "client_id": 1, "events_details": "yes" }, "name": "events.index", "details": "events.index", "total_items": 511, "previous_page": "", "next_page": "https://api.statscore.com/v2/events?token=YOUR_TOKEN&client_id=1&page=2" }, "data": { ... } }
Element "api" is heading element for each response. The "api" element includes attributes:
version - means the version in which the data is processed. You should always use the proper version in your code. You can switch the version in the URL request. For more information about versions please see our API changelog.
timestamp - UNIX TIMESTAMP value from API server. This value is generated on every request.
The "data" element contains all requested information.
For each request the HTTP Status code is also returned with a response. A list of all possible HTTP status codes:
HTTP status code | Cause |
---|---|
200 OK | Successful request |
304 Not Modified | Sent if data is older than provided "If-Modified-Since" HTTP Header |
400 Bad Request | You have provided a parameter that the function does not support |
401 Unauthorized | You have not provided a username/password or authkey |
403 Forbidden | You have not been authenticated or your subscription does not permit you to request the data you have requested |
404 Not Found | You have requested non-existent data |
429 Too Many Requests | You have made too many requests |
500 Internal Server Error | Error is caused by a malfunction on our side. Our IT department is notified about this automatically |
501 Not Implemented | The sport and/or function you have requested does not exist |
503 Service unavailable | The Web server is currently unable to handle the HTTP request due to maintenance of the server |
Unsuccessful requests/ errors
For unsuccessful requests the response contains <error> element:
"api": { "ver": "2.146.0", "timestamp": 1575991564, "method": { "parameters": { "client_id": 1, "events_details": "yes" }, "name": "events.index", "details": "events.index", "total_items": 511, "previous_page": "", "next_page": "https://api.statscore.com/v2/events?token=YOUR_TOKEN&client_id=1&page=2" }, "error": { "message": "Invalid credentials. Either the username, password or token you provided is incorrect", "status": 401, "internal_code": 2 } }
Here is a general explanation of possible error codes:
Internal code | HTTP status | Message |
---|---|---|
1 | 403 | Your membership package has expired or is inactive. For more information, please contact our sales department at sales@statscore.com |
2 | 403 | Invalid credentials. Either the username or the password you provided is incorrect |
3 | 400 | The timestamp parameter you passed is smaller than the allowed minimum limit for this parameter. When getting this error, the <message> element will contains more information about the minimal timestamp allowed. In the event you want all the information since our minimal timestamp, do not pass the timestamp parameter |
4 | 400 | Invalid parameter. The format of the parameter is invalid. For more details about the invalid parameter, see the <message> element |
5 | 429 | You have exceeded the data amount you are allowed. For more information, please contact our sales department at sales@statscore.com |
6 | 500 | Internal error. When getting this error code, please try resending your request, also inform our support team at tech-support@statscore.com so we can fix this problem as soon as possible. |
7 | 403 | Your membership package does not include requested sport |
8 | 403 | Your membership package does not include requested season |
9 | 403 | Your host IP for API connection is invalid. |
10 | 403 | Your subscription has expired or is inactive. For more information, please contact our sales department at sales@statscore.com |
11 | 402 | Your membership package does not include requested method or access to this method has expired |
12 | 404 | The requested resource was not found |
13 | 400 | Invalid parameter. The date_from or date_to parameter is invalid. |
14 | 400 | Required parameter is missing. |
15 | 503 | We are performing scheduled maintenance. We should be back shortly |
Using timestamp
When any request is made, the response contains a timestamp value showing the time of the last generated response.
If you want to receive feed updates rather than refresh the whole feed then you can store this value and use it in your next request. In the documentation of each resource, we have included cache times. The cache times need to be considered when calling particular requests.
For example: Suppose you refreshed all your data and got the following header in the response:
"api": { "ver": "2.146.0", "timestamp": 1425992728, "method": { "parameters": { "client_id": 1, "events_details": "yes" }, "name": "events.index", "details": "events.index", "total_items": 511, "previous_page": "", "next_page": "https://api.statscore.com/v2/events?token=YOUR_TOKEN&client_id=1&page=2" }, "data": { ... } }
The next request should be as follows:
https://api.statscore.com/<api_version>/<resource_name>/[identifier]?token=<your_token>×tamp=1425992728
Languages
The default feed language is English. If you would like to get the feed translated you can add as a query parameter (lang) to your request e.g. https://api.statscore.com/v2/areas&lang=pl returns the areas in the Polish language. The list of more popular languages are listed below, or you can get the list of all languages available using: https://api.statscore.com/v2/languages
Possible value Translation language Possible value Translation language Possible value Translation language br cs de el en es fi fr hr Brasilian Czech German Greek English Spanish Finnish French Croatian id it ka ko mx nl no pl pt Indonesian Italian Georgian Korean Mexican Dutch Norwegian Polish Portuguese ro ru sr sv th tr vi zh Romanian Russian Serbian Swedish Thai Turkish Vietnamese Chinise
Please note that all dates and times are always displayed in the UTC format. This also applies to the timestamps available at the top of the feed structure. All dates used in our services use the ISO 8601 date and time format. For some resources, you can use the query parameter "tz" which determines the timezone for the output data. The list of available time zones is listed below.
Time, date & timezones
Example: https://api.statscore.com/v2/events?token=<YOUR_TOKEN>&tz=Europe/Warsaw
Africa/Abidjan | America/Godthab | Antarctica/Vostok | Europe/Andorra | UTC |
Africa/Accra | America/Goose_Bay | Arctic/Longyearbyen | Europe/Athens | UTC+1 |
Africa/Addis_Ababa | America/Grand_Turk | Asia/Aden | Europe/Belgrade | UTC+2 |
Africa/Algiers | America/Grenada | Asia/Almaty | Europe/Berlin | UTC+3 |
Africa/Asmara | America/Guadeloupe | Asia/Amman | Europe/Bratislava | UTC+4 |
Africa/Bamako | America/Guatemala | Asia/Anadyr | Europe/Brussels | UTC+5 |
Africa/Bangui | America/Guayaquil | Asia/Aqtau | Europe/Bucharest | UTC+6 |
Africa/Banjul | America/Guyana | Asia/Aqtobe | Europe/Budapest | UTC+7 |
Africa/Bissau | America/Halifax | Asia/Ashgabat | Europe/Busingen | UTC+8 |
Africa/Blantyre | America/Havana | Asia/Baghdad | Europe/Chisinau | UTC+9 |
Africa/Brazzaville | America/Hermosillo | Asia/Bahrain | Europe/Copenhagen | UTC+10 |
Africa/Bujumbura | America/Indiana/Indianapolis | Asia/Baku | Europe/Dublin | UTC+11 |
Africa/Cairo | America/Indiana/Knox | Asia/Bangkok | Europe/Gibraltar | UTC+12 |
Africa/Casablanca | America/Indiana/Marengo | Asia/Beirut | Europe/Guernsey | UTC+13 |
Africa/Ceuta | America/Indiana/Petersburg | Asia/Bishkek | Europe/Helsinki | UTC+14 |
Africa/Conakry | America/Indiana/Tell_City | Asia/Brunei | Europe/Isle_of_Man | UTC-1 |
Africa/Dakar | America/Indiana/Vevay | Asia/Choibalsan | Europe/Istanbul | UTC-2 |
Africa/Dar_es_Salaam | America/Indiana/Vincennes | Asia/Chongqing | Europe/Jersey | UTC-3 |
Africa/Djibouti | America/Indiana/Winamac | Asia/Colombo | Europe/Kaliningrad | UTC-4 |
Africa/Douala | America/Inuvik | Asia/Damascus | Europe/Kiev | UTC-5 |
Africa/El_Aaiun | America/Iqaluit | Asia/Dhaka | Europe/Lisbon | UTC-6 |
Africa/Freetown | America/Jamaica | Asia/Dili | Europe/Ljubljana | UTC-7 |
Africa/Gaborone | America/Juneau | Asia/Dubai | Europe/London | UTC-8 |
Africa/Harare | America/Kentucky/Louisville | Asia/Dushanbe | Europe/Luxembourg | UTC-9 |
Africa/Johannesburg | America/Kentucky/Monticello | Asia/Gaza | Europe/Madrid | UTC-10 |
Africa/Juba | America/Kralendijk | Asia/Harbin | Europe/Malta | UTC-11 |
Africa/Kampala | America/La_Paz | Asia/Hebron | Europe/Mariehamn | UTC-12 |
Africa/Khartoum | America/Lima | Asia/Ho_Chi_Minh | Europe/Minsk | |
Africa/Kigali | America/Los_Angeles | Asia/Hong_Kong | Europe/Monaco | |
Africa/Kinshasa | America/Lower_Princes | Asia/Hovd | Europe/Moscow | |
Africa/Lagos | America/Maceio | Asia/Irkutsk | Europe/Oslo | |
Africa/Libreville | America/Managua | Asia/Jakarta | Europe/Paris | |
Africa/Lome | America/Manaus | Asia/Jayapura | Europe/Podgorica | |
Africa/Luanda | America/Marigot | Asia/Jerusalem | Europe/Prague | |
Africa/Lubumbashi | America/Martinique | Asia/Kabul | Europe/Riga | |
Africa/Lusaka | America/Matamoros | Asia/Kamchatka | Europe/Rome | |
Africa/Malabo | America/Mazatlan | Asia/Karachi | Europe/Samara | |
Africa/Maputo | America/Menominee | Asia/Kashgar | Europe/San_Marino | |
Africa/Maseru | America/Merida | Asia/Kathmandu | Europe/Sarajevo | |
Africa/Mbabane | America/Metlakatla | Asia/Khandyga | Europe/Simferopol | |
Africa/Mogadishu | America/Mexico_City | Asia/Kolkata | Europe/Skopje | |
Africa/Monrovia | America/Miquelon | Asia/Krasnoyarsk | Europe/Sofia | |
Africa/Nairobi | America/Moncton | Asia/Kuala_Lumpur | Europe/Stockholm | |
Africa/Ndjamena | America/Monterrey | Asia/Kuching | Europe/Tallinn | |
Africa/Niamey | America/Montevideo | Asia/Kuwait | Europe/Tirane | |
Africa/Nouakchott | America/Montserrat | Asia/Macau | Europe/Uzhgorod | |
Africa/Ouagadougou | America/Nassau | Asia/Magadan | Europe/Vaduz | |
Africa/Porto-Novo | America/New_York | Asia/Makassar | Europe/Vatican | |
Africa/Sao_Tome | America/Nipigon | Asia/Manila | Europe/Vienna | |
Africa/Tripoli | America/Nome | Asia/Muscat | Europe/Vilnius | |
Africa/Tunis | America/Noronha | Asia/Nicosia | Europe/Volgograd | |
Africa/Windhoek | America/North_Dakota/Beulah | Asia/Novokuznetsk | Europe/Warsaw | |
America/Adak | America/North_Dakota/Center | Asia/Novosibirsk | Europe/Zagreb | |
America/Anchorage | America/North_Dakota/New_Salem | Asia/Omsk | Europe/Zaporozhye | |
America/Anguilla | America/Ojinaga | Asia/Oral | Europe/Zurich | |
America/Antigua | America/Panama | Asia/Phnom_Penh | Indian/Antananarivo | |
America/Araguaina | America/Pangnirtung | Asia/Pontianak | Indian/Chagos | |
America/Argentina/Buenos_Aires | America/Paramaribo | Asia/Pyongyang | Indian/Christmas | |
America/Argentina/Catamarca | America/Phoenix | Asia/Qatar | Indian/Cocos | |
America/Argentina/Cordoba | America/Port-au-Prince | Asia/Qyzylorda | Indian/Comoro | |
America/Argentina/Jujuy | America/Port_of_Spain | Asia/Rangoon | Indian/Kerguelen | |
America/Argentina/La_Rioja | America/Porto_Velho | Asia/Riyadh | Indian/Mahe | |
America/Argentina/Mendoza | America/Puerto_Rico | Asia/Sakhalin | Indian/Maldives | |
America/Argentina/Rio_Gallegos | America/Rainy_River | Asia/Samarkand | Indian/Mauritius | |
America/Argentina/Salta | America/Rankin_Inlet | Asia/Seoul | Indian/Mayotte | |
America/Argentina/San_Juan | America/Recife | Asia/Shanghai | Indian/Reunion | |
America/Argentina/San_Luis | America/Regina | Asia/Singapore | Pacific/Apia | |
America/Argentina/Tucuman | America/Resolute | Asia/Taipei | Pacific/Auckland | |
America/Argentina/Ushuaia | America/Rio_Branco | Asia/Tashkent | Pacific/Chatham | |
America/Aruba | America/Santa_Isabel | Asia/Tbilisi | Pacific/Chuuk | |
America/Asuncion | America/Santarem | Asia/Tehran | Pacific/Easter | |
America/Atikokan | America/Santiago | Asia/Thimphu | Pacific/Efate | |
America/Bahia | America/Santo_Domingo | Asia/Tokyo | Pacific/Enderbury | |
America/Bahia_Banderas | America/Sao_Paulo | Asia/Ulaanbaatar | Pacific/Fakaofo | |
America/Barbados | America/Scoresbysund | Asia/Urumqi | Pacific/Fiji | |
America/Belem | America/Sitka | Asia/Ust-Nera | Pacific/Funafuti | |
America/Belize | America/St_Barthelemy | Asia/Vientiane | Pacific/Galapagos | |
America/Blanc-Sablon | America/St_Johns | Asia/Vladivostok | Pacific/Gambier | |
America/Boa_Vista | America/St_Kitts | Asia/Yakutsk | Pacific/Guadalcanal | |
America/Bogota | America/St_Lucia | Asia/Yekaterinburg | Pacific/Guam | |
America/Boise | America/St_Thomas | Asia/Yerevan | Pacific/Honolulu | |
America/Cambridge_Bay | America/St_Vincent | Atlantic/Azores | Pacific/Johnston | |
America/Campo_Grande | America/Swift_Current | Atlantic/Bermuda | Pacific/Kiritimati | |
America/Cancun | America/Tegucigalpa | Atlantic/Canary | Pacific/Kosrae | |
America/Caracas | America/Thule | Atlantic/Cape_Verde | Pacific/Kwajalein | |
America/Cayenne | America/Thunder_Bay | Atlantic/Faroe | Pacific/Majuro | |
America/Cayman | America/Tijuana | Atlantic/Madeira | Pacific/Marquesas | |
America/Chicago | America/Toronto | Atlantic/Reykjavik | Pacific/Midway | |
America/Chihuahua | America/Tortola | Atlantic/South_Georgia | Pacific/Nauru | |
America/Costa_Rica | America/Vancouver | Atlantic/St_Helena | Pacific/Niue | |
America/Creston | America/Whitehorse | Atlantic/Stanley | Pacific/Norfolk | |
America/Cuiaba | America/Winnipeg | Australia/Adelaide | Pacific/Noumea | |
America/Curacao | America/Yakutat | Australia/Brisbane | Pacific/Pago_Pago | |
America/Danmarkshavn | America/Yellowknife | Australia/Broken_Hill | Pacific/Palau | |
America/Dawson | Antarctica/Casey | Australia/Currie | Pacific/Pitcairn | |
America/Dawson_Creek | Antarctica/Davis | Australia/Darwin | Pacific/Pohnpei | |
America/Denver | Antarctica/DumontDUrville | Australia/Eucla | Pacific/Port_Moresby | |
America/Detroit | Antarctica/Macquarie | Australia/Hobart | Pacific/Rarotonga | |
America/Dominica | Antarctica/Mawson | Australia/Lindeman | Pacific/Saipan | |
America/Edmonton | Antarctica/McMurdo | Australia/Lord_Howe | Pacific/Tahiti | |
America/Eirunepe | Antarctica/Palmer | Australia/Melbourne | Pacific/Tarawa | |
America/El_Salvador | Antarctica/Rothera | Australia/Perth | Pacific/Tongatapu | |
America/Fortaleza | Antarctica/Syowa | Australia/Sydney | Pacific/Wake | |
America/Glace_Bay | Antarctica/Troll | Europe/Amsterdam | Pacific/Wallis |