OPEN NAVIGATION MENU

Getting started with ElenaSport.io

The new, simple way to access our API

ElenaSport.io implements the OAuth2 client credentials flow to let you access the Football API. With the OAuth2 client credentials flow, your app sends the API key to the authorization endpoint (1) that is set up to create an Access Token if the API key is valid (2). The access token will then be used to call the Football API endpoints (3).

1. Request Access Token

To request an access token, the client POSTs an API call to the authorization endpoint with the Basic <API key> as the Authorization header. In addition, the parameter grant_type=client_credentials must be passed as a query parameter.

Endpoint POST https://oauth2.elenasport.io/oauth2/token
Authorization (header) Basic <API key>
Content-Type (header) application/x-www-form-urlencoded
grant_type (body) client_credentials

Create a new account or log in to an existing one to know your API key.

2. Response Access Token

If the API key is valid, the endpoint will reply with a 200-OK response with the following body. Otherwise, an error will be shown.


  
      {
  "access_token": "eyJraWQiOiJtaGdzWDNGZ1wvd0kyRzR3Z1JQZ2FJTmJmbjllQTFiWkszcnlnOUgzWFZoMD0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI0NWxrYjRwZ3JzcWQ4aTIwdXJlNDl0dnFpYiIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiZm9vdGJhbGwtZGVidWcuZWxlbmFzcG9ydC5pb1wvcmVhZDoqIiwiYXV0aF90aW1lIjoxNTk0Mzg4Mzc4LCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAuZXUtd2VzdC0xLmFtYXpvbmF3cy5jb21cL2V1LXdlc3QtMV9sdFdMNzVoYnEiLCJleHAiOjE1OTQzOTE5NzgsImlhdCI6MTU5NDM4ODM3OCwidmVyc2lvbiI6MiwianRpIjoiMmIxNjczYzQtY2NkOS00MGMzLTliY2UtZDQxOGJlYmJhYWRmIiwiY2xpZW50X2lkIjoiNDVsa2I0cGdyc3FkOGkyMHVyZTQ5dHZxaWIifQ.L-QerQB_VcseWnNj9yQaQTgt_PpJxK0Qye1ufyTzEHcmA_vmM5aQkDkCTfYPHYvWvryLRvhf0iDpN3Pg2jdtmC1JzD8zIChpcIv02qY1O2ONU1oso97rQOipmE3Bcz_91TOtkz71dbrkQUv-LS1cEO6CdsKPM_KACtex7ysSVYbpuPQADrGtA9-4qLhhczOz5X0clUszH1AEvuSEdwgSt7hRYODFniUWgX0gJwKtFJjbt2Ucpy-bvLABmt-pih99QsYsgprztY7XK3MXJFgfcmgcrFhjA35XiJIbJSKLbYft3tcuMGxictrARWITpQyU_wfQ5haRgUOa7__kaW61SQ",
  "expires_in": 3600,
  "token_type": "Bearer"
}
    
  

3. Make authenticated calls to the Football API endpoints

The access token must be passed with every calls to the football endpoints as the Authorization header (prepend the access token with the word Bearer) Authorization: Bearer <Access Token>. The access token is short-lived for security reason (it expires after 1 hour). When it expires you'll receive a 403-Forbidden response with the following body. When it happens, request a new one.


  
      {
  "status": 403,
  "type": "Forbidden",
  "message": "Token expired. If the token is an Access Token, you need to create a new one.",
  "requestId": "e76fcb2a-7d09-4d16-b263-cad3216c7a6b"
}