Skip to main content
POST
/
costs
/
interval
/
{id}
Calculate energy cost by time interval
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,
  "direction": "IMPORT",
  "location_timezone": "Europe/London",
  "currency_code": "EUR",
  "energy_units": "WH",
  "carbon_units": "gCO2eq",
  "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
      },
      "tariff": {
        "value": 928.372,
        "confidence": 1
      },
      "carbon": {
        "value": 35.24,
        "confidence": 0.8
      }
    }
  ],
  "account_id": "acc_661677911f2197045e6cf1b1"
}

Authorizations

Authorization
string
header
required

Path Parameters

id
string
required

Query Parameters

aggregation
string
Example:
direction
string
default:IMPORT
Example:
include_tariff
boolean
include_carbon
boolean

Body

application/json
start_time
string<date-time>
Example:
end_time
string<date-time>
Example:

Response

account_id
string
required
Example:
id
string
Example:
object
string
Example:
object_id
string
Example:
live_mode
boolean
direction
string
Example:
location_timezone
string
Example:
currency_code
string
Example:
energy_units
string
Example:
carbon_units
string
Example:
data
object[]