Skip to main content
POST
/
costs
/
instant
Instantly calculate energy cost
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",
  "session_reference_id": "SESSION1234567890",
  "record_reference_id": "MET1234567890",
  "energy_flow_direction": "INBOUND",
  "tariff_direction": "IMPORT",
  "units": "W",
  "confidence": 1,
  "value": 20567,
  "start_time": "2022-02-01T10:30:00Z",
  "end_time": "2022-02-01T11:00:00Z"
}'
{
  "id": "mre_65e641b570b2901d3a40199d",
  "object": "meter_record",
  "live_mode": true,
  "energy_flow_direction": "INBOUND",
  "tariff_direction": "IMPORT",
  "currency_code": "GBP",
  "energy_units": "WH",
  "request": {
    "location_id": "loc_641b90b758fb8e6293716e40",
    "device_id": "dev_65e6d8334c8d715963d99db3",
    "session_reference_id": "SESSION1234567890",
    "record_reference_id": "MET1234567890",
    "energy_flow_direction": "IMPORT",
    "tariff_direction": "IMPORT",
    "units": "W",
    "confidence": 1,
    "value": 20567,
    "start_time": "2022-02-01T10:30:00Z",
    "end_time": "2022-02-01T11:00:00Z",
    "non_persistent": false
  },
  "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
    }
  },
  "time_created": "2022-02-01T10:33:00Z",
  "account_id": "acc_661677911f2197045e6cf1b1"
}

Authorizations

Authorization
string
header
required

Authenticate with bearer you obtained from authentication endpoint.

Query Parameters

non_persistent
boolean

Set to true to avoid storing metering records permanently. Use for simulating consumption to estimate potential energy costs.

Body

application/json
location_id
string
required

Flatpeak location_id that you are submitting metering records for.

Example:

"loc_641b90b758fb8e6293716e40"

units
string
required

Units of measure, supported values are W, KW, WH, KWH. When W or KW units are submitted, cost will be calculated using the constant power rate over the period.

Example:

"W"

value
number
required

Amount of energy measured.

Example:

20567

start_time
string<date-time>
required

Metering record 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:

"2022-02-01T10:30:00Z"

end_time
string<date-time>
required

Metering record 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:

"2022-02-01T11:00:00Z"

device_id
string

Flatpeak device_id you are submitting metering records for. If you provided both location_id and device_id, your records will be attributed to device_id.

Example:

"dev_65e6d8334c8d715963d99db3"

session_reference_id
string

A reference for a group of metering records, for example, a charging session ID.

Example:

"SESSION1234567890"

record_reference_id
string

A reference for this metering record, for example, meter log ID.

Example:

"MET1234567890"

energy_flow_direction
string

Energy flow direction. Set to INBOUND or OUTBOUND. Defaults to INBOUND.

Example:

"INBOUND"

tariff_direction
string

Tariff direction to apply. Set to IMPORT, EXPORT, or LOCAL. Defaults to IMPORT.

Example:

"IMPORT"

confidence
number

Estimated confidence of data where '1' is 100% accurate and 0.1 is 10% accurate. Defaults to '1'. This parameter is in beta. Contact support to enable.

Example:

1

Response

Response example

id
string
required

Flatpeak meter record id.

Example:

"mre_65e641b570b2901d3a40199d"

object
string
required

Flatpeak object type, i.e. meter_record.

Example:

"meter_record"

live_mode
boolean
required

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

energy_flow_direction
string
required

Energy flow direction. Set to INBOUND or OUTBOUND. Defaults to INBOUND.

Example:

"INBOUND"

tariff_direction
string
required

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

Example:

"IMPORT"

currency_code
string
required

Currency code for cost of energy measure.

Example:

"GBP"

energy_units
string
required

Units of energy measure.

Example:

"WH"

request
object
required
data
object
required

Value of energy object

time_created
string
required

Time when this object was created. In UTC.

Example:

"2022-02-01T10:33:00Z"

account_id
string

Flatpeak account ID.

Example:

"acc_661677911f2197045e6cf1b1"