The ESP32 Device API provides three endpoints that the ESP32-C3 SuperMini firmware communicates with directly. Two endpoints receive periodic heartbeats and button-press events from the hardware. A separate pair of admin endpoints allows privileged users to inspect device status and reset the press counter. These routes use a dedicatedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Taykl12/Classify/llms.txt
Use this file to discover all available pages before exploring further.
X-Device-Token header for device authentication — they do not use the standard Bearer token.
Device routes authenticate with the
X-Device-Token header. The expected
token value is set in server/.env as ESP32_DEVICE_TOKEN. In development
environments the default token is dev-esp32-token. Make sure the value
flashed into the firmware matches the value in your .env file exactly.Device authentication
All/api/device/esp32/* endpoints require the following header:
GET /api/device/esp32/heartbeat
Records a heartbeat timestamp from the device. The firmware sends this request every 8 seconds to signal that the device is alive. Exponential backoff up to 30 seconds is applied when the request fails.Request
Response
POST /api/device/esp32/heartbeat
Functionally identical to the GET variant above. Both methods record the same heartbeat timestamp. The firmware may use either depending on the implementation revision.Request
Response
POST /api/device/esp32/button
Records a button press event. The ESP32-C3 firmware sends this request when the BOOT button (GPIO 9) is released. Each successful call increments the cumulative press counter and returns the current device status.Request
Response
Returns HTTP 200 withok: true merged with the current ESP32 status object.
Response fields
Always
true when the button press was recorded successfully.true when a heartbeat has been received within the last 15 seconds.Cumulative number of button presses recorded since the last admin reset.
ISO 8601 datetime string of the most recent heartbeat received from the
device, or
null if no heartbeat has been recorded yet.Example response
Code examples
Firmware behavior reference
The ESP32-C3 SuperMini firmware is designed to operate as follows:| Behavior | Details |
|---|---|
| Heartbeat interval | Every 8 seconds under normal conditions |
| Heartbeat backoff | Exponential backoff up to 30 seconds on consecutive failures |
| Button trigger | BOOT button (GPIO 9) — fires on button release |
| Heartbeat path | GET /api/device/esp32/heartbeat |
| Button path | POST /api/device/esp32/button |
| Authentication header | X-Device-Token matching ESP32_DEVICE_TOKEN env var |
Admin endpoints
The following endpoints allow administrators to monitor and manage device state. They require standard Bearer token authentication (notX-Device-Token).
GET /api/admin/esp32/status
Returns the current ESP32 status without modifying any data.Response fields
true when a heartbeat has been received within the last 15 seconds.Cumulative button press count since the last reset.
ISO 8601 datetime of the most recent heartbeat, or
null if none recorded.Example response
POST /api/admin/esp32/reset
Resets the cumulativepressCount to 0 and returns the updated device status. The lastSeenAt timestamp and connected state are not affected.
Example response
Admin code examples
Error responses
| Status | Meaning |
|---|---|
401 | Missing or invalid X-Device-Token (device routes) or Bearer token (admin routes). |
500 | Unexpected server error while recording the event or reading status. |