Skip to main content
Enroll a test device and commit it to a VPP event. You need a Console account with a trial: contact support to activate one.
1

Authenticate

Copy your Account ID and secret key from Console > API Keys. Use a test mode key, which starts with sk_test_. Base64 encode account_id:secret_key and call authentication.
The token lasts one hour, after which you request another.
2

Create a program

You see a device only through an enrollment in one of your programs, so start by creating a VPP program. Set listed to false: an unlisted program is offered only from your app and needs no OEM approval.
Request example
The program starts in DRAFT. Set status to LIVE with update a VPP program; an unlisted program goes live at once. Keep its id for the next step.
3

Create a Connect session

You do not create devices: the customer signs in to their OEM account in Connect, and the device appears in the API. Create a Connect session with:
The session expires 48 hours after creation.
4

Launch Connect

Open https://universal.flatpeak.com with the session ID as the connect_session query parameter:
The customer signs in with their OEM account, grants the TELEMETRY, CONTROL, LOCATION and SETTINGS scopes, and returns to your callback_url. The OEM app opens if installed, otherwise the OEM’s web portal.
Flatpeak Connect flow

Left and right: your app. Middle: the OEM app or web portal.

5

Handle the callback

The customer lands on your callback_url with the session ID in the connect_session query parameter. Retrieve the Connect session and read device_id, which is null if the customer left without connecting a device.
6

Retrieve the device

Call retrieve a device with that device_id.
enrollment_state on the enrollment says whether you can dispatch the device. Change it with the enrollment actions.
7

Connect a tariff

A device cannot enroll until its location has an IMPORT and an EXPORT COMMODITY tariff. Until then the enrollment waits in PENDING, at step AWAITING_TARIFF. See Tariffs.
  • If your account supplies energy, create both tariffs at the device’s location_id with create a tariff.
  • If it does not, the customer connects their own tariff in Connect and the step clears.
Request example (account that supplies energy)
Repeat with "direction": "EXPORT". With no dispatch test and no approval required, the enrollment is then ACTIVE.
8

Retrieve device state

Call retrieve a device state.
Negative power_kw means the device is discharging. available_export_energy_kwh is already net of the customer’s backup reserve, which is never dispatched.
9

Create a VPP event

A VPP event commits a group of devices to a power target per interval. First create a group that holds the device:
Then create a VPP event for the group, to charge the device at 4.3 kW overnight. power_kw is positive for import and negative for export, up to max_import_power_kw and max_export_power_kw in dispatch_limits.
Flatpeak bounds the target to the device’s limits and passes it to the OEM as a binding instruction, which the OEM confirms. TEST events do not affect settlement.
10

Check delivery

After the event, call list device meter records. At 4.3 kW, each half hour records about 2.15 kWh of import.
The dispatch timeline shows what the device did per interval, with the VPP event behind it.

Next steps

Programs

Terms, eligibility, telemetry and publishing.

VPP events

Commit a group and track delivery.