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 a HTTP GET request and in return will receive a return list document in JSON or XML format. The default response format is JSON. You can change the default response format to XML by adding ".xml" extension after the <resource_name> in the requested URL (please see below). The encoding used in our XML is UTF-8. 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 changelog

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. 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.xml?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_versionDefines 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_tokenValid 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:

<?xml version="1.0" encoding="UTF-8"?>
<api version="2.0" timestamp="1425992728">
<method name="events.index" details="<link for method description>" total_items="10" next_page="<link or empty value>"
previous_page="<link or empty value>">
<parameter name="id" value="7"/>
<parameter name="lang" value="en"/>
</method>
 
<data>
      <----DATA---->
</data>
 
</api>

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 OKSuccessful request
304 Not ModifiedSent if data is older than provided "If-Modified-Since" HTTP Header
400 Bad RequestYou have provided a parameter that the function does not support
401 UnauthorizedYou have not provided a username/password or authkey
403 ForbiddenYou have not been authenticated or your subscription does not permit you to request the data you have requested
404 Not FoundYou have requested non-existent data
429 Too Many RequestsYou have made too many requests
500 Internal Server ErrorError is caused by a malfunction on our side. Our IT department is notified about this automatically
501 Not ImplementedThe sport and/or function you have requested does not exist
503 Service unavailableThe 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:

<?xml version="1.0" encoding="UTF-8"?>
<api version="2.0" timestamp="1425992728">
<method name="events.index" details="<link for method description>" total_items="10" next_page="<link or empty value>" previous_page="<link or empty value>">
<parameter name="id" value="7"/>
<parameter name="lang" value="en"/>
</method>
 
<error status="400" message="The request could not be understood by the server" internal_code="1" />
 
</api>

Here is a general explanation about possible error codes:

Internal code

HTTP status

Message

Internal code

HTTP status

Message

1403

Your membership package has expired or is inactive. For more information, please contact our sales department at sales@statscore.com

2403

Invalid credentials. Either the username or the password you provided is incorrect

3400

The timestamp parameter you passed is smaller than the allowed minimum limit for this parameter. When getting this error, the <message> element will contain 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 

4400

Invalid parameter. The format of the parameter is invalid. For more details about the invalid parameter, see the <message> element

5429

You have exceeded the data amount you are allowed. For more information, please contact our sales department at sales@statscore.com

6500

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.

7403Your membership package does not include requested sport
8403Your membership package does not include requested season
9403Your host IP for API connection is invalid.
10403Your subscription has expired or is inactive. For more information, please contact our sales department at sales@statscore.com
11402 Your membership package does not include requested method or access to this method has expired
12404The requested resource was not found
13400Invalid parameter. The date_from or date_to parameter is invalid.
14400Required parameter is missing.
15503We 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 XML:

<api version="2.0" timestamp="1425992728">
<method name="events.index" details="<link for method description>" total_items="10" next_page="<link or empty value>" previous_page="<link or empty value>">
<parameter name="id" value="7"/>
<parameter name="lang" value="en"/>
</method>
<data>
      <!------DATA------!>
</data>

The next request should be as follows:

https://api.statscore.com/<api_version>/<resource_name>/[identifier]?token=<your_token>&timestamp=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.xml&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.xml 




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 for 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 timezone for the output data. The list of available timezones is listed below.


Time, date & timezones

Example: https://api.statscore.com/v2/events.xml?token=<YOUR_TOKEN>&tz=Europe/Warsaw

Africa/AbidjanAmerica/GodthabAntarctica/VostokEurope/AndorraUTC
Africa/AccraAmerica/Goose_BayArctic/LongyearbyenEurope/AthensUTC+1
Africa/Addis_AbabaAmerica/Grand_TurkAsia/AdenEurope/BelgradeUTC+2
Africa/AlgiersAmerica/GrenadaAsia/AlmatyEurope/BerlinUTC+3
Africa/AsmaraAmerica/GuadeloupeAsia/AmmanEurope/BratislavaUTC+4
Africa/BamakoAmerica/GuatemalaAsia/AnadyrEurope/BrusselsUTC+5
Africa/BanguiAmerica/GuayaquilAsia/AqtauEurope/BucharestUTC+6
Africa/BanjulAmerica/GuyanaAsia/AqtobeEurope/BudapestUTC+7
Africa/BissauAmerica/HalifaxAsia/AshgabatEurope/BusingenUTC+8
Africa/BlantyreAmerica/HavanaAsia/BaghdadEurope/ChisinauUTC+9
Africa/BrazzavilleAmerica/HermosilloAsia/BahrainEurope/CopenhagenUTC+10
Africa/BujumburaAmerica/Indiana/IndianapolisAsia/BakuEurope/DublinUTC+11
Africa/CairoAmerica/Indiana/KnoxAsia/BangkokEurope/GibraltarUTC+12
Africa/CasablancaAmerica/Indiana/MarengoAsia/BeirutEurope/GuernseyUTC+13
Africa/CeutaAmerica/Indiana/PetersburgAsia/BishkekEurope/HelsinkiUTC+14
Africa/ConakryAmerica/Indiana/Tell_CityAsia/BruneiEurope/Isle_of_ManUTC-1
Africa/DakarAmerica/Indiana/VevayAsia/ChoibalsanEurope/IstanbulUTC-2
Africa/Dar_es_SalaamAmerica/Indiana/VincennesAsia/ChongqingEurope/JerseyUTC-3
Africa/DjiboutiAmerica/Indiana/WinamacAsia/ColomboEurope/KaliningradUTC-4
Africa/DoualaAmerica/InuvikAsia/DamascusEurope/KievUTC-5
Africa/El_AaiunAmerica/IqaluitAsia/DhakaEurope/LisbonUTC-6
Africa/FreetownAmerica/JamaicaAsia/DiliEurope/LjubljanaUTC-7
Africa/GaboroneAmerica/JuneauAsia/DubaiEurope/LondonUTC-8
Africa/HarareAmerica/Kentucky/LouisvilleAsia/DushanbeEurope/LuxembourgUTC-9
Africa/JohannesburgAmerica/Kentucky/MonticelloAsia/GazaEurope/MadridUTC-10
Africa/JubaAmerica/KralendijkAsia/HarbinEurope/MaltaUTC-11
Africa/KampalaAmerica/La_PazAsia/HebronEurope/MariehamnUTC-12
Africa/KhartoumAmerica/LimaAsia/Ho_Chi_MinhEurope/Minsk
Africa/KigaliAmerica/Los_AngelesAsia/Hong_KongEurope/Monaco
Africa/KinshasaAmerica/Lower_PrincesAsia/HovdEurope/Moscow
Africa/LagosAmerica/MaceioAsia/IrkutskEurope/Oslo
Africa/LibrevilleAmerica/ManaguaAsia/JakartaEurope/Paris
Africa/LomeAmerica/ManausAsia/JayapuraEurope/Podgorica
Africa/LuandaAmerica/MarigotAsia/JerusalemEurope/Prague
Africa/LubumbashiAmerica/MartiniqueAsia/KabulEurope/Riga
Africa/LusakaAmerica/MatamorosAsia/KamchatkaEurope/Rome
Africa/MalaboAmerica/MazatlanAsia/KarachiEurope/Samara
Africa/MaputoAmerica/MenomineeAsia/KashgarEurope/San_Marino
Africa/MaseruAmerica/MeridaAsia/KathmanduEurope/Sarajevo
Africa/MbabaneAmerica/MetlakatlaAsia/KhandygaEurope/Simferopol
Africa/MogadishuAmerica/Mexico_CityAsia/KolkataEurope/Skopje
Africa/MonroviaAmerica/MiquelonAsia/KrasnoyarskEurope/Sofia
Africa/NairobiAmerica/MonctonAsia/Kuala_LumpurEurope/Stockholm
Africa/NdjamenaAmerica/MonterreyAsia/KuchingEurope/Tallinn
Africa/NiameyAmerica/MontevideoAsia/KuwaitEurope/Tirane
Africa/NouakchottAmerica/MontserratAsia/MacauEurope/Uzhgorod
Africa/OuagadougouAmerica/NassauAsia/MagadanEurope/Vaduz
Africa/Porto-NovoAmerica/New_YorkAsia/MakassarEurope/Vatican
Africa/Sao_TomeAmerica/NipigonAsia/ManilaEurope/Vienna
Africa/TripoliAmerica/NomeAsia/MuscatEurope/Vilnius
Africa/TunisAmerica/NoronhaAsia/NicosiaEurope/Volgograd
Africa/WindhoekAmerica/North_Dakota/BeulahAsia/NovokuznetskEurope/Warsaw
America/AdakAmerica/North_Dakota/CenterAsia/NovosibirskEurope/Zagreb
America/AnchorageAmerica/North_Dakota/New_SalemAsia/OmskEurope/Zaporozhye
America/AnguillaAmerica/OjinagaAsia/OralEurope/Zurich
America/AntiguaAmerica/PanamaAsia/Phnom_PenhIndian/Antananarivo
America/AraguainaAmerica/PangnirtungAsia/PontianakIndian/Chagos
America/Argentina/Buenos_AiresAmerica/ParamariboAsia/PyongyangIndian/Christmas
America/Argentina/CatamarcaAmerica/PhoenixAsia/QatarIndian/Cocos
America/Argentina/CordobaAmerica/Port-au-PrinceAsia/QyzylordaIndian/Comoro
America/Argentina/JujuyAmerica/Port_of_SpainAsia/RangoonIndian/Kerguelen
America/Argentina/La_RiojaAmerica/Porto_VelhoAsia/RiyadhIndian/Mahe
America/Argentina/MendozaAmerica/Puerto_RicoAsia/SakhalinIndian/Maldives
America/Argentina/Rio_GallegosAmerica/Rainy_RiverAsia/SamarkandIndian/Mauritius
America/Argentina/SaltaAmerica/Rankin_InletAsia/SeoulIndian/Mayotte
America/Argentina/San_JuanAmerica/RecifeAsia/ShanghaiIndian/Reunion
America/Argentina/San_LuisAmerica/ReginaAsia/SingaporePacific/Apia
America/Argentina/TucumanAmerica/ResoluteAsia/TaipeiPacific/Auckland
America/Argentina/UshuaiaAmerica/Rio_BrancoAsia/TashkentPacific/Chatham
America/ArubaAmerica/Santa_IsabelAsia/TbilisiPacific/Chuuk
America/AsuncionAmerica/SantaremAsia/TehranPacific/Easter
America/AtikokanAmerica/SantiagoAsia/ThimphuPacific/Efate
America/BahiaAmerica/Santo_DomingoAsia/TokyoPacific/Enderbury
America/Bahia_BanderasAmerica/Sao_PauloAsia/UlaanbaatarPacific/Fakaofo
America/BarbadosAmerica/ScoresbysundAsia/UrumqiPacific/Fiji
America/BelemAmerica/SitkaAsia/Ust-NeraPacific/Funafuti
America/BelizeAmerica/St_BarthelemyAsia/VientianePacific/Galapagos
America/Blanc-SablonAmerica/St_JohnsAsia/VladivostokPacific/Gambier
America/Boa_VistaAmerica/St_KittsAsia/YakutskPacific/Guadalcanal
America/BogotaAmerica/St_LuciaAsia/YekaterinburgPacific/Guam
America/BoiseAmerica/St_ThomasAsia/YerevanPacific/Honolulu
America/Cambridge_BayAmerica/St_VincentAtlantic/AzoresPacific/Johnston
America/Campo_GrandeAmerica/Swift_CurrentAtlantic/BermudaPacific/Kiritimati
America/CancunAmerica/TegucigalpaAtlantic/CanaryPacific/Kosrae
America/CaracasAmerica/ThuleAtlantic/Cape_VerdePacific/Kwajalein
America/CayenneAmerica/Thunder_BayAtlantic/FaroePacific/Majuro
America/CaymanAmerica/TijuanaAtlantic/MadeiraPacific/Marquesas
America/ChicagoAmerica/TorontoAtlantic/ReykjavikPacific/Midway
America/ChihuahuaAmerica/TortolaAtlantic/South_GeorgiaPacific/Nauru
America/Costa_RicaAmerica/VancouverAtlantic/St_HelenaPacific/Niue
America/CrestonAmerica/WhitehorseAtlantic/StanleyPacific/Norfolk
America/CuiabaAmerica/WinnipegAustralia/AdelaidePacific/Noumea
America/CuracaoAmerica/YakutatAustralia/BrisbanePacific/Pago_Pago
America/DanmarkshavnAmerica/YellowknifeAustralia/Broken_HillPacific/Palau
America/DawsonAntarctica/CaseyAustralia/CurriePacific/Pitcairn
America/Dawson_CreekAntarctica/DavisAustralia/DarwinPacific/Pohnpei
America/DenverAntarctica/DumontDUrvilleAustralia/EuclaPacific/Port_Moresby
America/DetroitAntarctica/MacquarieAustralia/HobartPacific/Rarotonga
America/DominicaAntarctica/MawsonAustralia/LindemanPacific/Saipan
America/EdmontonAntarctica/McMurdoAustralia/Lord_HowePacific/Tahiti
America/EirunepeAntarctica/PalmerAustralia/MelbournePacific/Tarawa
America/El_SalvadorAntarctica/RotheraAustralia/PerthPacific/Tongatapu
America/FortalezaAntarctica/SyowaAustralia/SydneyPacific/Wake
America/Glace_BayAntarctica/TrollEurope/AmsterdamPacific/Wallis