This document provides basic reference for the web-based REST API endpoints. These endpoints are primarily used by the embedded web UI and are not intended for extensive external integration.
Base URL: http://ledclock.local (or device IP address)
Authentication: None (all endpoints are currently unauthenticated)
Content-Type: application/json
Serves the web configuration interface.
Response: HTML page
Example:
curl http://ledclock.local/Get current device configuration.
Response: JSON object with all configuration settings
Example:
curl http://ledclock.local/api/configResponse Example:
{
"portalSsid": "LED-Clock-Setup",
"ledBrightness": 200,
"clockColorMode": 1,
"weatherTempEnabled": true,
"locationLatitude": "47.3769",
"locationLongitude": "8.5417"
}Update device configuration.
Request Body: JSON object with configuration fields to update (partial updates supported)
Response: Success or error message
Example:
curl -X POST http://ledclock.local/api/config \
-H "Content-Type: application/json" \
-d '{"ledBrightness": 150, "clockColorMode": 0}'Response Example:
{
"success": true,
"message": "Configuration saved"
}Error Responses:
400- Invalid JSON or validation error413- Payload too large (max 2048 bytes)500- Failed to save to filesystem
Get the configuration schema used by the web UI.
Response: JSON schema describing all configuration fields, validation rules, and UI layout
Example:
curl http://ledclock.local/api/schemaGet device version and hardware information.
Response: JSON object with version info and chip details
Example:
curl http://ledclock.local/api/versionResponse Example:
{
"version": "2025-12-28_2211",
"chipModel": "ESP32-D0WDQ6",
"chipCores": 2,
"flashSize": 4194304,
"freeHeap": 234567
}Detect current location based on IP address (uses ipapi.co service).
Response: JSON object with geographic coordinates and location details
Example:
curl http://ledclock.local/api/geolocationResponse Example:
{
"success": true,
"latitude": "47.376900",
"longitude": "8.541700",
"city": "Zurich",
"postalCode": "8001",
"region": "Zurich",
"country": "Switzerland"
}Error Responses:
503- WiFi not connected500- Geolocation lookup failed
Privacy Note: This endpoint sends a request to ipapi.co to determine location. No personal data is transmitted beyond the device's IP address.
Restart the device.
Response: Success message (device restarts after 2 seconds)
Example:
curl -X POST http://ledclock.local/api/restartResponse Example:
{
"success": true,
"message": "Device will restart in 2 seconds"
}Upload firmware for OTA (Over-The-Air) update.
Request: Multipart form data with firmware binary file
Response: Success or error message (device restarts automatically on success)
Example:
curl -X POST http://ledclock.local/api/update \
-F "file=@firmware.bin"Response Example:
{
"success": true,
"message": "Update complete. Restarting..."
}Error Responses:
500- Update failed (insufficient space, corrupted file, etc.)
Note: The device will restart automatically after a successful firmware update.
Recommendations:
- Use the device only on trusted networks
- Change default portal password from the fallback
- Consider network-level security (firewall, VLAN isolation)
No rate limiting is currently implemented. The device may become unresponsive if endpoints are called too frequently.
- All configuration changes are persisted to LittleFS filesystem
- Some configuration changes require a device restart to take effect (noted in web UI)
- The device uses mDNS for hostname resolution (
ledclock.local) - API responses may include additional fields not documented here