Authentication

Authentication

Our Solarize API uses JSON Web Tokens (JWT) to authenticate requests. A valid JTW Token can be obtained using an API Token. You can generate API Tokens directly within the app. Please note, that these tokens carry the same permissions as your user. Find more details about the authentication endpoint in the API Docs.

Obtain a valid JWT Token

curl -X POST 'https://api.solarize.energy/v1/oauth' \
  -H 'Content-Type: application/json' \
  -d '{"grantType":"api_token","token":"<API_TOKEN>"}'

Response:

{
  "accessToken": "ey...",
  "refreshToken": "...",
  "clientId": "solarize",
  "tokenType": "Bearer",
  "expiresIn": 3599,
  "createdAt": "2022-01-01T12:00:00.000Z"
}

Authenticated Request Example

curl 'https://api.solarize.energy/v1/sites' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer ey...'

Obtain a new JWT Token

Please note, that the JWT Token will always expire in 60 minutes. You can obtain a new JWT Token by using the refreshToken. The refresh token will expire in 1 day by default.

curl -X POST 'https://api.solarize.energy/v1/oauth' \
  -H 'Content-Type: application/json' \
  -d '{"grantType":"refresh_token","token":"<REFRESH_TOKEN>"}'