To enable you to access any tariff currently offered on the planet via a single API - including complex time of use, consumption tier and dynamic market-based - we had to come up with a data model that can universally support both static and dynamic tariff types. This is why we provide tariff as a time series feed that you may find time-consuming to implement or expensive to run (in terms of data storage and processing).

While you are free to access this raw tariff data via our /tariff-rates API endpoint, FlatPeak can also calculate the cost of energy using that tariff, saving you many hours of development and data storage costs, for this, you will use /cost-calculate endpoint.

Please contact support or directly schedule a call with our customer success team if you would like to discuss planning your integration with FlatPeak.

Using cost calculation endpoints

Cost calculations API is a group of endpoints that ingests meter records and returns the monetary cost of energy. In this example, we will cover the instant cost calculation endpoint, but you can also explore using separate metering, time-interval and session-based cost calculation that may better fit your use case.

Here is how to plan your integration to use instant cost calculation API endpoints:

  1. Implement FlatPeak Connect to get consent from your customer to access their tariff and obtain FlatPeak locaiton_id for their supply address.
  2. If you plan to calculate energy cost for a specific device, register it via device-create endpoint to obtain FlatPeak device_id.
  3. Prepare location or device metering record and call instant-cost-calculate endpoint to get the monetary cost of energy.
curl --request POST \
  --url https://api.flatpeak.com/costs/instant \
  --header 'Authorization: Bearer <token>' \
  --data '{
  "location_id": "loc_641b90b758fb8e6293716e40",
  "start_time": "2024-02-01T10:30:00Z",
  "end_time": "2024-02-01T11:16:00Z",
  "units": "W",
  "value": 20567
}'

Using tariff rates endpoint

This endpoint returns live tariff rates by FlatPeak location_id in time series format.

Here is how to plan your integration to use tariff rates endpoint:

  1. Implement FlatPeak Connect to get consent from your customer to access their tariff and obtain FlatPeak locaiton_id for their supply address.
  2. Call tariff-rates endpoint to get your Customer’s tariff. Because FlatPeak provides this data in time-series format, you will need to call this endpoint for every time period when you need to calculate the energy cost.
curl --request GET \
  --url 'https://api.flatpeak.com/tariffs/rates/{id}?start_time=2023-06-15T09:00:00Z&end_time=2023-06-15T23:00:00Z' \
  --header 'Authorization: Bearer <token>'

While using the tariff rates endpoint provides you with maximum flexibility in storing and using tariff data, we recommend you consider cost calculation endpoint that you may find much quicker to implement.