Device API Documentation
Get Device Data
Endpoint
GET /devices/{deviceId}/telemetryQuery Parameters
timeRangeorstart-endUse either timeRange preset or specific start/end dates:
timeRange options:
last5minslast1hourlast7dayslatest
Or date range:
start: ISO8601 formatend: ISO8601 format
Response Structure
Response Fields:
pack_voltage: Battery pack voltagecell_voltage: Array of individual cell voltagestemperature: Battery temperaturesoc: State of chargebms_state: Current BMS state
REQUEST EXAMPLE
curl --location 'https://apidev.xbattery.energy/v1/devices/{deviceId}/telemetry?timeRange=latest' \
-H 'ApiKey: f76d******************d2a'RESPONSE EXAMPLE
{
"success": true,
"data": [
{
"deviceId": "STM32H753ZI",
"Device_id": "BMS_DEVICE_1",
"pack_voltage": 41.2708,
"cell_voltage": [
2.6968,
2.7811,
2.8042,
2.7843,
2.8008,
2.7985,
2.7929,
2.8156,
2.7982,
2.6405,
2.743,
2.6616,
2.7149,
2.7432,
2.7851
],
"temperature": 27.315,
"pack_current": 0,
"soc": 21.02,
"ocv_soc": 21.82,
"soh": 0,
"bms_state": "DISCHARGING",
"main_contactor_state": true,
"charger_contactor_state": false,
"id": "3806730799eb-42559efd-3afdd8b56d87",
"_ts": 1736784740
}
],
"meta": {
"organizationId": 1,
"deviceId": "STM32H753ZI",
"timeRange": "latest",
"timestamp": "20250220T102405.103Z"
}
}Get All Devices
Endpoint
GET /devicesResponse Structure
Response Fields:
DeviceId: Unique identifier for the deviceOrganizationId: Organization identifierName: Device nameModel: Device modelLocation: Device locationLastConnected: Last connection timestampStatus: Device status
REQUEST EXAMPLE
curl --location 'https://apidev.xbattery.energy/v1/devices' \
-H 'ApiKey: f76d******************d2a'RESPONSE EXAMPLE
{
"success": true,
"data": [
{
"DeviceId": "DVC12345",
"OrganizationId": 1,
"Name": "Battery Storage Unit",
"Model": "BESSModel-X",
"Location": "Delhi",
"LastConnected": "20250220T090354.130Z",
"Status": "enabled",
"CreatedAt": "20250220T090354.490Z",
"UpdatedAt": "20250220T090354.133Z"
}
]
}Add Device
Endpoint
POST /devicesRequest Body Parameters
deviceIdUnique identifier for the device
nameName of the device
modelModel of the device
locationPhysical location of the device
Response Structure
Response Fields:
success: Operation status
REQUEST EXAMPLE
curl --location 'https://apidev.xbattery.energy/v1/devices' \
-H 'ApiKey: f76d******************d2a' \
-H 'Content-Type: application/json' \
--data '{
"deviceId": "DVC12345",
"name": "Battery Storage Unit",
"model": "BESSModel-X",
"location": "Delhi"
}'RESPONSE EXAMPLE
{
"success": true
}