The API must be used server-to-server and requires the use of an Oauth key and secret.

Contact OPX team to get your key and secret

URL

The production URL is https://api.opx.co/energy-bonus/

Authentication

Energy Bonus API can be used after issuing an access token. It can be obtained with you client credentials key and secret.

POST /oauth/token

{
    "grant_type" : "client_credentials",
    "client_id" : "{{client_id}}",
    "client_secret" : "{{client_secret}}",
    "scope" : "*"
}

You’ll get an access token in the json response:

{
   "token_type": "Bearer",
   "expires_in": 31536000,
   "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI5…"
}

The expires_in value is expressed in seconds. So it is not necessary to request a new access token each time it is needed to perform other requests. It can be cached and reused many times.

Core principles

OPX provides a single endpoint to get , and amounts when they are availabe.

The request must be sent with a payload represented by a json object. The json object must respect the following structure:

{
   "general.age":"16",
   "general.habitation":"house",
    	... 
   "operation.id":"bar-th-129",
       ... 
}

The general.* keys are mandatory. They are dedicated to specify the properties of simulation representing generic housing or building data.

The operation.* keys are also mandatory. They are used to expose the operation to compute and its very specific properties.

How to fill in and define these keys are expressed by calling another endpoint (see example).