Skip to main content
POST
/
costs
/
session
/
{id}
Calculate energy cost by session ID
curl --request POST \
  --url https://api.flatpeak.com/costs/session/{id} \
  --header 'Authorization: Bearer <token>'
{
  "id": "ecs_65ea3fb185c1541f247c251e",
  "object": "energy_cost",
  "object_id": "dev_65e6d8334c8d715963d99db3",
  "live_mode": true,
  "tariff_direction": "IMPORT",
  "location_timezone": "Europe/London",
  "currency_code": "EUR",
  "energy_units": "WH",
  "data": [
    {
      "start_time": "2022-02-01T10:30:00Z",
      "end_time": "2022-02-01T11:00:00Z",
      "session_reference_id": "SESSION1234567890",
      "record_reference_id": "MET1234567890",
      "energy": {
        "value": 10284
      },
      "cost": {
        "value": 928.372,
        "confidence": 1
      }
    }
  ],
  "account_id": "acc_661677911f2197045e6cf1b1"
}

Authorizations

Authorization
string
header
required

Authenticate with bearer you obtained from authentication endpoint.

Path Parameters

id
string
required

Flatpeak session_reference_id from meter record as submitted by you via /meters endpoints.

Query Parameters

tariff_direction
string

Specifies the tariff direction; set to IMPORT, EXPORT, or LOCAL. Defaults to IMPORT.

Example:

"IMPORT"

Response

account_id
string
required

Flatpeak account id.

Example:

"acc_661677911f2197045e6cf1b1"

id
string

Flatpeak unique object ID that represents this response.

Example:

"ecs_65ea3fb185c1541f247c251e"

object
string

Flatpeak object type. I.e. energy_cost.

Example:

"energy_cost"

object_id
string

Flatpeak object location_id or device_id cost data is for.

Example:

"dev_65e6d8334c8d715963d99db3"

live_mode
boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

tariff_direction
string

Specified tariff direction. Possible values are IMPORT, EXPORT or LOCAL.

Example:

"IMPORT"

location_timezone
string

The timezone at the location, in 'tz database format'. I.e. 'Europe/Berlin'.

Example:

"Europe/London"

currency_code
string

Currency code for cost of energy measure. Always returned in large currency units.

Example:

"EUR"

energy_units
string

Units of energy measure.

Example:

"WH"

data
object[]