Queries using JWT Token

JWT Token

For sensitive site data, a JSON Web Token (JWT) needs to be passed in the query header. Kaizen uses Machine-to-Machine Authentication using a JWT token to allow data to be retrieved from the endpoints listed below.

JWT tokens can be reused but have a built-in expiry date and would need to be regenerated every 30 days to ensure secure transfer of data.

To generate a JWT token, client_secret and client_id are needed. Contact Customer Solutions at [email protected] to get client_secret and client_id.

Query Type:

POST

Body:

Key Value Description
client_id client_id_ Contact [email protected] to obtain your client id
client_secret client_secret Contact [email protected] to obtain your client key
audience organize DEPRECATED AFTER JULY 2023
grant_type client_credentials

Query URL

NEW:

https://login-ca-central-prod.coppertreeanalytics.com/oauth2/token

https://login-us-east-prod.coppertreeanalytics.com/oauth2/token

DEPRECATED AFTER JULY 2023:

https://login-global.coppertreeanalytics.com/oauth/token

Query

curl --request POST \ 
     --url https://kaizen.coppertreeanalytics.com/oauth/token \ 
     --header "content-type: application/x-www-form-urlencoded" \ 
     --data "grant_type=client_credentials" \ 
     --data "client_id=<client_id>" \ 
     --data "client_secret=<client_secret>" \ 
     --data "audience=organize"

The response from this cURL command includes the JWT access_token, the scope, or the servers we can reach using the JWT token, and the expiry time and the token_type which is Bearer by default.

To use this token, you can pass it in the query header as ‘Authorization’:’Bearer {}’.format(access_token) where access_token is the generated JWT token.

The following Queries use JWT Token:

  1. Building: Used to retrieve all buildings in the account. Click here to know about endpoints used to query building data and the expected responses
  2. System: Used to get systems in a building in the raw, grouped or tree format. Click here to learn more about the endpoints used to retrieve system data. Click here to know more about Systems in Kaizen
  3. Insights: Kaizen’s rules trigger Insights. These insights can be retrieved by using the endpoints listed here and the JWT token. To learn more about insights, click here.
  4. Objects: For a specific building, objects in a building can be retrieved by using the endpoints listed here. Click here to know more about Objects on Kaizens.