Update a location
curl --request PATCH \
--url https://energy-api.flatpeak.com/locations/{location_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reference_id": "LOC1234567890",
"user_id": "usr_65e421d1daa4a24082b4f590",
"postal_address": {
"address_line1": "1-3",
"address_line2": "Strand",
"city": "London",
"state": "NSW",
"post_code": "WC2N 5EH",
"country_code": "GB"
}
}
'import requests
url = "https://energy-api.flatpeak.com/locations/{location_id}"
payload = {
"reference_id": "LOC1234567890",
"user_id": "usr_65e421d1daa4a24082b4f590",
"postal_address": {
"address_line1": "1-3",
"address_line2": "Strand",
"city": "London",
"state": "NSW",
"post_code": "WC2N 5EH",
"country_code": "GB"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
reference_id: 'LOC1234567890',
user_id: 'usr_65e421d1daa4a24082b4f590',
postal_address: {
address_line1: '1-3',
address_line2: 'Strand',
city: 'London',
state: 'NSW',
post_code: 'WC2N 5EH',
country_code: 'GB'
}
})
};
fetch('https://energy-api.flatpeak.com/locations/{location_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://energy-api.flatpeak.com/locations/{location_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'reference_id' => 'LOC1234567890',
'user_id' => 'usr_65e421d1daa4a24082b4f590',
'postal_address' => [
'address_line1' => '1-3',
'address_line2' => 'Strand',
'city' => 'London',
'state' => 'NSW',
'post_code' => 'WC2N 5EH',
'country_code' => 'GB'
]
]),
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/locations/{location_id}"
payload := strings.NewReader("{\n \"reference_id\": \"LOC1234567890\",\n \"user_id\": \"usr_65e421d1daa4a24082b4f590\",\n \"postal_address\": {\n \"address_line1\": \"1-3\",\n \"address_line2\": \"Strand\",\n \"city\": \"London\",\n \"state\": \"NSW\",\n \"post_code\": \"WC2N 5EH\",\n \"country_code\": \"GB\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://energy-api.flatpeak.com/locations/{location_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reference_id\": \"LOC1234567890\",\n \"user_id\": \"usr_65e421d1daa4a24082b4f590\",\n \"postal_address\": {\n \"address_line1\": \"1-3\",\n \"address_line2\": \"Strand\",\n \"city\": \"London\",\n \"state\": \"NSW\",\n \"post_code\": \"WC2N 5EH\",\n \"country_code\": \"GB\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://energy-api.flatpeak.com/locations/{location_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reference_id\": \"LOC1234567890\",\n \"user_id\": \"usr_65e421d1daa4a24082b4f590\",\n \"postal_address\": {\n \"address_line1\": \"1-3\",\n \"address_line2\": \"Strand\",\n \"city\": \"London\",\n \"state\": \"NSW\",\n \"post_code\": \"WC2N 5EH\",\n \"country_code\": \"GB\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "loc_641b90b758fb8e6293716e40",
"object": "location",
"live_mode": true,
"user_id": "usr_65e421d1daa4a24082b4f590",
"reference_id": "LOC1234567890",
"timezone": "Europe/London",
"currency_code": "EUR",
"postal_address_verified": true,
"postal_address": {
"address_line1": "1-3",
"address_line2": "Strand",
"city": "London",
"state": "NSW",
"post_code": "WC2N 5EH",
"country_code": "GB"
},
"geo_location": {
"lat": 50.12345,
"lng": -1.23456
},
"device_ids": [
"dev_63a6087272941ef077a8fd3e"
],
"time_created": "2023-11-07T05:31:56Z",
"account_id": "acc_661677911f2197045e6cf1b1"
}{
"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"
}Locations
Update a location
Updates the specified location. Any parameters not provided remain unchanged.
PATCH
/
locations
/
{location_id}
Update a location
curl --request PATCH \
--url https://energy-api.flatpeak.com/locations/{location_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reference_id": "LOC1234567890",
"user_id": "usr_65e421d1daa4a24082b4f590",
"postal_address": {
"address_line1": "1-3",
"address_line2": "Strand",
"city": "London",
"state": "NSW",
"post_code": "WC2N 5EH",
"country_code": "GB"
}
}
'import requests
url = "https://energy-api.flatpeak.com/locations/{location_id}"
payload = {
"reference_id": "LOC1234567890",
"user_id": "usr_65e421d1daa4a24082b4f590",
"postal_address": {
"address_line1": "1-3",
"address_line2": "Strand",
"city": "London",
"state": "NSW",
"post_code": "WC2N 5EH",
"country_code": "GB"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
reference_id: 'LOC1234567890',
user_id: 'usr_65e421d1daa4a24082b4f590',
postal_address: {
address_line1: '1-3',
address_line2: 'Strand',
city: 'London',
state: 'NSW',
post_code: 'WC2N 5EH',
country_code: 'GB'
}
})
};
fetch('https://energy-api.flatpeak.com/locations/{location_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://energy-api.flatpeak.com/locations/{location_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'reference_id' => 'LOC1234567890',
'user_id' => 'usr_65e421d1daa4a24082b4f590',
'postal_address' => [
'address_line1' => '1-3',
'address_line2' => 'Strand',
'city' => 'London',
'state' => 'NSW',
'post_code' => 'WC2N 5EH',
'country_code' => 'GB'
]
]),
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/locations/{location_id}"
payload := strings.NewReader("{\n \"reference_id\": \"LOC1234567890\",\n \"user_id\": \"usr_65e421d1daa4a24082b4f590\",\n \"postal_address\": {\n \"address_line1\": \"1-3\",\n \"address_line2\": \"Strand\",\n \"city\": \"London\",\n \"state\": \"NSW\",\n \"post_code\": \"WC2N 5EH\",\n \"country_code\": \"GB\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://energy-api.flatpeak.com/locations/{location_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reference_id\": \"LOC1234567890\",\n \"user_id\": \"usr_65e421d1daa4a24082b4f590\",\n \"postal_address\": {\n \"address_line1\": \"1-3\",\n \"address_line2\": \"Strand\",\n \"city\": \"London\",\n \"state\": \"NSW\",\n \"post_code\": \"WC2N 5EH\",\n \"country_code\": \"GB\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://energy-api.flatpeak.com/locations/{location_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reference_id\": \"LOC1234567890\",\n \"user_id\": \"usr_65e421d1daa4a24082b4f590\",\n \"postal_address\": {\n \"address_line1\": \"1-3\",\n \"address_line2\": \"Strand\",\n \"city\": \"London\",\n \"state\": \"NSW\",\n \"post_code\": \"WC2N 5EH\",\n \"country_code\": \"GB\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "loc_641b90b758fb8e6293716e40",
"object": "location",
"live_mode": true,
"user_id": "usr_65e421d1daa4a24082b4f590",
"reference_id": "LOC1234567890",
"timezone": "Europe/London",
"currency_code": "EUR",
"postal_address_verified": true,
"postal_address": {
"address_line1": "1-3",
"address_line2": "Strand",
"city": "London",
"state": "NSW",
"post_code": "WC2N 5EH",
"country_code": "GB"
},
"geo_location": {
"lat": 50.12345,
"lng": -1.23456
},
"device_ids": [
"dev_63a6087272941ef077a8fd3e"
],
"time_created": "2023-11-07T05:31:56Z",
"account_id": "acc_661677911f2197045e6cf1b1"
}{
"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
Fields of a supply address to update. Any field not provided remains unchanged.
Response
Location response.
A supply address.
Was this page helpful?

