Skip to main content
Flatpeak supports instant energy cost (for imports) and value (for exports) calculation at both Device and Location levels (i.e. property address). Use device-level reporting when calculating costs for a specific device — this allows additional devices to be added to the same location later without losing historical data (recommended). To implement:
1

Create device identifier

  • Call create-a-device endpoint; add you internal device ID for cross-reference.
  • Store the returned device_id permanently in your system.
This step only needs to be performed once per device.
curl --request POST \
  --url https://api.flatpeak.com/devices \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "reference_id": "DEV1234567890"
}'
2

Submit meter records & get energy cost/value

  • Call instant-cost-calculate endpoint to submit energy consumption or export meter records collected from your device.
  • Set energy_flow_direction=INBOUND and tariff_direction=IMPORT to submit meter records for energy import and calculate cost using import price.
  • Set energy_flow_direction=OUTBOUND and tariff_direction=EXPORT to submit meter records for energy export and calculate cost using export price.
curl --request POST \
  --url https://api.flatpeak.com/costs/instant \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "location_id": "loc_641b90b758fb8e6293716e40",
  "device_id": "dev_65e6d8334c8d715963d99db3",
  "energy_flow_direction": "INBOUND",
  "tariff_direction": "IMPORT",
  "units": "W",
  "value": 20567,
  "start_time": "2022-02-01T10:30:00Z",
  "end_time": "2022-02-01T11:00:00Z"
}'

Submit actual solar generation data

If a PV system is installed at the location and you have access to its production records, submit them as they arrive. This is particularly important if you use Solar Generation Forecasts, as it ensures accurate generation data for cost calculations. Submitted records are applied immediately in all energy cost calculations. The per-kWh cost is assumed to be zero unless the customer uses the Connect to set a local generation price.
  • Submit generation to submit-meter-interval endpoint.
  • If your system generates cumulative records, use submit-meter-cumulative instead.
  • Include relevant device_id and location_id
  • Set direction=IMPORT and tariff_rate=LOCAL
  • Set the confidence parameter to 1
curl --request PUT \
  --url https://api.flatpeak.com/meters/interval \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '[
  {
    "location_id": "loc_641b90b758fb8e6293716e40",
    "device_id": "dev_63a6087272941ef077a8fd3e",
    "energy_flow_direction": "INBOUND",
    "tariff_direction": "LOCAL",
    "confidence": 1,
    "units": "W",
    "value": 968,
    "start_time": "2025-08-01T10:30:00Z",
    "end_time": "2025-08-01T11:00:00Z",
  }
]'

Simulate energy cost profiles

To estimate energy cost without storing the data, pass the non_persistent=true in your request. This lets you model scenarios without affecting actual meter data or triggering downstream reporting.