Getting tariff rates
In this tutorial, you will learn how obtain your customer’s tariff rates and use it to calculate your customer’s energy cost.
Why FlatPeak uses time-series format
FlatPeak’s data model allows you to access any tariff, including dynamic, time-of-use, and tiered in a unified format. It uses a time-series dataset, similar to a stock market tracker.
While this approach may be less convenient for flat tariffs, it ensures that you only need to integrate tariff data once, without worrying about future format changes or complexities.
Using Rates API
Follow the steps below to get data from the tariff rates API endpoint:
Connect tariff
Run the Connect flow and make a note of the location_id
.
Get tariff rates
Call tariff-rates endpoint with that location_id
.
Data units, precision and rounding
FlatPeak works with large currency units across all interfaces and API endpoints. It will always return tariff data with the maximum precision available, today this may mean 4 or even 5 fractional digits i.e. (EUR) 0.12345
.
We recommend that you implement rounding in your user interfaces. You can use this Connect-web example as reference.
How often tariff data is refreshed
Every tariff rates API response includes the next_update
key that indicates when tariff information may be refreshed from its source. For example, when market rates are published or when FlatPeak systems are scheduled to pull tariff updates from your customers’ account with their energy provider.
We recommend you always rely on data in the next_update
key to get your systems to pull updated rates. If you are unable to create a dynamic schedule, you can presume that tomorrow’s rates will be updated by 23.00 local time the day earlier.
Calculating energy cost using Rates
Because FlatPeak provides rates data in time-series format, you need to call Rates endpoint for every period you need tariff data for. You can get one month of data per request.
While using Rates endpoint provides maximum flexibility, if you need to report cost of energy your device is using or exporting, consider using Cost Calculations API which you may find much simplier to implement.
Was this page helpful?