Authentication

Whether you are a user or an operator, the first thing you have to do to control your chargers is to authenticate via our REST API.

Credentials

The Easee APIs uses OAuth2 for authorization. Call the Authenticate endpoint and provide your credentials in the body to obtain your access token. Both email and phone number is a valid userName. If phone number is used, the country code must be included.

curl --request POST \
     --url https://api.easee.cloud/api/accounts/token \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/*+json' \
     --data '
{
     "userName": "<userName>",
     "password": "<password>"
}
'

Successful response

If your request is successful, your response will look something like this:

{
    "accessToken": "eyJhbGcitiJIUzI1jiIsInR5cCI9IkpXVCJ9.eyJBY2NvdW50SWQiOjIwMjUwMywiVXNlcklkIjoxNzI4MTIsInVuaXF1ZV9uYW1lIjoiMjAyNTAzIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNjUwODY5ODYzLCJleHAiOjE2NTA5NTYyNjMsImlhdCI6MTY1MDg2OTg2M30.cDdFvXsucU9D2qCQstFXsdDiC0LMpNkG9YMXOf0mznM",
    "expiresIn": 86400,
    "accessClaims": [
        "Partner"
    ],
    "tokenType": "Bearer",
    "refreshToken": "dAzJJWlUTszzKpcQpeJj5wlO4EPIWsx5nOP4ntiOBJc="
}

Authorization

The access token is valid for 24 hours and must be included in all API calls in the header as type Authorization with the value Bearer , as such:

curl --request GET \
     --url https://api.easee.cloud/api/accounts/profile \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer <accessToken>'

Refreshing Credentials

In order for automated systems to always have valid credentials without storing and resending the username and password, refresh token must be requested.

The token should be refreshed if it expires or is invalidated (returns 4xx).


Did this page help you?