curl --request POST \
--url https://energy-api.flatpeak.com/devices/{device_id}/vpp-events/{vpp_event_id}/opt-out \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"record_reference_id": "optout-2026-08-25-evt17"
}
'import requests
url = "https://energy-api.flatpeak.com/devices/{device_id}/vpp-events/{vpp_event_id}/opt-out"
payload = { "record_reference_id": "optout-2026-08-25-evt17" }
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({record_reference_id: 'optout-2026-08-25-evt17'})
};
fetch('https://energy-api.flatpeak.com/devices/{device_id}/vpp-events/{vpp_event_id}/opt-out', 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}/vpp-events/{vpp_event_id}/opt-out",
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([
'record_reference_id' => 'optout-2026-08-25-evt17'
]),
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}/vpp-events/{vpp_event_id}/opt-out"
payload := strings.NewReader("{\n \"record_reference_id\": \"optout-2026-08-25-evt17\"\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}/vpp-events/{vpp_event_id}/opt-out")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"record_reference_id\": \"optout-2026-08-25-evt17\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://energy-api.flatpeak.com/devices/{device_id}/vpp-events/{vpp_event_id}/opt-out")
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 \"record_reference_id\": \"optout-2026-08-25-evt17\"\n}"
response = http.request(request)
puts response.read_body{
"id": "vpe_7d2a4c6e9b1f3a5c8e0d2f4b",
"object": "vpp_event",
"live_mode": true,
"operator_id": "opr_6a3548352c0d07e89d47b7f1",
"start_time": "2026-08-25T18:00:00Z",
"end_time": "2026-08-25T20:00:00Z",
"intervals": [
{
"start_time": "2026-08-04T20:14:00Z",
"end_time": "2026-08-04T21:00:00Z",
"power_kw": -11,
"energy_kwh": -8.4,
"cost": {
"value": 2.15,
"confidence": 1
}
}
],
"group_id": "grp_2f6a9c1d8e3b5a7c4d0e9f1a",
"status": "ALLOCATION_OPEN",
"time_allocation_locks": "2026-08-25T16:00:00Z",
"allocation": [
{
"device_id": "dev_63a6087272941ef077a8fd3e",
"program_id": "vpr_6a1f8e375db9de605baadd46",
"start_time": "2026-08-25T18:00:00Z",
"end_time": "2026-08-25T19:00:00Z",
"power_kw": -4.3,
"energy_kwh": -3.3,
"cost": {
"value": -0.94,
"confidence": 1
}
}
],
"time_created": "2026-08-25T14:00:12Z",
"account_id": "acc_661677911f2197045e6cf1b1",
"event_type": "ECONOMIC",
"device_count": 61,
"time_updated": "2026-08-25T14:00:12Z"
}{
"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"
}{
"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"
}Opt a device out of a VPP event
Opts the device out of the event, subject to the program’s terms.opt_out_policy. Before lock its share is redistributed; after lock its remaining intervals are recorded as OPTED_OUT. Returns 403 when the policy forbids it, 409 when the policy is ALLOWED_BEFORE_LOCK and the allocation has locked.
curl --request POST \
--url https://energy-api.flatpeak.com/devices/{device_id}/vpp-events/{vpp_event_id}/opt-out \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"record_reference_id": "optout-2026-08-25-evt17"
}
'import requests
url = "https://energy-api.flatpeak.com/devices/{device_id}/vpp-events/{vpp_event_id}/opt-out"
payload = { "record_reference_id": "optout-2026-08-25-evt17" }
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({record_reference_id: 'optout-2026-08-25-evt17'})
};
fetch('https://energy-api.flatpeak.com/devices/{device_id}/vpp-events/{vpp_event_id}/opt-out', 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}/vpp-events/{vpp_event_id}/opt-out",
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([
'record_reference_id' => 'optout-2026-08-25-evt17'
]),
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}/vpp-events/{vpp_event_id}/opt-out"
payload := strings.NewReader("{\n \"record_reference_id\": \"optout-2026-08-25-evt17\"\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}/vpp-events/{vpp_event_id}/opt-out")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"record_reference_id\": \"optout-2026-08-25-evt17\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://energy-api.flatpeak.com/devices/{device_id}/vpp-events/{vpp_event_id}/opt-out")
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 \"record_reference_id\": \"optout-2026-08-25-evt17\"\n}"
response = http.request(request)
puts response.read_body{
"id": "vpe_7d2a4c6e9b1f3a5c8e0d2f4b",
"object": "vpp_event",
"live_mode": true,
"operator_id": "opr_6a3548352c0d07e89d47b7f1",
"start_time": "2026-08-25T18:00:00Z",
"end_time": "2026-08-25T20:00:00Z",
"intervals": [
{
"start_time": "2026-08-04T20:14:00Z",
"end_time": "2026-08-04T21:00:00Z",
"power_kw": -11,
"energy_kwh": -8.4,
"cost": {
"value": 2.15,
"confidence": 1
}
}
],
"group_id": "grp_2f6a9c1d8e3b5a7c4d0e9f1a",
"status": "ALLOCATION_OPEN",
"time_allocation_locks": "2026-08-25T16:00:00Z",
"allocation": [
{
"device_id": "dev_63a6087272941ef077a8fd3e",
"program_id": "vpr_6a1f8e375db9de605baadd46",
"start_time": "2026-08-25T18:00:00Z",
"end_time": "2026-08-25T19:00:00Z",
"power_kw": -4.3,
"energy_kwh": -3.3,
"cost": {
"value": -0.94,
"confidence": 1
}
}
],
"time_created": "2026-08-25T14:00:12Z",
"account_id": "acc_661677911f2197045e6cf1b1",
"event_type": "ECONOMIC",
"device_count": 61,
"time_updated": "2026-08-25T14:00:12Z"
}{
"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"
}{
"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"
}Path Parameters
Body
Response
VPP event response.
A VPP event as it applies to your fleet: the VPP operator's committed power per interval and the allocation of your devices' shares. Flatpeak allocates the shares. At lock, each share becomes a commitment in the device's instructions.
Flatpeak Group ID: the VPP operator's group the event was created for. Your devices that were in the group at that moment are in the event. Read it with retrieve a group.
"grp_2f6a9c1d8e3b5a7c4d0e9f1a"
| Value | Meaning |
|---|---|
ALLOCATION_OPEN | Until time_allocation_locks. Device shares can still change |
LOCKED | Shares fixed. vpp_event.update fires once for the event; read every device's share from allocation |
ACTIVE | During the window |
COMPLETE | After the window |
CANCELED | Withdrawn by the VPP operator |
ALLOCATION_OPEN, LOCKED, ACTIVE, COMPLETE, CANCELED "ALLOCATION_OPEN"
Was this page helpful?

