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

Documentation Index

Fetch the complete documentation index at: https://docs.flatpeak.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Authenticate with bearer you obtained from authentication endpoint.

Path Parameters

id
string
required

Flatpeak location_id.

Body

application/json
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

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"

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_id
string
required

The unique Flatpeak ID of the location.

Example:

"loc_65e42ce4d3b813479b252160"

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"

next_update
string
required

Time when we recommend fetching new rates. In the format of the request, e.g. UTC or time-offset.

Example:

"2023-06-18T23:00:00Z"

request
object
required

Your original request.

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"

account_id
string
required

Flatpeak account ID.

Example:

"acc_661677911f2197045e6cf1b1"

tariff_direction
string

Direction of tariff. Supported options are IMPORT and EXPORT.

Example:

"IMPORT"