> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opx.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> The Energy Bonus OPX API is structured following REST principles and utilizes JSON-encoded data payloads.

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

<Note>Contact OPX team to get your key and secret</Note>

### 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`

```json theme={null}
{
    "grant_type" : "client_credentials",
    "client_id" : "{{client_id}}",
    "client_secret" : "{{client_secret}}",
    "scope" : "*"
}
```

You'll get an **access token** in the json response:

```json theme={null}
{
   "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 <Tooltip tip="Certificat d'Économie d'Énergie">CEE</Tooltip>, <Tooltip tip="MaPrimeRenov'">MPR</Tooltip> and <Tooltip tip="Coup de Pouce">CDP</Tooltip> 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 <Tooltip tip="Fiche d'opération standardisée">FOST</Tooltip> operation to compute and its very specific properties.

How to fill in and define these keys are expressed by calling another endpoint (see [example](/api-reference/energy-bonus/example)).
