DocsReferenceAPI reference
Device
Device info, status, logs, screen language, time zone, BOOT button events, identify and restart. info and nonce are open; the rest need signing
GET /v1/info#
Device info: ID, firmware, memory, Wi-Fi, OTA slots, microSD card, web app version
Open; no signing. Hosts use it to identify the device, its firmware and whether it is paired; the rescue firmware omits the kernel-only sections
Reply#
Device info
Sections are filled in by components; hid, apps, sd, blackbox and www exist only in the kernel
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
api | integer | Yes | ≥ 1 | API version, currently 1 | |
id | string | Yes | Device ID: stick- plus the last 6 hex digits of the Wi-Fi MAC | ||
mode | string | Yes | kernel rescue | Running firmware: kernel, or rescue (rescue firmware) | |
lang | string | Yes | zh en | Screen language (GET /v1/lang) | |
fw | object | Yes | Running firmware | ||
project | string | Yes | Project name: stick_kernel / stick_rescue | ||
version | string | Yes | Version | ||
build | string | Yes | pattern ^[0-9a-f]{16}$ | Build ID: first 16 hex digits of the ELF SHA-256 | |
idf | string | Yes | ESP-IDF version | ||
date | string | Yes | Build time | ||
uptime_ms | integer | Yes | ≥ 0 | Milliseconds since boot | |
reset_reason | string | Yes | poweron sw panic int_wdt task_wdt wdt brownout deepsleep other | Reset reason of this boot: poweron, sw = software restart, panic = crash, int_wdt / task_wdt / wdt = watchdog, brownout = low voltage | |
heap | object | Yes | Memory (bytes) | ||
internal_free | integer | Yes | ≥ 0 | Free internal memory | |
internal_min | integer | Yes | ≥ 0 | Lowest free internal memory since boot | |
psram_free | integer | Yes | ≥ 0 | Free PSRAM | |
wifi | object | Yes | Wi-Fi | ||
ssid | string | null | Yes | Current (or connecting) network; null if none | ||
rssi | integer | null | Yes | Signal strength (dBm); null when not connected | ||
ip | string | null | Yes | IP address; null when not connected | ||
provisioning | boolean | Yes | Wi-Fi setup is on (setup hotspot open) | ||
known | integer | Yes | 0–3 | Number of remembered networks (up to 3) | |
paired | boolean | Yes | Paired (the device has a pairing key) | ||
ota | object | Yes | Partitions and the latest update | ||
running | string | Yes | Running partition: rescue / kernel_a / kernel_b | ||
boot | string | Yes | Partition for the next boot | ||
state | string | Yes | valid pending new invalid aborted undefined empty | Partition state: valid, pending = awaiting confirmation, new = written but not booted yet, invalid / aborted = discarded, undefined = unknown, empty | |
confirm_left_s | integer | null | Yes | Seconds until automatic rollback while awaiting confirmation; otherwise null | ||
sign_key | string | Digest of the signing public key accepted for Wi-Fi updates (SHA-256 of the public key in the running firmware's signature block, 64 hex digits; empty if unreadable). Firmware from 2026-12-02 on | |||
slots | object[] | Yes | The rescue, kernel_a and kernel_b partitions | ||
label | string | Yes | rescue kernel_a kernel_b | Partition name | |
project | string | Project name | |||
version | string | Version | |||
build | string | pattern ^[0-9a-f]{16}$ | Build ID | ||
state | string | Yes | valid pending new invalid aborted undefined empty | Partition state: valid, pending = awaiting confirmation, new = written but not booted yet, invalid / aborted = discarded, undefined = unknown, empty | |
last | object | Yes | Result of the latest update | ||
result | string | Yes | none written confirmed rolled_back | none = no record, written, confirmed, rolled_back | |
build | string | Yes | Build ID involved; empty if none | ||
detail | string | Yes | Note: partition written, how it was confirmed, or why it rolled back | ||
crash | object | Yes | Crash dump (fetch it with GET /v1/crash); without one, only the present field | ||
present | boolean | Yes | A crash dump exists | ||
size | integer | ≥ 0 | Dump size in bytes | ||
task | string | Task that crashed | |||
pc | string | Crash address | |||
backtrace | string[] | Backtrace addresses, up to 16 | |||
backtrace_corrupted | boolean | The backtrace is corrupted | |||
build | string | Build ID of the dump (stick crash --decode finds the ELF by it) | |||
hid | object | HID summary (details in GET /v1/hid) | |||
usb | string | Yes | hid serial | USB mode | |
mounted | boolean | Yes | The computer has enumerated the device | ||
armed | boolean | Yes | The network source is armed | ||
play | object | Yes | microSD card timeline playback (details in GET /v1/hid/play_file) | ||
state | string | Yes | idle checking playing done stopped | Playback state | |
path | string | null | Yes | Path on the card; null if nothing played | ||
done | integer | Yes | ≥ 0 | Records executed | |
records | integer | Yes | ≥ 0 | Number of records | |
apps | object | Apps | |||
running | string | null | Yes | ID of the running app; null if none | ||
state | string | Yes | stopped running error | App state | |
auto | string | null | Yes | App that starts on boot; null if none | ||
fs_used | integer | Yes | ≥ 0 | Storage bytes used | |
fs_total | integer | Yes | ≥ 0 | Storage bytes in total | |
fonts | integer[] | Yes | 20 24 32 48 | Font sizes with the full font loaded | |
time_synced | boolean | Yes | Time is synced | ||
sd | object | microSD card; only the present and reason fields when not mounted | |||
present | boolean | Yes | The card is mounted | ||
card | string | Card name (CID) | |||
kind | string | SDSC SDHC/SDXC MMC SDIO | Card type | ||
bus_khz | integer | ≥ 0 | Bus clock (kHz) | ||
total | integer | ≥ 0 | FAT size in bytes | ||
used | integer | ≥ 0 | FAT bytes used | ||
reason | string | no_card not_fat io_error | Why it is not mounted: no_card, not_fat = not FAT formatted, io_error = read/write error | ||
blackbox | object | Black-box log (written to the microSD card) | |||
state | string | Yes | waiting writing full error | waiting = waiting for a card, writing, full = stopped at 16 MB, error | |
file | string | null | Yes | Log file on the card; null if none | ||
bytes | integer | Yes | ≥ 0 | Bytes written | |
lost | integer | Yes | ≥ 0 | Lines lost since boot | |
www | object | null | Device web app; null if not installed | |||
version | string | Yes | Web app version | ||
api | integer | Yes | API version the web app needs |
Error codes#
For errors any endpoint can return, see Common errors.
GET /v1/nonce#
Get a one-time nonce for signing (valid 60 s; authenticated replies also carry X-Stick-Nonce)
Open. Each nonce is single use and expires in 60 s; the device keeps up to 16 and drops the oldest when full. Using the one from the reply header saves this round trip
Reply#
Nonce
One-time nonce for signing
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
nonce | string | Yes | pattern ^[0-9a-f]{32}$ | 32 hex digits; single use | |
ttl_s | integer | Yes | ≥ 1 | Seconds it stays valid |
Error codes#
For errors any endpoint can return, see Common errors.
GET /v1/status#
Status bus snapshot: current states and events
active lists the states that are on, recent the latest events; the screen and LED follow them
Reply#
Status snapshot
Status bus snapshot
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
active | object[] | Yes | States currently on | ||
id | string | Yes | Status name (status_map.def, e.g. OTA_PENDING) | ||
value | integer | Yes | Value; -1 = none | ||
detail | string | Yes | ≤ 63 bytes | Detail; may be empty | |
since_ms | integer | Yes | ≥ 0 | Uptime in ms when it began | |
recent | object[] | Yes | The latest 16 events, oldest first | ||
id | string | Yes | Status name (status_map.def, e.g. OTA_PENDING) | ||
value | integer | Yes | Value; -1 = none | ||
detail | string | Yes | ≤ 63 bytes | Detail; may be empty | |
t_ms | integer | Yes | ≥ 0 | Uptime in ms when it happened |
Error codes#
For errors any endpoint can return, see Common errors.
GET /v1/logs#
Log ring
Fetch incrementally: pass the last next as since. A new boot means the device restarted and numbering starts again at 0. Polling every 300 ms follows the log live
Parameters#
| Parameter | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
since | integer | ≥ 0 | Start at this sequence number (inclusive), the last next; omit for the last max lines | ||
max | integer | default 200 | 1–500 | Max lines |
Reply#
Logs
A slice of the log ring
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
boot | string | Yes | pattern ^[0-9a-f]{8}$ | Boot ID: random per boot; a change means the device restarted | |
next | integer | Yes | ≥ 0 | since for the next request | |
dropped | integer | Yes | ≥ 0 | Lines after since that were overwritten and are lost | |
lines | object[] | Yes | Log lines, oldest first | ||
seq | integer | Yes | ≥ 0 | Sequence number | |
ms | integer | Yes | ≥ 0 | Uptime in ms | |
text | string | Yes | ≤ 240 bytes | Text without newline or color codes; long lines are cut and end with … |
Error codes#
For errors any endpoint can return, see Common errors.
POST /v1/identify#
Identify: screen and LED signal for 5 s
Shows which device this is and changes nothing; no request body
Reply#
Signalled
Successful reply; endpoints add their own fields
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true |
Error codes#
For errors any endpoint can return, see Common errors.
POST /v1/reboot#
Restart 0.5 s after replying
Releases all keys first. Restarting a new kernel that awaits confirmation rolls it back (the bootloader returns to the previous version); no request body
Reply#
Restarting
Successful reply; endpoints add their own fields
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true |
Error codes#
For errors any endpoint can return, see Common errors.
GET /v1/lang#
Screen (system UI) language: zh / en; chosen means someone picked it
Applies only to the device screen (system UI); app text and message in replies stay as they are
Reply#
Screen language
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
lang | string | Yes | zh en | Current language: zh = Chinese, en = English | |
chosen | boolean | Yes | Someone has chosen it; Chinese until then | ||
langs | string[] | Yes | zh en | Available languages |
Error codes#
For errors any endpoint can return, see Common errors.
POST /v1/lang#
Set the screen language; saved and applied immediately
Saved on the device; the screen is rebuilt in the new language at once, without a restart. Replies like GET. Applies only to the device screen (system UI); app text and message in replies stay as they are
Request body#
application/json
Screen language to switch to
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
lang | string | Yes | zh en | zh = Chinese, en = English |
Examples#
Switch to English#
{"lang": "en"}Switch to Chinese#
{"lang": "zh"}Reply#
Saved; current language
Screen language
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
lang | string | Yes | zh en | Current language: zh = Chinese, en = English | |
chosen | boolean | Yes | Someone has chosen it; Chinese until then | ||
langs | string[] | Yes | zh en | Available languages |
Error codes#
| Status | Code | Description |
|---|---|---|
400 | bad_lang | lang must be zh or en (also returned when the body is not JSON). See the example “Switch to English” for the correct form |
500 | nvs | Saving failed. Retry; if it persists, check stick logs |
For errors any endpoint can return, see Common errors.
GET /v1/time#
Time and time zone (POSIX TZ + IANA name)
The clock syncs over SNTP; the time zone sets local, Lua os.date and the time on screen
Reply#
Time and time zone
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
synced | boolean | Yes | Time is synced (SNTP) | ||
epoch | integer | null | Yes | Unix seconds; null until synced | ||
local | string | null | Yes | Local time YYYY-MM-DD HH:MM:SS; null until synced | ||
tz | string | Yes | POSIX TZ string (CST-8 until set) | ||
zone | string | Yes | IANA time zone name; may be empty |
Error codes#
For errors any endpoint can return, see Common errors.
POST /v1/time#
Set the time zone; applied immediately
Saved on the device and applied at once; replies like GET. The host command stick tz fills both from the local time zone
Request body#
application/json
Time zone to set
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
tz | string | Yes | pattern ^[A-Za-z0-9<>+,.:/-]+$ | length 1–63 | POSIX TZ string, 1–63 bytes of letters, digits and <>+-,.:/ |
zone | string | pattern ^[!-~]*$ | length ≤ 63 | IANA time zone name, for display only; optional (stored empty), ≤ 63 bytes of printable ASCII without spaces |
Examples#
Sydney (with daylight saving)#
{"tz": "AEST-10AEDT,M10.1.0,M4.1.0/3", "zone": "Australia/Sydney"}tz only#
zone omitted; stored empty
{"tz": "UTC0"}Reply#
Saved; current time and time zone
Time and time zone
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
synced | boolean | Yes | Time is synced (SNTP) | ||
epoch | integer | null | Yes | Unix seconds; null until synced | ||
local | string | null | Yes | Local time YYYY-MM-DD HH:MM:SS; null until synced | ||
tz | string | Yes | POSIX TZ string (CST-8 until set) | ||
zone | string | Yes | IANA time zone name; may be empty |
Error codes#
| Status | Code | Description |
|---|---|---|
400 | bad_tz | tz must be 1–63 bytes of letters, digits and <>+-,.:/; zone ≤ 63 bytes of printable ASCII without spaces. See the example “Sydney (with daylight saving)” for the correct form |
500 | nvs | Saving failed. Retry; if it persists, check stick logs |
For errors any endpoint can return, see Common errors.
GET /v1/button#
BOOT button event ring (click / double-click / long press / hold; stop marks emergency stop)
Fetch incrementally: pass the last next as since. Clicks and double-clicks that answer a pairing request belong to the system and are not recorded
Parameters#
| Parameter | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
since | integer | default 0 | ≥ 0 | Only events after this sequence number, the last next | |
max | integer | default 32 | 1–32 | Max events (the latest ones) |
Reply#
BOOT button events
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
next | integer | Yes | ≥ 0 | Sequence number of the latest event; since for the next request | |
down | boolean | Yes | BOOT is held now | ||
press_stop | boolean | Yes | The latest press was an emergency stop | ||
events | object[] | Yes | Events, oldest first (the ring keeps the latest 32) | ||
seq | integer | Yes | ≥ 0 | Sequence number | |
ms | integer | Yes | ≥ 0 | Uptime in ms | |
ev | string | Yes | down up click double long hold | down, up, click, double = double-click, long = long press (0.8 s), hold = held 5 s | |
stop | boolean | Yes | This press was an emergency stop |
Error codes#
For errors any endpoint can return, see Common errors.