• Register

How to get an Access Token

Access to our services is controlled by tokens for via Oauth2.0. To obtain a token you must invoke the associated endpoint and provide your client key and client secret. The tokens are valid for 300 seconds and you can use it for all Public APIs

Request URI 

Code snippet: Call

POST https://api.terna.it/transparency/oauth/accessToken
    Content-Type: application/x-www-form-urlencoded
    
POST ParameterValue
client_id Your client application key
client_secret Your client secret
grant_type "client_credentials"

Request Example

Code snippet: Curl

curl -H "Content-Type: application/x-www-form-urlencoded" "https://api.terna.it/transparency/oauth/accessToken" -X POST -d "client_id=5d4rscEcpyxywu4jdoiWerhsl" -d "client_secret=Iy4c6tuErp" -d "grant_type=client_credentials"
    

Definition of the response structure

KeyDescription
access_token  Your new Access Token
token_type  We use Bearer token
expires_in The number of second before the token expires (300)

Response Example

Code snippet: Json

{     
            "access_token":     "d8bmzggu72dy69tzkffe6vaa",
            "token_type"  :     "bearer",     
            "expires_in"  :     300     
    }