REST API

Authentication

Local access

Connect directly to your Solar Assistant device on your local network using your device password. A password must be configured on the device before the API can be used - see the local password guide for instructions.

curl -u admin:<password> http://192.168.0.100/api/v1/metrics

Cloud access

When accessing a SolarAssistant unit via the cloud, requests go through two layers of security. See the sacli authorize section for details.

Endpoints

The examples below assume your device's IP address is 192.168.0.100. You can find your device's IP address in the access overview.

Get all metrics:

curl -u admin:<password> http://192.168.0.100/api/v1/metrics

Filter by topic glob:

curl -u admin:<password> "http://192.168.0.100/api/v1/metrics?topic=battery*"
curl -u admin:<password> "http://192.168.0.100/api/v1/metrics?topic=total/*"

Get a single value as plain text:

curl -u admin:<password> "http://192.168.0.100/api/v1/metrics?topic=total/load_power&value=1"

Example JSON response:

[
  {"topic": "total/pv_power", "group": "Status", "name": "PV power", "value": 1240, "unit": "W"},
  {"topic": "total/load_power", "group": "Status", "name": "Load power", "value": 940, "unit": "W"},
  {"topic": "total/battery_state_of_charge", "group": "Status", "name": "Battery state of charge", "value": 80, "unit": "%"}
]

To authenticate with a token instead of a password, pass it as a Bearer token in the Authorization header:

curl -H "Authorization: Bearer <token>" "http://192.168.0.100/api/v1/metrics"

Topic structure

Topics follow the same structure as MQTT. Metrics are grouped under total/, inverter_1/, inverter_2/, battery_1/, etc. Some common topics:

  • total/pv_power - combined PV power across all inverters (W)
  • total/load_power - total load power (W)
  • total/grid_power - grid power, negative = export (W)
  • total/battery_power - battery power, negative = charging (W)
  • total/battery_state_of_charge - battery state of charge (%)
  • inverter_1/device_mode - current inverter mode
  • battery_1/voltage - battery voltage (V)

To see all available topics for your specific inverter and battery model, call the metrics endpoint without a filter and inspect the topic fields in the response.