Skip to main content
POST
/
prices
/
{id}
Retrieve a price
curl --request POST \
  --url https://api.flatpeak.com/prices/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "end_time": "2023-06-15T23:00:00Z",
  "start_time": "2023-06-15T09:00:00Z",
  "tariff_direction": "IMPORT"
}
'
import requests

url = "https://api.flatpeak.com/prices/{id}"

payload = {
"end_time": "2023-06-15T23:00:00Z",
"start_time": "2023-06-15T09:00:00Z",
"tariff_direction": "IMPORT"
}
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({
end_time: '2023-06-15T23:00:00Z',
start_time: '2023-06-15T09:00:00Z',
tariff_direction: 'IMPORT'
})
};

fetch('https://api.flatpeak.com/prices/{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/prices/{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([
'end_time' => '2023-06-15T23:00:00Z',
'start_time' => '2023-06-15T09:00:00Z',
'tariff_direction' => 'IMPORT'
]),
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/prices/{id}"

payload := strings.NewReader("{\n \"end_time\": \"2023-06-15T23:00:00Z\",\n \"start_time\": \"2023-06-15T09:00:00Z\",\n \"tariff_direction\": \"IMPORT\"\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/prices/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_time\": \"2023-06-15T23:00:00Z\",\n \"start_time\": \"2023-06-15T09:00:00Z\",\n \"tariff_direction\": \"IMPORT\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.flatpeak.com/prices/{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 \"end_time\": \"2023-06-15T23:00:00Z\",\n \"start_time\": \"2023-06-15T09:00:00Z\",\n \"tariff_direction\": \"IMPORT\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "prs_65e42cdd73e9f861edda35d7",
  "object": "price",
  "live_mode": true,
  "location_id": "loc_65e42ce4d3b813479b252160",
  "location_timezone": "Europe/London",
  "currency_code": "EUR",
  "last_updated": "2022-05-24T14:15:22Z",
  "request": {
    "start_time": "2022-05-24T14:15:22Z",
    "end_time": "2022-05-24T16:15:22Z",
    "tariff_direction": "IMPORT"
  },
  "account_id": "acc_661677911f2197045e6cf1b1",
  "tariff_direction": "IMPORT",
  "data": [
    {
      "valid_from": "2022-12-28T01:00:00Z",
      "valid_to": "2022-12-28T02:30:00Z",
      "price": {
        "value": 4.998,
        "confidence": 1
      }
    }
  ],
  "time_created": "2022-05-24T15:15:22Z"
}
{
"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

Authorization
string
header
required

Authenticate with bearer you obtained from authentication endpoint.

Path Parameters

id
string
required

Flatpeak Location ID

Example:

"loc_66879edb94bf861548cb7428"

Body

application/json
end_time
string<date-time>
required

RFC 3339 timestamp marking the end of the data window, e.g. 2023-06-15T13:00:00Z or 2023-06-15T12:00:00+01:00; use either UTC or time offset—if offsets differ, end_time takes precedence; max range is 90 days.

Example:

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

start_time
string<date-time>

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"

tariff_direction
string

Specifies the tariff direction; set to IMPORT, EXPORT, or LOCAL. Defaults to IMPORT.

Example:

"IMPORT"

Response

This object is a container for energy rates response.

id
string
required

Flatpeak unique object id.

Example:

"prs_65e42cdd73e9f861edda35d7"

object
string
required

Represents the object's type. I.e. price.

Example:

"price"

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"

last_updated
string
required

Time when rates were last updated. In the format of the request, e.g. UTC or time-offset.

Example:

"2022-05-24T14:15:22Z"

request
object
required

Your original request.

account_id
string
required

Flatpeak account ID.

Example:

"acc_661677911f2197045e6cf1b1"

tariff_direction
string

Direction of tariff. Supported options are IMPORT, EXPORT and LOCAL.

Example:

"IMPORT"

data
object[]

Rates response data.

time_created
string<date-time>

Time when this response was calculated. In UTC.

Example:

"2022-05-24T15:15:22Z"