Skip to main content
PUT
/
devices
/
{id}
/
state
Submit a device state
curl --request PUT \
  --url https://api.flatpeak.com/devices/{id}/state \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "location_id": "loc_641b90b758fb8e6293716e40",
  "time": "2022-02-01T10:30:00Z",
  "state_of_charge_percent": 34.2,
  "target_state_of_charge_percent": 80,
  "battery_power_kw": -3.4,
  "energy_remaining_kwh": 8.3,
  "backup_reserve_percent": 20,
  "record_reference_id": "MET1234567890"
}
'
{
  "id": "dsr_6a284b7596d3f2b722544e70",
  "device_id": "dev_6563a6757360a6d6a628e839",
  "time_created": "2022-02-01T10:33:00Z",
  "account_id": "acc_661677911f2197045e6cf1b1",
  "object": "device_state"
}

Authorizations

Authorization
string
header
required

Authenticate with bearer you obtained from authentication endpoint.

Path Parameters

id
string
required

Flatpeak device_id.

Body

application/json
location_id
string
required

Flatpeak location_id where device is located.

Example:

"loc_641b90b758fb8e6293716e40"

time
string<date-time>
required

Time the measurement was recorded, in RFC3339 format.

Example:

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

state_of_charge_percent
number
required

Current battery state of charge as a percentage from 0 to 100.

Example:

34.2

target_state_of_charge_percent
number
required

Target battery state of charge as a percentage from 0 to 100.

Example:

80

battery_power_kw
number

Current battery power in kilowatts. Positive values indicate charging, negative values indicate discharging.

Example:

-3.4

energy_remaining_kwh
number

Estimated usable energy currently available in the battery, in kilowatt-hours.

Example:

8.3

backup_reserve_percent
number

Percentage of battery capacity reserved for backup and unavailable for optimisation or dispatch.

Example:

20

record_reference_id
string

Optional unique identifier for the telemetry record, used for idempotency and reconciliation.

Example:

"MET1234567890"

Response

Example response

id
string
required

Flatpeak device state record ID.

Example:

"dsr_6a284b7596d3f2b722544e70"

device_id
string
required

Flatpeak device ID.

Example:

"dev_6563a6757360a6d6a628e839"

time_created
string<date-time>
required

Time when this object was created. In UTC.

Example:

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

account_id
string
required

Flatpeak account ID.

Example:

"acc_661677911f2197045e6cf1b1"

object
string

Flatpeak object, i.e. device_state.

Example:

"device_state"