Skip to main content
If the only input available is the duration your device needs to consume or can export energy, call the schedule-by-duration endpoint. Flatpeak uses the Location’s tariff and, if a PV array is present, the local solar generation forecast to identify the lowest (or highest) cost time slots within the specified period. In the example below, you request the lowest-priced two-hour window within a given timeframe:
curl --request POST \
  --url https://api.flatpeak.com/schedules/duration/loc_641b90b758fb8e6293716e40 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "start_time": "2024-05-19T23:21:00Z",
  "end_time": "2024-05-20T06:00:00Z",
  "tariff_direction": "IMPORT",
  "segment": "LOW",
  "duration": 120
}'