Skip to main content
POST
/
costs
/
interval
/
{id}
Report historic energy cost
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"
}'
{
  "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 location_id or device_id.

Query Parameters

aggregation
string

Aggregation interval, supported values are DAY, MONTH.

Example:

"MONTH"

tariff_direction
string

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

Body

application/json
start_time
string<date-time>

Period start time. In RFC3339 format e.g. 2023-06-15T09:00:00Z or with time-offset, e.g. 2023-06-15T08:00:00+01:00.

Example:

"2023-11-07T05:31:56Z"

end_time
string<date-time>

Period end time. In RFC3339 format e.g. 2023-06-15T09:00:00Z or with time-offset, e.g. 2023-06-15T08:00:00+01:00.

Example:

"2023-12-07T05:31:56Z"

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[]