In this example, we’ll take a step-by-step approach to obtaining the results of our energy bonus calculations.

1

Obtain a Bearer token

You ‘ll obtain a Bearer token by following authentication as described in introduction.

Then each time an API call is made, use token value in request header.

  Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOi…
2

Retrieve FOST calculation data informations

Energy bonus may be calculated for both B2C and B2B contexts. Our API handle both contexts. Before obtaining the results, we need to determine the fost and the context involved.

In our example, we’ll use the FOST operation in b2b context.

GET /api/v2/simulation-inputs/bar-th-172/b2b

Will produce the following JSON response

{
    "general.zipcode": {
        "name": "Code postal",
        "description": "",
        "type": "input",
        "input": "input_string",
        "index": "zipcode"
    },
    "general.surface": {
        "name": "Surface du logement (m²)",
        "description": "",
        "type": "number",
        "input": "input_type_number",
        "unit": "m²",
        "index": "surface"
    },
    "general.age": {
        "name": "Age du bâtiment",
        "description": "",
        "type": "choice",
        "input": "choice",
        "options": [],
        "index": "age"
    },
    "general.habitation": {
        "name": "Type de logement",
        "description": "",
        "type": "card",
        "input": "choice",
        "options": [
            {
                "label": "Maison",
                "value": "house"
            },
            {
                "label": "Appartement",
                "value": "apartment"
            }
        ],
        "index": "habitation"
    },
    "general.worksiteName": {
        "name": "Nom du site des travaux",
        "description": "",
        "type": "input",
        "input": "input_text",
        "options": [],
        "index": "worksiteName"
    },
    "general.habitationNumber": {
        "name": "Nombre total de logement",
        "description": "",
        "type": "number",
        "input": "number",
        "options": []
    },
    "general.activity": {
        "name": "Type de bénéficiaire",
        "description": "",
        "type": "card",
        "input": "choice",
        "options": [
            {
                "label": "Bailleur social",
                "value": "bailleur-social"
            },
            {
                "label": "Syndic de copropriété",
                "value": "syndic"
            },
            {
                "label": "Autre",
                "value": "other"
            }
        ],
        "index": "activity"
    },
    "general.habitationZone": {
        "name": "Type du bâtiment",
        "description": "",
        "type": "card",
        "input": "input_dropdown",
        "options": [
            {
                "label": "Bâtiment est en zone QPV",
                "value": "zone_qpv"
            },
            {
                "label": "Logements conventionnés",
                "value": "contracted"
            },
            {
                "label": "Autre",
                "value": "other"
            }
        ],
        "index": "habitationZone"
    },
    "general.habitationNumberContracted": {
        "name": "Nombre de logement conventionné",
        "description": "",
        "type": "number",
        "input": "number",
        "options": [],
        "index": "habitationNumberContracted"
    },
    "general.habitationNumberQpv": {
        "name": "Nombre de logement en zone qpv",
        "description": "",
        "type": "number",
        "input": "number",
        "options": [],
        "index": "habitationNumberQpv"
    },
    "general.qpvName": {
        "name": "Nom du quartier prioritaire de la politique de la ville",
        "description": "",
        "type": "input",
        "input": "input_text",
        "options": [],
        "index": "qpvName"
    },
    "general.qpvCode": {
        "name": "Code quartier du quartier prioritaire de la politique de la ville",
        "description": "",
        "type": "input",
        "input": "input_text",
        "options": [],
        "index": "qpvCode"
    },
    "general.worksiteStartDate": {
        "name": "Date de début de chantier",
        "description": "",
        "type": "date",
        "input": "input_date_picker",
        "options": []
    },
    "general.worksiteEndDate": {
        "name": "Date de fin de chantier",
        "description": "",
        "type": "date",
        "input": "input_date_picker",
        "options": []
    },
    "operation.id": {
        "name": "Opération",
        "description": "",
        "type": "fixed",
        "value": "bar-th-172",
        "version": {
            "start": "2024-01-01",
            "end": null
        }
    },
    "operation.usage": {
        "name": "Précisez l'usage de la PAC que vous souhaitez installer",
        "description": "",
        "condition": [],
        "type": "card",
        "options": [
            {
                "label": "Chauffage",
                "value": "heating"
            },
            {
                "label": "Chauffage et eau chaude sanitaire",
                "value": "ecs"
            }
        ]
    },
    "operation.efficiency": {
        "name": "Quelle est l'efficacité énergétique saisionnière de l'appareil ?",
        "description": "",
        "condition": [],
        "type": "number"
    },
    "operation.replacedEnergy": {
        "name": "Préciser le type de matériel que vous souhaitez remplacer",
        "description": "",
        "condition": [],
        "type": "card",
        "options": [
            {
                "label": "Une chaudière fioul",
                "value": "fioul"
            },
            {
                "label": "Une chaudière à gaz",
                "value": "gaz"
            },
            {
                "label": "Une chaudière à charbon",
                "value": "charbon"
            },
            {
                "label": "Autre système de chauffage",
                "value": "other"
            },
            {
                "label": "Pas de dépose",
                "value": "none"
            }
        ]
    },
    "operation.totalCost": {
        "name": "Coût total TTC matériel et pose",
        "description": "",
        "condition": [],
        "type": "input",
        "unit": "euro"
    }
}

The response lists every keys requested to fill the the payload of the calculation endpoint call. When an options for a given key is set, it shows the set of accepted values. For example, for the operation.usage key, accepted values are heating and ecs.

3

Calculate FOST Energy Bonus

We use previous results to make the payload.

POST /api/v2/cee

{
    "general.zipcode": "75015",
    "general.surface": "95",
    "general.age": "27",
    "general.habitation": "house",
    "general.worksiteName": "chantier du 15",
    "general.habitationNumber": "10",
    "general.activity": "bailleur-social",
    "general.habitationZone": "zone_qpv",
    "general.habitationNumberContracted": "10",
    "general.habitationNumberQpv": "10",
    "general.qpvName": "paris qpv 2024",
    "general.qpvCode": "123",
    "general.worksiteStartDate": "2024-07-13",
    "general.worksiteEndDate": "2024-11-17",
    "operation.id": "bar-th-172",
    "operation.usage": "ecs",
    "operation.efficiency": "141",
    "operation.replacedEnergy": "other",
    "operation.totalCost": "97400",
    "eurosMwHCumac": "6.5"
}

Will respond with such results:

{
    "kWhCumac": 103680,
    "kWhCumacClassic": 50803.2,
    "kWhCumacModest": 52876.8,
    "mWhCumac": 103.68,
    "mWhCumacClassic": 50.8,
    "mWhCumacModest": 52.88,
    "euros": 673.92,
    "eurosClassic": 330.22,
    "eurosModest": 343.7
}
Note that eurosMwHCumac was added to the request. It is optional and it is used to fill euros, eurosClassic and eurosModest values