---
updatedAt: 2025-07-02T08:35:11.000Z
agentTools:
  projectIndex: https://docs.vitro.io/llms.txt
---

# List battery events

List the events of a battery in a given time range

Battery events are triggered when metric measurements deviate from expected values and cross defined thresholds. These events help monitor the health and performance of batteries in the system.

For example, if a battery is expected to have a voltage of `V=13.42`, and a reading shows an unexpectedly low or high voltage that crosses the set thresholds, the system will trigger either a warning or an alert, depending on how high the deviation is.

<Image align="center" border={false} caption="Low voltage on battery, crossing the Alert threshold" src="https://files.readme.io/0c670ad5ca93f940b01280899b51ff1774e28bae53dc052fd9fa4fae6b7300dd-image.png" />

The events list provides a historical record of all events a battery has experienced over time.

<Image align="center" border={false} caption="List of events the battery went through" src="https://files.readme.io/e9b20c53bf225b9dc59c2dea8869fff00273487bce570abf0e663802a4eb031d-image.png" />

The following metrics can trigger alerts:

* **Core temperature**: The average temperature of the battery poles
* **Pole diff temperature**: The temperature difference between the poles
* **Resistance**: The battery's electrical resistance
* **Voltage**: The battery's voltage level
* **Charge**: The battery's charge level
* **Online**: The battery's connectivity status with Astra (whether it's sending heartbeats)

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Astra HTTP API",
    "description": "API Specification for the ASTRA backend, which will expose datacenters and battery information for the UI application to construct dashboards. ",
    "contact": {
      "email": "rafal@kult.io"
    },
    "version": "1.0-BETA"
  },
  "servers": [
    {
      "url": "https://api.dev.vitro.link/api/",
      "description": "Development"
    }
  ],
  "tags": [
    {
      "name": "Standard"
    }
  ],
  "paths": {
    "/operationHistory/findByBattery": {
      "get": {
        "summary": "List battery events",
        "description": "List the events of a battery in a given time range",
        "operationId": "getOperationHistory",
        "tags": [
          "Standard"
        ],
        "parameters": [
          {
            "name": "batteryId",
            "in": "query",
            "description": "ID of battery to return",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "query",
            "description": "Acts as a filter for the groupId of events.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "toDatetime",
            "in": "query",
            "description": "Last date time of the history (format ISO 8601). Defaults to today.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Offset from the paginated results. Defaults to 0.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Last number of history entries. Defaults to 10.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "grouping",
            "in": "query",
            "description": "Grouping of the data for the limits and offsets. If group is used, \"limit 2\" will return all events from the first 2 groups. Defaults to \"event\"",
            "schema": {
              "type": "string",
              "enum": [
                "event",
                "group"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ArrayOfOperationHistory"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid data supplied"
          },
          "404": {
            "description": "History not found"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "OperationHistory": {
        "type": "object",
        "properties": {
          "batteryId": {
            "type": "string"
          },
          "metric": {
            "description": "Metric of the Operation History",
            "enum": [
              "TEMP_CORE",
              "TEMP_POLE_DIFF",
              "VOLTAGE",
              "RESISTANCE",
              "CHARGE",
              "ONLINE"
            ]
          },
          "operation_datetime": {
            "type": "string",
            "example": "2013-03-01T13:05:16",
            "format": "date-time"
          },
          "status": {
            "description": "Status of the battery",
            "enum": [
              "OK",
              "TEMP_WARNING",
              "TEMP_ALERT",
              "VOLTAGE_WARNING",
              "VOLTAGE_ALERT"
            ],
            "example": "OK"
          },
          "groupId": {
            "type": "string",
            "description": "Group that all correlated events share",
            "example": "g_1705618152_831160"
          }
        }
      },
      "ArrayOfOperationHistory": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/OperationHistory"
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ]
}
```