Version: v1.0.0
Base URL: http://your-server:8080
The InkSight backend handles device rendering, previews, configuration storage, device state, statistics, firmware info, and user-device binding.
| Method | Header / Credential | Description |
|---|---|---|
| Device Auth | X-Device-Token |
Used for device-facing APIs |
| User Auth | Session Cookie | Set by backend after login |
| Admin Auth | Session Cookie | Required for admin-level operations |
| Type | Description |
|---|---|
image/bmp |
Rendered image for the e-paper device |
image/png |
Image for browser preview / sharing / widgets |
application/json |
Config, state, stats, user, and mode data |
Main rendering endpoint for the device. Returns image/bmp.
| Parameter | Type | Required | Description |
|---|---|---|---|
v |
float |
No | Battery voltage, defaults to 3.3 |
mac |
string |
No | Device MAC; requires X-Device-Token if provided |
persona |
string |
No | Force a specific mode |
rssi |
int |
No | WiFi signal strength |
refresh_min |
int |
No | Actual refresh interval in minutes |
w |
int |
No | Screen width |
h |
int |
No | Screen height |
next |
int |
No | 1 to switch to the next mode |
Browser preview endpoint. Returns image/png.
| Parameter | Type | Required | Description |
|---|---|---|---|
v |
float |
No | Preview voltage |
mac |
string |
No | Device MAC |
persona |
string |
No | Force a specific mode |
city_override |
string |
No | Override city for this preview only |
mode_override |
string |
No | JSON override for the current mode |
memo_text |
string |
No | Override text for MEMO mode |
w |
int |
No | Screen width |
h |
int |
No | Screen height |
no_cache |
int |
No | 1 to bypass cache |
Save device configuration. Requires admin privileges.
Get current configuration. Requires X-Device-Token.
Get configuration history. Requires X-Device-Token.
Activate a specific historical configuration. Requires admin privileges.
Get all built-in and custom modes.
Preview a custom mode definition. Requires admin privileges.
Create a custom mode. Requires admin privileges.
Get a specific custom mode definition.
Delete a custom mode. Requires admin privileges.
Use AI to generate a mode definition from a description. Requires admin privileges.
Get available firmware list from GitHub Releases. Parameters:
refresh: Optional,trueto force cache refresh
Get the latest recommended firmware. Parameters:
refresh: Optional,trueto force cache refresh
Validate a manually entered firmware download URL. Parameters:
url: Required, must be an accessible.binfile URL
Get recently online devices, used for discovering devices after flashing. Parameters:
minutes: Optional, default10
The following endpoints target a single device and usually require X-Device-Token.
Mark the device to refresh immediately on its next wake-up.
Get device runtime state, online status, and refresh interval.
Set runtime mode, supports:
activeinterval
Push a one-time preview image to the device, returned on the next /api/render.
Set the device to switch to a specific mode on its next refresh.
Favorite the most recent content, or a specific mode.
Get the device's favorite list.
Get device content history. Common parameters:
limitoffsetmode
Record a habit check-in.
Get habit status for the current week.
Delete a habit and its records.
Generate or return an existing device token.
Generate a device binding QR code, returns image/bmp.
Generate a sharing image, returns image/png.
User registration, sets login state.
User login, sets login state.
Get current logged-in user info.
Logout.
Get the list of devices bound to the current user.
Bind a device to the current user.
Unbind a device from the current user.
Get global statistics overview. Requires admin privileges.
Get device statistics details. Requires X-Device-Token.
Get device render history. Requires X-Device-Token.
Parameters:
limitoffset
The backend calculates the battery percentage based on the v parameter (battery voltage). The current algorithm is a simple linear mapping, using 3.3V as the full-charge baseline:
def calc_battery_pct(voltage: float) -> int:
pct = int(voltage / 3.30 * 100)
if pct < 0:
return 0
if pct > 100:
return 100
return pctNote: If the device uses a 3.7V lithium battery with an LDO step-down, the ADC voltage is usually the battery voltage after a voltage divider, or a constant 3.3V from the LDO (depending on hardware design). The current algorithm is primarily designed for 3.3V direct-drive scenarios.
When rendering the top status bar, the battery icon fills according to the percentage and changes color on multi-color displays (like 3-color e-paper):
< 20%: Red (if supported)< 50%: Yellow (if supported)Other: Default foreground color (Black)
Due to limited RAM on the ESP32, the device must use stream processing to handle the image:
// Initiate request
http.begin("http://server/api/render?v=3.2");
int httpCode = http.GET();
if (httpCode == 200) {
int len = http.getSize();
WiFiClient *stream = http.getStreamPtr();
// Stream directly to display buffer
uint8_t buffer[128];
while (http.connected() && (len > 0 || len == -1)) {
size_t size = stream->available();
if (size) {
int c = stream->readBytes(buffer,
((size > sizeof(buffer)) ? sizeof(buffer) : size));
// Write buffer to e-paper driver memory
}
}
}