If all the input information you have is the amount of time your device needs to be consuming or exporting energy, call the planning-duration API endpoint.FlatPeak will use the Location tariff and, if present, data on local generation to find the lowest (or highest) cost time slots within the specified time period. For example, you can find the lowest-priced 2 hours within a given time period.