Connect a device.
All endpoints use JSON over HTTPS. User dashboard endpoints use HttpOnly cookies and an X-CSRF-Token header for writes. Device endpoints use X-Device-ID and X-Device-Secret. Never put credentials in URLs or committed firmware.
Register a device
POST /api/v1/devices · {"name":"Desk lamp","type":"binary","deviceType":"esp32-relay"} · 201 {"deviceId":"dev_…","credential":"…"}The generated credential is displayed once. Store it in device configuration and rotate it if exposed.
Report status
POST /api/v1/devices/{deviceId}/heartbeat · Headers: X-Device-ID, X-Device-Secret · Body: {"state":{"state":"ON"}}Issue a binary command
POST /api/v1/devices/{deviceId}/command · {"action":"setPowerState","value":{"state":"ON"}} · 202 {"commandId":"uuid","status":"queued"}Devices poll GET /api/v1/device/commands with device headers, then acknowledge at POST /api/v1/device/commands/{commandId}/ack with {"status":"acknowledged"}.
Configure variable capabilities
PUT /api/v1/devices/{deviceId}/capabilities · {"controls":[{"key":"brightness","title":"Brightness","type":"slider","min":0,"max":100,"step":1,"unit":"%","defaultValue":50},{"key":"color","title":"Color","type":"color","defaultValue":"#ff6633"}]}Variable command: {"action":"setVariables","values":{"brightness":75,"color":"#3366ff"}}. The server checks names, types, ranges, steps, options and color format against saved capabilities.
Timers and API limits
Create, list, edit and delete timers at /api/v1/timers. Countdown timers use intervalSeconds; scheduled timers accept ISO-8601 UTC runAt. Recurring expressions use standard cron syntax. User endpoints return HTTP 429 when quota is exceeded.
Common errors
- 401: authentication required or expired.
- 403: ownership, CSRF or account status restriction.
- 404: resource missing within signed-in account.
- 429: API quota exceeded.
See examples/esp32 and the root README for firmware and deployment.