Skip to main content
When integrating Flatpeak, add a page in your app where customers can connect, view, and manage their tariffs. This guide shows the tools Flatpeak gives you to build it, plus optional features you may want to include.
  • No Connection - Basic
  • Connected - Basic
  • No Connection - Advanced
  • Connected - Advanced

Basic vs. Advanced

Customers may hold contracts with more than one energy provider at the same time. For example: buy electricity from Company A, pay Company B for delivery.
  • Need only the import price? Use Basic.
  • Need export prices too, or customer-defined grid fees? Use Advanced.
Details for both are below.

Tariff connection types

Type/DirectionDescription
COMMODITY-IMPORTCost of the electricity consumed. Essential to enable this—it’s foundational across all markets.
COMMODITY-EXPORTPrice for exported electricity. Use this if your users have solar panels or energy storage.
NON_COMMODITY-IMPORTDelivery costs (e.g., grid fees). Recommended if your customer pays delivery charges separately.
  • Basic = COMMODITY-IMPORT only
  • Advanced = adds COMMODITY-EXPORT + NON_COMMODITY-IMPORT

Implementing page actions

  1. First connection

To connect a tariff (e.g. COMMODITY-IMPORT), pass the type and direction when creating a Connect token:
Example request
curl --request POST \
  --url https://api.flatpeak.com/connect/tariff/token \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "COMMODITY",
  "direction": "IMPORT"
}'
  1. View or update

Before you can let your customers to View or Edit their tariff, you need to display their current tariff connections. For this call Retrieve a location status endpoint: To show or edit tariffs, first fetch existing connections with Retrieve location status endpoint:
curl --request GET \
  --url https://api.flatpeak.com/locations/loc_641b90b758fb8e6293716e40/status \
  --header 'Authorization: Bearer <token>'
When the customer picks a tariff to update, create a new Connect token with their location_id and tariff type/direction. This launches Connect with the Tariff Summary page.
Example request
curl --request POST \
  --url https://api.flatpeak.com/connect/tariff/token \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "locaiton_id": "loc_641b90b758fb8e6293716e40",
  "type": "COMMODITY",
  "direction": "IMPORT"
}'
  1. Disconnect

To disconnect, run this sequence:
1

Create a Connect token

Create a Connect token with the location_id where the tariff should be disconnected.
curl --request POST \
  --url https://api.flatpeak.com/connect/tariff/token \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "COMMODITY",
  "direction": "IMPORT",
  "location_id": "loc_641b90b758fb8e6293716e40",
  "callback_uri": "<any service that can receive webhooks>",
}'
2

Send disconnect action

Call Connect’s summary_fixed_confirm route and send DISCONNECT action:
curl --request POST \
  --url https://connect.flatpeak.com \
  --header 'Content-Type: application/json' \
  --data '{
  "connect_token": "cot_6587fa4362341be5b524de3b",
  "route": "summary_fixed_confirm",
  "action": "DISCONNECT"
}'
I