Optimize by price limit
curl --request POST \
--url https://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_time": "2026-06-15T09:00:00Z",
"end_time": "2026-06-16T09:00:00Z"
}
'import requests
url = "https://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit"
payload = {
"start_time": "2026-06-15T09:00:00Z",
"end_time": "2026-06-16T09:00:00Z"
}
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({start_time: '2026-06-15T09:00:00Z', end_time: '2026-06-16T09:00:00Z'})
};
fetch('https://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit', 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://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit",
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([
'start_time' => '2026-06-15T09:00:00Z',
'end_time' => '2026-06-16T09:00:00Z'
]),
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://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit"
payload := strings.NewReader("{\n \"start_time\": \"2026-06-15T09:00:00Z\",\n \"end_time\": \"2026-06-16T09:00:00Z\"\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://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2026-06-15T09:00:00Z\",\n \"end_time\": \"2026-06-16T09:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit")
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 \"start_time\": \"2026-06-15T09:00:00Z\",\n \"end_time\": \"2026-06-16T09:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "opt_65e42cdd73e9f861edda35d7",
"object": "optimization_limit",
"live_mode": true,
"device_id": "dev_63a6087272941ef077a8fd3e",
"location_id": "loc_65e42ce4d3b813479b252160",
"timezone": "Europe/London",
"currency_code": "EUR",
"data": [
{
"start_time": "2026-05-20T00:00:00Z",
"end_time": "2026-05-20T05:30:00Z",
"price": {
"value": 0.032,
"confidence": 1
},
"solar": {
"energy_kwh": 1.41,
"power_kw": 2.82,
"confidence": 0.66
}
}
],
"account_id": "acc_661677911f2197045e6cf1b1",
"time_created": "2026-05-24T15:15:22Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}Optimizations
Optimize by price limit
Returns the intervals within the window whose price is below or above the threshold. Each window carries the solar forecast for its interval.
POST
/
devices
/
{device_id}
/
optimizations
/
limit
Optimize by price limit
curl --request POST \
--url https://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_time": "2026-06-15T09:00:00Z",
"end_time": "2026-06-16T09:00:00Z"
}
'import requests
url = "https://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit"
payload = {
"start_time": "2026-06-15T09:00:00Z",
"end_time": "2026-06-16T09:00:00Z"
}
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({start_time: '2026-06-15T09:00:00Z', end_time: '2026-06-16T09:00:00Z'})
};
fetch('https://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit', 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://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit",
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([
'start_time' => '2026-06-15T09:00:00Z',
'end_time' => '2026-06-16T09:00:00Z'
]),
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://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit"
payload := strings.NewReader("{\n \"start_time\": \"2026-06-15T09:00:00Z\",\n \"end_time\": \"2026-06-16T09:00:00Z\"\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://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2026-06-15T09:00:00Z\",\n \"end_time\": \"2026-06-16T09:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://energy-api.flatpeak.com/devices/{device_id}/optimizations/limit")
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 \"start_time\": \"2026-06-15T09:00:00Z\",\n \"end_time\": \"2026-06-16T09:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "opt_65e42cdd73e9f861edda35d7",
"object": "optimization_limit",
"live_mode": true,
"device_id": "dev_63a6087272941ef077a8fd3e",
"location_id": "loc_65e42ce4d3b813479b252160",
"timezone": "Europe/London",
"currency_code": "EUR",
"data": [
{
"start_time": "2026-05-20T00:00:00Z",
"end_time": "2026-05-20T05:30:00Z",
"price": {
"value": 0.032,
"confidence": 1
},
"solar": {
"energy_kwh": 1.41,
"power_kw": 2.82,
"confidence": 0.66
}
}
],
"account_id": "acc_661677911f2197045e6cf1b1",
"time_created": "2026-05-24T15:15:22Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "not_found",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}Body
application/json
Response
Optimization by limit response.
Tariff rate segments.
Was this page helpful?

