This is the primary endpoint for ESP32 devices to synchronize with the backend. The device sends itsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/GaelCeballos/Smart_Enviro_Backend/llms.txt
Use this file to discover all available pages before exploring further.
device_token as a query parameter and receives its current command (ON, OFF, or STANDBY) and the full set of configuration properties. This endpoint requires no user authentication — only the device token.
Endpoint
| Field | Value |
|---|---|
| Method | GET |
| Path | /api/device/sync |
| Auth | device_token query parameter — no Bearer token required |
Query Parameters
The 64-character device token provisioned in the database when the device was registered. This is the sole authentication mechanism for ESP32 devices.
Request Example
Responses
200 OK
The device token is valid and the device is active. The backend responds with the current command and the device’s full configuration property map.Always
"success" on a 200 response.The current actuator command for the device. Possible values:
ON— activate the actuatorOFF— deactivate the actuatorSTANDBY— hold in standby modeSLEEP— only returned on a 401; instructs the ESP32 to enter deep sleep
A flat key→value map of all
device_properties rows for this device. Keys are the property_key column values; values are always strings. The set of keys varies per device based on its configured properties.Example keys: "auto_water", "humidity_threshold", "dimmer_level", "has_pump", "has_humidity".401 Unauthorized
Thedevice_token does not match any device in the database, or the matching device has is_active = false. The ESP32 should enter deep sleep to conserve battery.
The
config object contains all device_properties rows for this device as a flat key→value map. Property keys are defined by the property_key column in the device_properties table. Update individual properties via PUT /api/my-devices/{id}/properties.