curl --request POST \
--url https://api.flatpeak.com/schedules/amount/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"max_power": {
"units": "W",
"value": 14000
},
"shaving_threshold": {
"relative": 0.83,
"absolute": 0.123
},
"data": [
{
"device_id": "dev_65e6d8334c8d715963d99db3",
"tariff_direction": "IMPORT",
"end_time": "2022-02-02T06:00:00Z",
"energy": {
"units": "WH",
"value": 24500
},
"start_time": "2022-02-01T20:14:00Z",
"max_power": {
"units": "W",
"value": 7000
}
}
]
}
'import requests
url = "https://api.flatpeak.com/schedules/amount/{id}"
payload = {
"max_power": {
"units": "W",
"value": 14000
},
"shaving_threshold": {
"relative": 0.83,
"absolute": 0.123
},
"data": [
{
"device_id": "dev_65e6d8334c8d715963d99db3",
"tariff_direction": "IMPORT",
"end_time": "2022-02-02T06:00:00Z",
"energy": {
"units": "WH",
"value": 24500
},
"start_time": "2022-02-01T20:14:00Z",
"max_power": {
"units": "W",
"value": 7000
}
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
max_power: {units: 'W', value: 14000},
shaving_threshold: {relative: 0.83, absolute: 0.123},
data: [
{
device_id: 'dev_65e6d8334c8d715963d99db3',
tariff_direction: 'IMPORT',
end_time: '2022-02-02T06:00:00Z',
energy: {units: 'WH', value: 24500},
start_time: '2022-02-01T20:14:00Z',
max_power: {units: 'W', value: 7000}
}
]
})
};
fetch('https://api.flatpeak.com/schedules/amount/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flatpeak.com/schedules/amount/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'max_power' => [
'units' => 'W',
'value' => 14000
],
'shaving_threshold' => [
'relative' => 0.83,
'absolute' => 0.123
],
'data' => [
[
'device_id' => 'dev_65e6d8334c8d715963d99db3',
'tariff_direction' => 'IMPORT',
'end_time' => '2022-02-02T06:00:00Z',
'energy' => [
'units' => 'WH',
'value' => 24500
],
'start_time' => '2022-02-01T20:14:00Z',
'max_power' => [
'units' => 'W',
'value' => 7000
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flatpeak.com/schedules/amount/{id}"
payload := strings.NewReader("{\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 14000\n },\n \"shaving_threshold\": {\n \"relative\": 0.83,\n \"absolute\": 0.123\n },\n \"data\": [\n {\n \"device_id\": \"dev_65e6d8334c8d715963d99db3\",\n \"tariff_direction\": \"IMPORT\",\n \"end_time\": \"2022-02-02T06:00:00Z\",\n \"energy\": {\n \"units\": \"WH\",\n \"value\": 24500\n },\n \"start_time\": \"2022-02-01T20:14:00Z\",\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 7000\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flatpeak.com/schedules/amount/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 14000\n },\n \"shaving_threshold\": {\n \"relative\": 0.83,\n \"absolute\": 0.123\n },\n \"data\": [\n {\n \"device_id\": \"dev_65e6d8334c8d715963d99db3\",\n \"tariff_direction\": \"IMPORT\",\n \"end_time\": \"2022-02-02T06:00:00Z\",\n \"energy\": {\n \"units\": \"WH\",\n \"value\": 24500\n },\n \"start_time\": \"2022-02-01T20:14:00Z\",\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 7000\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flatpeak.com/schedules/amount/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 14000\n },\n \"shaving_threshold\": {\n \"relative\": 0.83,\n \"absolute\": 0.123\n },\n \"data\": [\n {\n \"device_id\": \"dev_65e6d8334c8d715963d99db3\",\n \"tariff_direction\": \"IMPORT\",\n \"end_time\": \"2022-02-02T06:00:00Z\",\n \"energy\": {\n \"units\": \"WH\",\n \"value\": 24500\n },\n \"start_time\": \"2022-02-01T20:14:00Z\",\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 7000\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "sae_65ea3fb185c1541f247c251e",
"object": "schedule_amount",
"live_mode": true,
"location_id": "loc_641b90b758fb8e6293716e40",
"location_timezone": "Europe/London",
"currency_code": "GBP",
"max_power": {
"units": "W",
"value": 14000
},
"cost": {
"value": 928.372,
"confidence": 1
},
"savings": {
"value": 0.0239,
"percentage": 1.34
},
"time_created": "2022-01-24T14:15:22Z",
"account_id": "acc_661677911f2197045e6cf1b1",
"shaving_threshold": {
"relative": 0.83,
"absolute": 0.123
},
"data": [
{
"device_id": "dev_664525107c44d88a37ca1ad7",
"start_time": "2022-02-01T20:14:00Z",
"end_time": "2022-02-02T06:00:00Z",
"energy": {
"units": "WH",
"value": 34000
},
"cost": {
"value": 928.372,
"confidence": 1
},
"savings": {
"value": 0.2375,
"percentage": 0.11
},
"schedule": [
{
"start_time": "2022-02-02T02:00:00Z",
"end_time": "2022-02-02T04:30:00Z",
"power": {
"units": "W",
"value": 11000
}
}
],
"tariff_direction": "IMPORT",
"max_power": {
"units": "W",
"value": 7000
}
}
]
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"time_created": "2025-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"context": "api.price_get",
"code": "no_tariff_connected",
"message": "No tariff connected for IMPORT direction",
"time_created": "2025-01-01T00:00:00Z"
}{
"object": "error",
"type": "rate_limit",
"code": "too_many_requests",
"message": "Too many requests. Please retry after a short delay.",
"time_created": "2026-01-29T17:11:52Z"
}Schedule by amount of energy
Find best times to consume or export energy based on:
- Total energy required
- Duration of time available
- Power transfer speed limit
curl --request POST \
--url https://api.flatpeak.com/schedules/amount/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"max_power": {
"units": "W",
"value": 14000
},
"shaving_threshold": {
"relative": 0.83,
"absolute": 0.123
},
"data": [
{
"device_id": "dev_65e6d8334c8d715963d99db3",
"tariff_direction": "IMPORT",
"end_time": "2022-02-02T06:00:00Z",
"energy": {
"units": "WH",
"value": 24500
},
"start_time": "2022-02-01T20:14:00Z",
"max_power": {
"units": "W",
"value": 7000
}
}
]
}
'import requests
url = "https://api.flatpeak.com/schedules/amount/{id}"
payload = {
"max_power": {
"units": "W",
"value": 14000
},
"shaving_threshold": {
"relative": 0.83,
"absolute": 0.123
},
"data": [
{
"device_id": "dev_65e6d8334c8d715963d99db3",
"tariff_direction": "IMPORT",
"end_time": "2022-02-02T06:00:00Z",
"energy": {
"units": "WH",
"value": 24500
},
"start_time": "2022-02-01T20:14:00Z",
"max_power": {
"units": "W",
"value": 7000
}
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
max_power: {units: 'W', value: 14000},
shaving_threshold: {relative: 0.83, absolute: 0.123},
data: [
{
device_id: 'dev_65e6d8334c8d715963d99db3',
tariff_direction: 'IMPORT',
end_time: '2022-02-02T06:00:00Z',
energy: {units: 'WH', value: 24500},
start_time: '2022-02-01T20:14:00Z',
max_power: {units: 'W', value: 7000}
}
]
})
};
fetch('https://api.flatpeak.com/schedules/amount/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flatpeak.com/schedules/amount/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'max_power' => [
'units' => 'W',
'value' => 14000
],
'shaving_threshold' => [
'relative' => 0.83,
'absolute' => 0.123
],
'data' => [
[
'device_id' => 'dev_65e6d8334c8d715963d99db3',
'tariff_direction' => 'IMPORT',
'end_time' => '2022-02-02T06:00:00Z',
'energy' => [
'units' => 'WH',
'value' => 24500
],
'start_time' => '2022-02-01T20:14:00Z',
'max_power' => [
'units' => 'W',
'value' => 7000
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flatpeak.com/schedules/amount/{id}"
payload := strings.NewReader("{\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 14000\n },\n \"shaving_threshold\": {\n \"relative\": 0.83,\n \"absolute\": 0.123\n },\n \"data\": [\n {\n \"device_id\": \"dev_65e6d8334c8d715963d99db3\",\n \"tariff_direction\": \"IMPORT\",\n \"end_time\": \"2022-02-02T06:00:00Z\",\n \"energy\": {\n \"units\": \"WH\",\n \"value\": 24500\n },\n \"start_time\": \"2022-02-01T20:14:00Z\",\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 7000\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flatpeak.com/schedules/amount/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 14000\n },\n \"shaving_threshold\": {\n \"relative\": 0.83,\n \"absolute\": 0.123\n },\n \"data\": [\n {\n \"device_id\": \"dev_65e6d8334c8d715963d99db3\",\n \"tariff_direction\": \"IMPORT\",\n \"end_time\": \"2022-02-02T06:00:00Z\",\n \"energy\": {\n \"units\": \"WH\",\n \"value\": 24500\n },\n \"start_time\": \"2022-02-01T20:14:00Z\",\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 7000\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flatpeak.com/schedules/amount/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 14000\n },\n \"shaving_threshold\": {\n \"relative\": 0.83,\n \"absolute\": 0.123\n },\n \"data\": [\n {\n \"device_id\": \"dev_65e6d8334c8d715963d99db3\",\n \"tariff_direction\": \"IMPORT\",\n \"end_time\": \"2022-02-02T06:00:00Z\",\n \"energy\": {\n \"units\": \"WH\",\n \"value\": 24500\n },\n \"start_time\": \"2022-02-01T20:14:00Z\",\n \"max_power\": {\n \"units\": \"W\",\n \"value\": 7000\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "sae_65ea3fb185c1541f247c251e",
"object": "schedule_amount",
"live_mode": true,
"location_id": "loc_641b90b758fb8e6293716e40",
"location_timezone": "Europe/London",
"currency_code": "GBP",
"max_power": {
"units": "W",
"value": 14000
},
"cost": {
"value": 928.372,
"confidence": 1
},
"savings": {
"value": 0.0239,
"percentage": 1.34
},
"time_created": "2022-01-24T14:15:22Z",
"account_id": "acc_661677911f2197045e6cf1b1",
"shaving_threshold": {
"relative": 0.83,
"absolute": 0.123
},
"data": [
{
"device_id": "dev_664525107c44d88a37ca1ad7",
"start_time": "2022-02-01T20:14:00Z",
"end_time": "2022-02-02T06:00:00Z",
"energy": {
"units": "WH",
"value": 34000
},
"cost": {
"value": 928.372,
"confidence": 1
},
"savings": {
"value": 0.2375,
"percentage": 0.11
},
"schedule": [
{
"start_time": "2022-02-02T02:00:00Z",
"end_time": "2022-02-02T04:30:00Z",
"power": {
"units": "W",
"value": 11000
}
}
],
"tariff_direction": "IMPORT",
"max_power": {
"units": "W",
"value": 7000
}
}
]
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"time_created": "2025-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"context": "api.price_get",
"code": "no_tariff_connected",
"message": "No tariff connected for IMPORT direction",
"time_created": "2025-01-01T00:00:00Z"
}{
"object": "error",
"type": "rate_limit",
"code": "too_many_requests",
"message": "Too many requests. Please retry after a short delay.",
"time_created": "2026-01-29T17:11:52Z"
}Authorizations
Authenticate with bearer you obtained from authentication endpoint.
Path Parameters
Flatpeak location_id.
Body
Maximum speed of power transfer for that location.
Show child attributes
Show child attributes
Tariff cap. Specifies up to what price you are willing to pay to buy (or, in reverse, sell) energy.
Show child attributes
Show child attributes
This object that contains device schedule requests.
Show child attributes
Show child attributes
Response
Flatpeak schedule id.
"sae_65ea3fb185c1541f247c251e"
Represents the object’s type.
"schedule_amount"
Has the value true if the object exists in live mode or the value false if the object exists in test mode.
true
Flatpeak location ID where this schedule applies.
"loc_641b90b758fb8e6293716e40"
The timezone at the location, in 'tz database format'. I.e. 'Europe/Berlin'.
"Europe/London"
Currency code for cost of energy measure. Always returned in large currency units.
"GBP"
Maximum speed of power transfer for that location.
Show child attributes
Show child attributes
Monetary cost of energy in the schedule.
Show child attributes
Show child attributes
Savings provided by the schedule by applying (1) tariff shaving and (2) tariff-based optimisation. The shaving is applied first.
Show child attributes
Show child attributes
Time when this object was created, in UTC.
"2022-01-24T14:15:22Z"
Flatpeak account ID.
"acc_661677911f2197045e6cf1b1"
Tariff cap. Specifies up to what price you are willing to pay to buy (or, in reverse, sell) energy.
Show child attributes
Show child attributes
This object that contains device schedules.
Show child attributes
Show child attributes
Was this page helpful?

