This documentation aims to provide all the information you need to work with our API.
To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_TOKEN}".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
You can retrieve your token by logging in.
Authenticate a user and issue a Sanctum access token.
curl --request POST \
"https://amarnathm74labs.com/api/auth/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"[email protected]\",
\"password\": \"secret\",
\"device_name\": \"iPhone 15\"
}"
{
"token": "1|abc123",
"token_type": "Bearer"
}
Revoke the access token used for this request.
curl --request POST \
"https://amarnathm74labs.com/api/auth/logout" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"message": "Logged out."
}
Retrieve all MQTT brokers configured by the authenticated user.
curl --request GET \
--get "https://amarnathm74labs.com/api/brokers" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" [
{
"id": 1,
"name": "Primary broker",
"api_endpoint": "https://mqtt.example.com/api",
"app_id": "app-id",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
]
Register a new EMQX broker for the authenticated user.
curl --request POST \
"https://amarnathm74labs.com/api/brokers" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Primary broker\",
\"api_endpoint\": \"https:\\/\\/mqtt.example.com\\/api\",
\"app_id\": \"app-id\",
\"app_secret\": \"app-secret\"
}"
{
"id": 1,
"name": "Primary broker",
"api_endpoint": "https://mqtt.example.com/api",
"app_id": "app-id",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
Retrieve configuration for a single EMQX broker.
The ID of the broker.
ID of the broker.
curl --request GET \
--get "https://amarnathm74labs.com/api/brokers/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"id": 1,
"name": "Primary broker",
"api_endpoint": "https://mqtt.example.com/api",
"app_id": "app-id",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
Modify the configuration for an EMQX broker.
The ID of the broker.
ID of the broker.
curl --request PUT \
"https://amarnathm74labs.com/api/brokers/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Primary broker\",
\"api_endpoint\": \"https:\\/\\/mqtt.example.com\\/api\",
\"app_id\": \"app-id\",
\"app_secret\": \"app-secret\"
}"
{
"id": 1,
"name": "Primary broker",
"api_endpoint": "https://mqtt.example.com/api",
"app_id": "app-id",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
Remove an EMQX broker and unlink its devices.
The ID of the broker.
ID of the broker.
curl --request DELETE \
"https://amarnathm74labs.com/api/brokers/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"message": "Broker deleted."
}
Retrieve paginated calibration history for a device.
The ID of the device.
ID of the device.
Page number for pagination.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/calibrations?page=1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"current_page": 1,
"data": [
{
"id": 1,
"device_id": 1,
"calibrated_at": "2024-01-01T12:00:00Z",
"mode": "normal",
"status": "complete",
"ai_gain": "1.000123",
"av_gain": "0.999876",
"error_message": null,
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
],
"total": 1
}
Retrieve all available device capabilities.
curl --request GET \
--get "https://amarnathm74labs.com/api/capabilities" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" [
{
"value": "relay",
"label": "Relay"
},
{
"value": "energy_meter",
"label": "Energy Meter"
}
]
Retrieve paginated cycle/waveform readings for a device.
The ID of the device.
ID of the device.
Page number for pagination.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/cycles?page=1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"current_page": 1,
"data": [
{
"id": 1,
"device_id": 1,
"recorded_at": "2024-01-01T12:00:00Z",
"frequency": "50.000",
"samples_per_cycle": 80,
"av_calibration_coeff": 1.342445739e-5,
"ai_calibration_coeff": 4.190951586e-7,
"samples": [
[
-16664835,
73840
],
[
-18470656,
71248
]
],
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
],
"total": 1
}
Retrieve the most recent cycle/waveform reading for a device.
The ID of the device.
ID of the device.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/cycles/latest" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"id": 1,
"device_id": 1,
"recorded_at": "2024-01-01T12:00:00Z",
"frequency": "50.000",
"samples_per_cycle": 80,
"av_calibration_coeff": 1.342445739e-5,
"ai_calibration_coeff": 4.190951586e-7,
"samples": [
[
-16664835,
73840
],
[
-18470656,
71248
]
],
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
List available waveform captures with metadata (no sample data) for date/time browsing.
The ID of the device.
ID of the device.
Filter from this datetime (ISO 8601).
Filter to this datetime (ISO 8601).
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/cycles/available?from=2024-01-01T00%3A00%3A00Z&to=2024-01-31T23%3A59%3A59Z" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"2026-05-08T17:58:52\",
\"to\": \"2026-05-08T17:58:52\"
}"
{
"data": [
{
"id": 1,
"recorded_at": "2024-01-01T12:00:00Z",
"frequency": "50.000",
"samples_per_cycle": 80
}
]
}
Retrieve a specific waveform capture with computed analysis metrics.
The ID of the device.
The ID of the cycle.
ID of the device.
ID of the cycle reading.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/cycles/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"id": 1,
"recorded_at": "2024-01-01T12:00:00Z",
"frequency": "50.000",
"samples_per_cycle": 80,
"waveform": {
"voltage": [
230.5,
228.1
],
"current": [
5.12,
4.98
],
"power_instantaneous": [
1180.16,
1135.9
],
"time_ms": [
0,
0.25
]
},
"analysis": {
"voltage_rms": 230.5,
"current_rms": 5.12,
"voltage_peak": 325.8,
"current_peak": 7.24,
"voltage_crest_factor": 1.414,
"current_crest_factor": 1.414,
"power_real": 1150,
"power_apparent": 1180,
"power_factor": 0.975,
"phase_angle_deg": 12.5
}
}
Retrieve device metrics for the authenticated user.
curl --request GET \
--get "https://amarnathm74labs.com/api/dashboard/metrics" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"devices_total": 3,
"devices_online": 1,
"recent_telemetry": [
{
"id": 42,
"device_id": 7,
"received_at": "2024-01-01T12:00:00Z",
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T12:00:00Z",
"event": "message.delivered",
"event_id": "evt-123",
"event_timestamp": "2024-01-01T12:00:05Z",
"device": {
"id": 7,
"name": "Living room sensor",
"username": "mqtt-user",
"client_id": "sensor-1"
}
}
]
}
Send an on/off relay command to the device.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/relay" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"state\": \"on\"
}"
{
"status": "sent",
"command": "relay",
"state": "on"
}
Start, stop, or check status of single-channel mSure calibration.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/calibrate" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"op\": \"start\",
\"channel\": \"AI\",
\"mode\": \"normal\"
}"
{
"status": "sent",
"command": "calibrate",
"op": "start",
"channel": "AI",
"mode": "normal"
}
Start full AI + AV mSure calibration sequence (~45 seconds).
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/autocal" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"status": "sent",
"command": "autocal"
}
Switch the device between normal, debug, and monitoring operating modes. Monitoring mode sends readings on every energy ready interrupt (~10s) and auto-returns to normal after 10 minutes.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/mode" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"mode\": \"normal\"
}"
{
"status": "sent",
"command": "mode",
"mode": "normal"
}
Set the reading interval for energy measurements.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/config" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"interval_ms\": 5000
}"
{
"status": "sent",
"command": "config",
"interval_ms": 5000
}
Perform a direct register read or write on the ADE9153A.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/register" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"action\": \"read\",
\"address\": \"0x0000\",
\"value\": 42
}"
{
"status": "sent",
"command": "register",
"action": "read",
"address": "0x0000"
}
Request full system diagnostics from the device.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/diag" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"status": "sent",
"command": "diag"
}
Perform hardware reset of the ADE chip (pulls RESET pin).
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/ade-hw-reset" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"status": "sent",
"command": "ade_hw_reset"
}
Deinitialize and re-initialize the full energy meter stack.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/ade-reset" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"status": "sent",
"command": "ade_reset"
}
Set the overcurrent trip threshold in milliamps.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/oc-config" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"threshold_ma\": 12000
}"
{
"status": "sent",
"command": "oc_config",
"threshold_ma": 12000
}
Clear the overcurrent trip flag so relay can be turned ON again.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/oc-reset" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"status": "sent",
"command": "oc_reset"
}
Reboot the ESP32 device.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/esp-reset" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"status": "sent",
"command": "esp_reset"
}
Set the no-load power threshold in watts.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/noload-config" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"threshold_w\": 0.001
}"
{
"status": "sent",
"command": "noload_config",
"threshold_w": 0.001
}
Request a cycle/waveform capture from the device. Response arrives as type:cycle within 10-15 seconds.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/waveform" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"status": "sent",
"command": "waveform"
}
Retrieve paginated telemetry records for a device.
The ID of the device.
ID of the device.
Page number for pagination.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/telemetry?page=1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"current_page": 1,
"data": [
{
"id": 10,
"device_id": 1,
"payload": "{\"cmd\":\"ade_mode\",\"status\":\"error\",\"error\":\"ESP_ERR_INVALID_STATE\"}",
"received_at": "2024-01-01T12:00:00Z",
"event": "message.publish",
"event_id": "evt-123",
"event_timestamp": "2024-01-01T12:00:01Z",
"created_at": "2024-01-01T12:00:01Z",
"updated_at": "2024-01-01T12:00:01Z"
}
],
"total": 1
}
Retrieve all devices owned by the authenticated user.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" [
{
"id": 1,
"name": "Living room sensor",
"broker_id": 1,
"username": "mqtt-user",
"client_id": "sensor-1",
"notes": "Measures temperature",
"last_received_at": "2024-01-01T12:00:00Z",
"status": "connected",
"status_at": "2024-01-01T12:05:00Z",
"telemetry": [],
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
]
Register a new device for the authenticated user.
curl --request POST \
"https://amarnathm74labs.com/api/devices" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Living room sensor\",
\"broker_id\": 1,
\"username\": \"mqtt-user\",
\"client_id\": \"sensor-1\",
\"notes\": \"architecto\",
\"capabilities\": [
\"relay\",
\"energy_meter\"
]
}"
{
"id": 1,
"name": "Living room sensor",
"username": "mqtt-user",
"client_id": "sensor-1",
"notes": "Measures temperature",
"last_received_at": null,
"status": null,
"status_at": null,
"capabilities": [
{
"capability": "relay",
"props": null
}
],
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
Retrieve details for a single device.
The ID of the device.
ID of the device.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"id": 1,
"name": "Living room sensor",
"broker_id": 1,
"username": "mqtt-user",
"client_id": "sensor-1",
"notes": "Measures temperature",
"last_received_at": "2024-01-01T12:00:00Z",
"status": "connected",
"status_at": "2024-01-01T12:05:00Z",
"telemetry": [],
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
Modify an existing device.
The ID of the device.
ID of the device.
curl --request PUT \
"https://amarnathm74labs.com/api/devices/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Living room sensor\",
\"broker_id\": 1,
\"username\": \"mqtt-user\",
\"client_id\": \"sensor-1\",
\"notes\": \"architecto\",
\"capabilities\": [
\"relay\",
\"energy_meter\"
]
}"
{
"id": 1,
"name": "Living room sensor",
"username": "mqtt-user",
"client_id": "sensor-1",
"notes": "Measures temperature",
"last_received_at": "2024-01-02T00:00:00Z",
"status": "disconnected",
"status_at": "2024-01-02T00:05:00Z",
"capabilities": [
{
"capability": "relay",
"props": null
}
],
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-02T00:00:00Z"
}
Remove a device and its credentials.
The ID of the device.
ID of the device.
curl --request DELETE \
"https://amarnathm74labs.com/api/devices/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"message": "Device deleted."
}
Send a message to the device topic.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/publish" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"payload\": \"device-online\",
\"payload_encoding\": \"plain\",
\"qos\": 1,
\"retain\": false
}"
{
"id": "00060563A10558877ACA0C006CFA0000"
}
curl --request GET \
--get "https://amarnathm74labs.com/api/user" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
{
"message": "Unauthenticated."
}
Retrieve paginated energy aggregations for a device.
The ID of the device.
ID of the device.
Filter by period type (hourly or daily).
Filter aggregations from this date (Y-m-d format).
Filter aggregations to this date (Y-m-d format).
Page number for pagination.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/aggregations?period=hourly&from=2024-01-01&to=2024-01-31&page=1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"current_page": 1,
"data": [
{
"id": 1,
"device_id": 1,
"period": "hourly",
"period_start": "2024-01-01T12:00:00Z",
"energy_wh": "150.5000",
"reading_count": 60,
"avg_voltage": "120.5000",
"avg_current": "5.1234",
"avg_power_factor": "0.9800",
"max_power": "650.0000",
"min_power": "580.0000",
"created_at": "2024-01-01T13:00:00Z",
"updated_at": "2024-01-01T13:00:00Z"
}
],
"total": 1
}
Retrieve energy summary totals with quality metrics.
The ID of the device.
ID of the device.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/aggregations/summary" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"today": "12.5000",
"this_week": "85.2500",
"this_month": "320.7500",
"all_time": "1500.0000",
"avg_daily_kwh": 0.43,
"projected_monthly_kwh": 12.9,
"voltage_quality": {
"avg_voltage": 230.5,
"in_range_pct": 95.5,
"quality_score": "good"
},
"avg_power_factor": 0.92
}
Retrieve paginated energy readings for a device with optional time filtering.
The ID of the device.
ID of the device.
Page number for pagination.
Filter readings from this datetime (ISO 8601).
Filter readings to this datetime (ISO 8601).
Sort order by recorded_at (asc or desc).
Items per page (max 200).
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/readings?page=1&from=2024-01-01T00%3A00%3A00Z&to=2024-01-31T23%3A59%3A59Z&order=desc&per_page=25" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"2026-05-08T17:58:52\",
\"to\": \"2026-05-08T17:58:52\",
\"order\": \"asc\",
\"per_page\": 1
}"
{
"current_page": 1,
"data": [
{
"id": 1,
"device_id": 1,
"recorded_at": "2024-01-01T12:00:00Z",
"voltage_rms": "120.5000",
"current_rms": "5.123456",
"power_active": "615.0000",
"power_fvar": "100.0000",
"power_apparent": "623.0000",
"power_factor": "0.9870",
"frequency": "60.000",
"phase_angle": "17.47",
"voltage_peak": "170.2500",
"current_peak": "7.234567",
"voltage_crest": "1.4142",
"current_crest": "1.4142",
"energy_wh": "1234.5678",
"energy_wh_delta": "0.1234",
"temp_c": "42.50",
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
],
"total": 1
}
Retrieve the most recent energy reading for a device.
The ID of the device.
ID of the device.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/readings/latest" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"id": 1,
"device_id": 1,
"recorded_at": "2024-01-01T12:00:00Z",
"voltage_rms": "120.5000",
"current_rms": "5.123456",
"power_active": "615.0000",
"power_fvar": "100.0000",
"power_apparent": "623.0000",
"power_factor": "0.9870",
"frequency": "60.000",
"phase_angle": "17.47",
"voltage_peak": "170.2500",
"current_peak": "7.234567",
"voltage_crest": "1.4142",
"current_crest": "1.4142",
"energy_wh": "1234.5678",
"energy_wh_delta": "0.1234",
"temp_c": "42.50",
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
Retrieve aggregated statistics for energy readings within a time window.
The ID of the device.
ID of the device.
Start datetime (ISO 8601).
End datetime (ISO 8601).
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/readings/stats?from=2024-01-01T00%3A00%3A00Z&to=2024-01-31T23%3A59%3A59Z" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"2026-05-08T17:58:52\",
\"to\": \"2026-05-08T17:58:52\"
}"
{
"period": {
"from": "2024-01-01T00:00:00Z",
"to": "2024-01-31T23:59:59Z",
"reading_count": 1440
},
"voltage": {
"avg": 230.5,
"min": 218,
"max": 242,
"std_dev": 3.2,
"in_range_pct": 95.5,
"sag_count": 12,
"swell_count": 3
},
"current": {
"avg": 4.5,
"min": 0.1,
"max": 15.2
},
"power": {
"avg": 1035,
"min": 23,
"max": 3500,
"total_energy_wh": 14904
},
"power_factor": {
"avg": 0.92,
"min": 0.45,
"max": 0.99,
"below_085_pct": 8.5
},
"frequency": {
"avg": 50,
"min": 49.8,
"max": 50.2,
"std_dev": 0.05
},
"temperature": {
"avg": 42.5,
"min": 35,
"max": 55
}
}
Retrieve time-bucketed energy readings for charting.
The ID of the device.
ID of the device.
Start datetime (ISO 8601).
End datetime (ISO 8601).
Metric to aggregate: voltage_rms, current_rms, power_active, power_factor, frequency, temp_c, or all.
Bucket interval: 5m, 15m, 1h, 6h, 1d, 1w.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/readings/timeseries?from=2024-01-01T00%3A00%3A00Z&to=2024-01-02T00%3A00%3A00Z&metric=voltage_rms&interval=1h" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"2026-05-08T17:58:52\",
\"to\": \"2026-05-08T17:58:52\",
\"metric\": \"power_active\",
\"interval\": \"1h\"
}"
{
"interval": "1h",
"metric": "voltage_rms",
"data": [
{
"bucket": "2024-01-01 00:00:00",
"avg": 230.5,
"min": 228,
"max": 233,
"count": 60
}
]
}
Get histogram-style distribution of a metric.
The ID of the device.
ID of the device.
Start datetime (ISO 8601).
End datetime (ISO 8601).
Metric to distribute: voltage_rms, current_rms, power_active, power_factor, frequency, temp_c.
Number of histogram buckets (2-100).
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/readings/distribution?from=2024-01-01T00%3A00%3A00Z&to=2024-01-31T23%3A59%3A59Z&metric=voltage_rms&buckets=20" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"2026-05-08T17:58:52\",
\"to\": \"2026-05-08T17:58:52\",
\"metric\": \"current_rms\",
\"buckets\": 1
}"
{
"metric": "voltage_rms",
"buckets": [
{
"range_start": 218,
"range_end": 219.2,
"count": 15,
"percentage": 3.5
}
],
"total_count": 430
}
Get average energy usage by hour of day.
The ID of the device.
ID of the device.
Start datetime (ISO 8601).
End datetime (ISO 8601).
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/readings/hourly-profile?from=2024-01-01T00%3A00%3A00Z&to=2024-01-31T23%3A59%3A59Z" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"2026-05-08T17:58:52\",
\"to\": \"2026-05-08T17:58:52\"
}"
{
"data": [
{
"hour": 0,
"avg_power": 120.5,
"avg_voltage": 231.2,
"total_energy_wh": 240.5,
"reading_count": 120
}
]
}
Retrieve paginated loads for a device with optional filtering.
The ID of the device.
ID of the device.
Page number for pagination.
Filter loads started from this datetime (ISO 8601).
Filter loads started to this datetime (ISO 8601).
Sort by: date, energy, or duration.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/loads?page=1&from=2024-01-01T00%3A00%3A00Z&to=2024-01-31T23%3A59%3A59Z&sort=date" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"2026-05-08T17:58:52\",
\"to\": \"2026-05-08T17:58:52\",
\"sort\": \"duration\"
}"
{
"current_page": 1,
"data": [
{
"id": 1,
"device_id": 1,
"name": "TV",
"started_at": "2024-01-01T10:00:00Z",
"ended_at": "2024-01-01T12:00:00Z",
"start_energy_wh": "1234.5678",
"end_energy_wh": "1240.1234",
"energy_consumed_wh": "5.5556",
"created_at": "2024-01-01T10:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
],
"total": 1
}
Retrieve the current active load for a device.
The ID of the device.
ID of the device.
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/loads/active" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"id": 1,
"device_id": 1,
"name": "TV",
"started_at": "2024-01-01T10:00:00Z",
"ended_at": null,
"start_energy_wh": "1234.5678",
"end_energy_wh": null,
"energy_consumed_wh": null,
"created_at": "2024-01-01T10:00:00Z",
"updated_at": "2024-01-01T10:00:00Z"
}
Aggregate load statistics grouped by appliance name.
The ID of the device.
ID of the device.
Filter loads started from this datetime (ISO 8601).
Filter loads started to this datetime (ISO 8601).
curl --request GET \
--get "https://amarnathm74labs.com/api/devices/1/loads/summary?from=2024-01-01T00%3A00%3A00Z&to=2024-01-31T23%3A59%3A59Z" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"2026-05-08T17:58:52\",
\"to\": \"2026-05-08T17:58:52\"
}"
{
"data": [
{
"name": "TV",
"session_count": 15,
"total_energy_wh": 450.25,
"total_duration_minutes": 1800.5,
"avg_power_w": 15,
"projected_monthly_kwh": 0.54
}
]
}
Start a new load for a device. Ends any existing active load.
The ID of the device.
ID of the device.
curl --request POST \
"https://amarnathm74labs.com/api/devices/1/loads" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"TV\"
}"
{
"id": 1,
"device_id": 1,
"name": "TV",
"started_at": "2024-01-01T10:00:00Z",
"ended_at": null,
"start_energy_wh": "1234.5678",
"end_energy_wh": null,
"energy_consumed_wh": null,
"created_at": "2024-01-01T10:00:00Z",
"updated_at": "2024-01-01T10:00:00Z"
}
End a specific load and calculate energy consumed.
The ID of the device.
The ID of the load.
ID of the device.
ID of the load.
curl --request PUT \
"https://amarnathm74labs.com/api/devices/1/loads/1/end" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"id": 1,
"device_id": 1,
"name": "TV",
"started_at": "2024-01-01T10:00:00Z",
"ended_at": "2024-01-01T12:00:00Z",
"start_energy_wh": "1234.5678",
"end_energy_wh": "1240.1234",
"energy_consumed_wh": "5.5556",
"created_at": "2024-01-01T10:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
Ingest messages forwarded from the EMQX HTTP connector.
The ID of the broker.
Webhook secret appended to the route.
ID of the broker receiving webhook traffic.
curl --request POST \
"https://amarnathm74labs.com/api/emqx_endpoint/1/architecto" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"client\": \"sensor-1\",
\"username\": \"mqtt-user\",
\"payload\": \"device-online\",
\"received_at\": \"1704110400000\",
\"event\": \"message.delivered\",
\"timestamp\": \"1704110405000\",
\"id\": \"11f56100\"
}"
{
"status": "accepted"
}
Retrieve the full EMQX webhook endpoint for a broker.
The ID of the broker.
curl --request GET \
--get "https://amarnathm74labs.com/api/brokers/1/webhook" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"url": "https://example.com/api/emqx_endpoint/1/secret123"
}
Generate a new webhook secret for the broker.
The ID of the broker.
curl --request POST \
"https://amarnathm74labs.com/api/brokers/1/webhook/rotate" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" {
"url": "https://example.com/api/emqx_endpoint/1/newsecret456"
}