Skip to main content
POST
/
schedules
/
duration
Schedule by time duration
curl --request POST \
  --url https://api.flatpeak.com/schedules/duration \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "location_id": "loc_641b90b758fb8e6293716e40",
  "start_time": "2023-06-15T09:00:00Z",
  "end_time": "2023-06-16T09:00:00Z",
  "segment": "HIGH",
  "duration": 60,
  "device_id": "dev_63a6087272941ef077a8fd3e",
  "tariff_direction": "IMPORT"
}
'
{
  "id": "std_65e42cdd73e9f861edda35d7",
  "object": "schedule_duration",
  "account_id": "acc_661677911f2197045e6cf1b1",
  "live_mode": true,
  "location_timezone": "Europe/London",
  "currency_code": "EUR",
  "tariff_direction": "IMPORT",
  "data": [
    {
      "start_time": "2024-05-20T00:00:00Z",
      "end_time": "2024-05-20T05:30:00Z",
      "price": {
        "value": 3.221,
        "confidence": 1
      },
      "vpp_event": false
    }
  ],
  "time_created": "2024-05-23T15:14:22Z",
  "device_id": "dev_63a6087272941ef077a8fd3e",
  "location_id": "loc_65e42ce4d3b813479b252160"
}

Authorizations

Authorization
string
header
required

Authenticate with bearer you obtained from authentication endpoint.

Body

application/json
location_id
string
required

Flatpeak Location ID

Example:

"loc_641b90b758fb8e6293716e40"

start_time
string<date-time>
required

RFC 3339 timestamp marking the start of the data window, e.g. 2023-06-15T09:00:00Z or 2023-06-15T08:00:00+01:00; use either UTC or time offset—if offsets differ, end_time takes precedence.

Example:

"2023-06-15T09:00:00Z"

end_time
string<date-time>
required

RFC 3339 timestamp marking the start of the data window, e.g. 2023-06-15T09:00:00Z or 2023-06-15T08:00:00+01:00; use either UTC or time offset—if offsets differ, end_time takes precedence. The maximum period between start_time and end_time for a single request is 3 days.

Example:

"2023-06-16T09:00:00Z"

segment
string
required

Set to HIGH to get the most expensive rate segment and to LOW to get the cheapest segment.

Example:

"HIGH"

duration
number
required

Amount of time in minutes you need with the lowest or highest (set segment=HIGH/LOW) tariff over the requested period.

Example:

60

device_id
string

Flatpeak Device ID

Example:

"dev_63a6087272941ef077a8fd3e"

tariff_direction
string
default:IMPORT

Sets the tariff direction; possible values are IMPORT, EXPORT, or LOCAL.

Example:

"IMPORT"

Response

Response example

This object is a container for tariff slots response.

id
string
required

Flatpeak unique object id.

Example:

"std_65e42cdd73e9f861edda35d7"

object
string
required

Represents the object's type.

Example:

"schedule_duration"

account_id
string
required

Flatpeak account ID.

Example:

"acc_661677911f2197045e6cf1b1"

live_mode
boolean
required

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

location_timezone
string
required

The timezone at the location, in 'tz database format'. I.e. 'Europe/Berlin'.

Example:

"Europe/London"

currency_code
string
required

Currency at the location in ISO 4217.

Example:

"EUR"

tariff_direction
string
required

Direction of tariff. Supported options are IMPORT and EXPORT.

Example:

"IMPORT"

data
object[]
required

Slots response data.

time_created
string<date-time>
required

Time when this response was calculated. In UTC.

Example:

"2024-05-23T15:14:22Z"

device_id
string

Flatpeak Device ID

Example:

"dev_63a6087272941ef077a8fd3e"

location_id
string

Flatpeak Location ID

Example:

"loc_65e42ce4d3b813479b252160"