Flatpeak supports aggregated energy cost reporting at both Device and Location (i.e. property address) levels. Use device-based reporting if you are calculating cost for a specific device at a location — this allows you to add additional devices to the same location in the future without losing your data.
1

Create device identifier (optional)

  • Start by calling the create-a-device endpoint using your internal device reference.
  • Store the returned Flatpeak 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

  • Use the submit-interval-meter-records endpoint to submit energy consumption or export meter records from your system or device.
  • If your system generates cumulative (and not interval) meter records, use submit-cumulative-meter-records endpoint.
  • Optionally include the device_id you created earlier — this enables tagging and tracking by device.
  • The response will include confirmation of acceptance and processing status of records. You can submit up to 10,000 records at the time.
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_65e6d8334c8d715963d99db3",
    "record_reference_id": "MET1234567890",
    "direction": "IMPORT",
    "tariff_rate": "IMPORT"
    "units": "W",
    "value": 20567,
    "start_time": "2022-02-01T10:30:00Z",
    "end_time": "2022-02-01T11:00:00Z"
  }
]'
3

Get energy cost report

  • Use the report-cost-by-interval endpoint to request cost calculations for a time interval. Flatpeak will use meter records you submitted for the interval you are requesting and tariff rates to calculate the report.
  • If your use case requires reporting energy cost by non time-based event, such as EV charging session, include session_reference_id when submitting meter records and use report-cost-by-session-id to get cost report.
curl --request POST \
  --url https://api.flatpeak.com/costs/interval/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "start_time": "2023-11-07T05:31:56Z",
  "end_time": "2023-12-07T05:31:56Z"
}'

Simulating energy cost profiles

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