DocsReferenceAPI reference
Updates and boot
Write signed firmware over Wi-Fi, confirm or roll back a new kernel, switch the boot partition, fetch the crash dump. Boot rules: docs/interfaces.md section 1
POST /v1/ota#
Write a signed firmware image (used by stick deploy)
The body is the built .bin as is (signed with the signing key; Content-Length required). The device writes it to the target partition as it arrives, then checks the image and its signature; only then is it set to boot. slot=kernel writes the other kernel slot, and after the restart the new kernel is pending: POST /v1/ota/confirm within 60 s or it rolls back. slot=rescue works only in the kernel and goes through the other kernel slot, wiping the fallback version there. The web app cannot call this; use stick deploy / stick deploy rescue
Parameters#
| Parameter | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
slot | string | kernel rescue; default kernel | kernel (default) or rescue (rescue firmware) | ||
reboot | integer | 0 1 | 1 = restart after replying; defaults to 1 for kernel, 0 for rescue |
Request body#
application/octet-stream
Signed firmware image, no larger than the target partition
Examples#
Start of an image (illustration)#
Only the image header (magic e9) and the app description (magic 0xABCD5432, version 0.1.0, project_name stick_kernel, build ID); a real device answers bad_image. Push real images with stick deploy
e907024ffc5d3740ee00000009000000 00630000000000012000143cc84b0700 3254cdab000000000000000000000000 302e312e300000000000000000000000 00000000000000000000000000000000 737469636b5f6b65726e656c00000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 1a2b3c4d5e6f7a8b0000000000000000 00000000000000000000000000000000Reply#
Written
The image is written and its signature verified
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
slot | string | Yes | kernel_a kernel_b rescue | Partition written | |
version | string | Yes | Version of the image | ||
build | string | Yes | pattern ^[0-9a-f]{16}$ | Build ID: first 16 hex digits of the ELF's SHA-256 | |
reboot | boolean | Yes | true = restarts into the new image about 0.5 s after replying |
Error codes#
| Status | Code | Description |
|---|---|---|
400 | bad_slot | slot is not kernel / rescue, or rescue was given in the rescue firmware |
409 | pending | The running kernel is pending: POST /v1/ota/confirm or /v1/ota/rollback first |
409 | busy | Another image is being written |
400 | wrong_project | Wrong project_name: kernel needs stick_kernel, rescue needs stick_rescue |
400 | bad_image | Not an app image, incomplete, or the check or signature failed. Nothing was installed |
400 | wrong_key | The image is signed with a different key: the device only accepts the signing key of the firmware it is running (ota.sign_key in info). Nothing was installed; changing keys requires reflashing over USB (stick usb-flash, or the web installer for official firmware) |
413 | too_large | Larger than the target partition |
500 | no_slot | Target partition not found (wrong partition table) |
500 | ota_begin | Starting the partition write failed. Check stick logs |
500 | set_boot | Setting the boot partition failed. Check stick logs |
For errors any endpoint can return, see Common errors.
POST /v1/ota/confirm#
Confirm the pending kernel
Call within 60 s after a new kernel boots to mark it valid so it no longer rolls back; on timeout or a crash while pending it rolls back to the previous version. stick deploy calls it after its health check
Reply#
Confirmed
The running kernel is marked valid
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
build | string | Yes | pattern ^[0-9a-f]{16}$ | Build ID: first 16 hex digits of the ELF's SHA-256 |
Error codes#
| Status | Code | Description |
|---|---|---|
409 | not_pending | The running kernel is not pending (already confirmed, or in the rescue firmware) |
500 | confirm | Marking failed. Check stick logs |
For errors any endpoint can return, see Common errors.
POST /v1/ota/rollback#
Switch to the other kernel slot and restart
Boots the version in the other kernel slot, restarting about 0.5 s after replying; while a new kernel is pending this abandons it at once. Not available in the rescue firmware
Reply#
Restarting
The boot partition is set; restarts about 0.5 s after replying
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
target | string | Yes | rescue kernel_a kernel_b | Partition booted after the restart |
Error codes#
| Status | Code | Description |
|---|---|---|
409 | no_fallback | The other kernel slot has no usable version, or this is the rescue firmware |
500 | set_boot | Setting the boot partition failed. Check stick logs |
For errors any endpoint can return, see Common errors.
POST /v1/boot#
Switch the boot partition and restart
Sets the firmware to boot next and restarts about 0.5 s after replying. From the rescue firmware, use kernel to go back. Host: stick boot rescue|kernel
Request body#
application/json
Firmware to boot
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
target | string | Yes | rescue kernel kernel_a kernel_b | rescue = rescue firmware; kernel = the last confirmed kernel slot (else whichever is valid); kernel_a / kernel_b = that slot |
Examples#
Boot the rescue firmware#
{"target": "rescue"}Back to the kernel#
{"target": "kernel"}Reply#
Restarting
The boot partition is set; restarts about 0.5 s after replying
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
target | string | Yes | rescue kernel_a kernel_b | Partition booted after the restart |
Error codes#
| Status | Code | Description |
|---|---|---|
400 | bad_target | target must be rescue / kernel / kernel_a / kernel_b. See the example “Boot the rescue firmware” for the correct form |
409 | no_image | The target partition has no usable firmware |
500 | set_boot | Setting the boot partition failed. Check stick logs |
For errors any endpoint can return, see Common errors.
GET /v1/crash#
Raw crash dump (decode with stick crash --decode)
The crash dump partition as is (ESP-IDF raw format); decode with stick crash --decode (finds the archived ELF by build ID) or esp-coredump --core-format raw. A summary (task, PC, backtrace) is in crash of GET /v1/info
Reply#
Raw dump
The reply is binary.
application/octet-stream
Error codes#
| Status | Code | Description |
|---|---|---|
404 | no_crash | No crash dump |
For errors any endpoint can return, see Common errors.
DELETE /v1/crash#
Clear the crash dump
Erases the crash dump partition; succeeds even when there is none
Reply#
Cleared
Successful reply; endpoints add their own fields
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true |
Error codes#
| Status | Code | Description |
|---|---|---|
500 | erase | Erasing failed. Check stick logs |
For errors any endpoint can return, see Common errors.