[{"data":1,"prerenderedAt":544},["ShallowReactive",2],{"doc-\u002Fapi\u002Fdevices":3},{"id":4,"title":5,"body":6,"description":534,"edit":535,"extension":536,"meta":537,"navigation":538,"path":539,"seo":540,"stem":541,"vertical":535,"weight":542,"__hash__":543},"content\u002Fapi\u002Fdevices.md","Devices API",{"type":7,"value":8,"toc":523},"minimark",[9,24,29,40,43,241,260,264,270,273,344,348,354,358,364,384,388,394,401,405,411,418,422,428,431,435,441,448,452,519],[10,11,12,13,17,18,23],"p",{},"A ",[14,15,16],"strong",{},"device"," is a hardware unit emitting measurements. See\n",[19,20,22],"a",{"href":21},"\u002Fgetting-started\u002Fconcepts","Concepts"," for the data model.",[25,26,28],"h2",{"id":27},"list-devices","List devices",[30,31,36],"pre",{"className":32,"code":34,"language":35},[33],"language-text","GET \u002Fv1\u002Fdevices?site_id=site_4f3c\n","text",[37,38,34],"code",{"__ignoreMap":39},"",[10,41,42],{},"Returns:",[30,44,48],{"className":45,"code":46,"language":47,"meta":39,"style":39},"language-json shiki shiki-themes github-dark github-dark","{\n  \"data\": [\n    {\n      \"id\":         \"dev_b1d2\",\n      \"site_id\":    \"site_4f3c\",\n      \"local_id\":   \"fridge01\",\n      \"name\":       \"Walk-in fridge\",\n      \"model\":      \"shelly-h-t-gen3\",\n      \"fw_version\": \"1.2.4\",\n      \"ingest_url_kind\": \"shelly_get\",\n      \"last_seen_at\":    \"2026-05-17T08:22:00Z\",\n      \"online\":     true\n    }\n  ],\n  \"next_cursor\": null,\n  \"has_more\": false\n}\n","json",[37,49,50,59,69,75,91,105,119,133,147,161,174,187,199,205,211,224,235],{"__ignoreMap":39},[51,52,55],"span",{"class":53,"line":54},"line",1,[51,56,58],{"class":57},"suv1-","{\n",[51,60,62,66],{"class":53,"line":61},2,[51,63,65],{"class":64},"s8ozJ","  \"data\"",[51,67,68],{"class":57},": [\n",[51,70,72],{"class":53,"line":71},3,[51,73,74],{"class":57},"    {\n",[51,76,78,81,84,88],{"class":53,"line":77},4,[51,79,80],{"class":64},"      \"id\"",[51,82,83],{"class":57},":         ",[51,85,87],{"class":86},"s4wv1","\"dev_b1d2\"",[51,89,90],{"class":57},",\n",[51,92,94,97,100,103],{"class":53,"line":93},5,[51,95,96],{"class":64},"      \"site_id\"",[51,98,99],{"class":57},":    ",[51,101,102],{"class":86},"\"site_4f3c\"",[51,104,90],{"class":57},[51,106,108,111,114,117],{"class":53,"line":107},6,[51,109,110],{"class":64},"      \"local_id\"",[51,112,113],{"class":57},":   ",[51,115,116],{"class":86},"\"fridge01\"",[51,118,90],{"class":57},[51,120,122,125,128,131],{"class":53,"line":121},7,[51,123,124],{"class":64},"      \"name\"",[51,126,127],{"class":57},":       ",[51,129,130],{"class":86},"\"Walk-in fridge\"",[51,132,90],{"class":57},[51,134,136,139,142,145],{"class":53,"line":135},8,[51,137,138],{"class":64},"      \"model\"",[51,140,141],{"class":57},":      ",[51,143,144],{"class":86},"\"shelly-h-t-gen3\"",[51,146,90],{"class":57},[51,148,150,153,156,159],{"class":53,"line":149},9,[51,151,152],{"class":64},"      \"fw_version\"",[51,154,155],{"class":57},": ",[51,157,158],{"class":86},"\"1.2.4\"",[51,160,90],{"class":57},[51,162,164,167,169,172],{"class":53,"line":163},10,[51,165,166],{"class":64},"      \"ingest_url_kind\"",[51,168,155],{"class":57},[51,170,171],{"class":86},"\"shelly_get\"",[51,173,90],{"class":57},[51,175,177,180,182,185],{"class":53,"line":176},11,[51,178,179],{"class":64},"      \"last_seen_at\"",[51,181,99],{"class":57},[51,183,184],{"class":86},"\"2026-05-17T08:22:00Z\"",[51,186,90],{"class":57},[51,188,190,193,196],{"class":53,"line":189},12,[51,191,192],{"class":64},"      \"online\"",[51,194,195],{"class":57},":     ",[51,197,198],{"class":64},"true\n",[51,200,202],{"class":53,"line":201},13,[51,203,204],{"class":57},"    }\n",[51,206,208],{"class":53,"line":207},14,[51,209,210],{"class":57},"  ],\n",[51,212,214,217,219,222],{"class":53,"line":213},15,[51,215,216],{"class":64},"  \"next_cursor\"",[51,218,155],{"class":57},[51,220,221],{"class":64},"null",[51,223,90],{"class":57},[51,225,227,230,232],{"class":53,"line":226},16,[51,228,229],{"class":64},"  \"has_more\"",[51,231,155],{"class":57},[51,233,234],{"class":64},"false\n",[51,236,238],{"class":53,"line":237},17,[51,239,240],{"class":57},"}\n",[10,242,243,244,247,248,251,252,255,256,259],{},"Filters: ",[37,245,246],{},"site_id"," (required unless using ",[37,249,250],{},"account_id","), ",[37,253,254],{},"online","\n(boolean), ",[37,257,258],{},"model"," (substring match).",[25,261,263],{"id":262},"create-a-device","Create a device",[30,265,268],{"className":266,"code":267,"language":35},[33],"POST \u002Fv1\u002Fdevices\n{\n  \"site_id\": \"site_4f3c\",\n  \"local_id\": \"fridge02\",\n  \"name\": \"Reach-in fridge\",\n  \"model\": \"diy_esp32\"\n}\n",[37,269,267],{"__ignoreMap":39},[10,271,272],{},"Response includes a freshly issued ingest token (only shown once):",[30,274,276],{"className":45,"code":275,"language":47,"meta":39,"style":39},"{\n  \"id\": \"dev_b1d3\",\n  \"local_id\": \"fridge02\",\n  \"ingest_token\": \"ds_live_4f3c1a2b…\",\n  \"ingest_url\":   \"https:\u002F\u002Fapi.opensense.murzin.digital\u002Fv1\u002Fingest\",\n  \"issued_at\":    \"2026-05-17T08:30:00Z\"\n}\n",[37,277,278,282,294,306,318,330,340],{"__ignoreMap":39},[51,279,280],{"class":53,"line":54},[51,281,58],{"class":57},[51,283,284,287,289,292],{"class":53,"line":61},[51,285,286],{"class":64},"  \"id\"",[51,288,155],{"class":57},[51,290,291],{"class":86},"\"dev_b1d3\"",[51,293,90],{"class":57},[51,295,296,299,301,304],{"class":53,"line":71},[51,297,298],{"class":64},"  \"local_id\"",[51,300,155],{"class":57},[51,302,303],{"class":86},"\"fridge02\"",[51,305,90],{"class":57},[51,307,308,311,313,316],{"class":53,"line":77},[51,309,310],{"class":64},"  \"ingest_token\"",[51,312,155],{"class":57},[51,314,315],{"class":86},"\"ds_live_4f3c1a2b…\"",[51,317,90],{"class":57},[51,319,320,323,325,328],{"class":53,"line":93},[51,321,322],{"class":64},"  \"ingest_url\"",[51,324,113],{"class":57},[51,326,327],{"class":86},"\"https:\u002F\u002Fapi.opensense.murzin.digital\u002Fv1\u002Fingest\"",[51,329,90],{"class":57},[51,331,332,335,337],{"class":53,"line":107},[51,333,334],{"class":64},"  \"issued_at\"",[51,336,99],{"class":57},[51,338,339],{"class":86},"\"2026-05-17T08:30:00Z\"\n",[51,341,342],{"class":53,"line":121},[51,343,240],{"class":57},[25,345,347],{"id":346},"get-a-device","Get a device",[30,349,352],{"className":350,"code":351,"language":35},[33],"GET \u002Fv1\u002Fdevices\u002Fdev_b1d2\n",[37,353,351],{"__ignoreMap":39},[25,355,357],{"id":356},"update-a-device","Update a device",[30,359,362],{"className":360,"code":361,"language":35},[33],"PATCH \u002Fv1\u002Fdevices\u002Fdev_b1d2\n{ \"name\": \"Walk-in fridge (front)\" }\n",[37,363,361],{"__ignoreMap":39},[10,365,366,367,370,371,370,374,377,378,380,381,383],{},"Mutable fields: ",[37,368,369],{},"name",", ",[37,372,373],{},"local_id",[37,375,376],{},"notes",". Immutable after creation:\n",[37,379,246],{}," (move via the dedicated move endpoint), ",[37,382,258],{}," (recreate\nthe device).",[25,385,387],{"id":386},"delete-a-device","Delete a device",[30,389,392],{"className":390,"code":391,"language":35},[33],"DELETE \u002Fv1\u002Fdevices\u002Fdev_b1d2\n",[37,393,391],{"__ignoreMap":39},[10,395,396,397,400],{},"Deletes the device row and revokes its ingest token. ",[14,398,399],{},"Measurements are\npreserved"," — they remain attached to the (now-removed) device for the\nretention period. Reports for periods that include the device's lifetime\nstill include them. This is intentional: HACCP cannot tolerate \"fridge\n3 disappeared\" from the audit trail.",[25,402,404],{"id":403},"move-a-device","Move a device",[30,406,409],{"className":407,"code":408,"language":35},[33],"POST \u002Fv1\u002Fdevices\u002Fdev_b1d2\u002Fmove\n{ \"to_site_id\": \"site_4f8b\", \"effective_at\": \"2026-05-17T08:30:00Z\" }\n",[37,410,408],{"__ignoreMap":39},[10,412,413,414,417],{},"Future measurements land under the new site. Past measurements remain\nunder the old site. Reports correctly partition by ",[37,415,416],{},"effective_at",".",[25,419,421],{"id":420},"rotate-ingest-token","Rotate ingest token",[30,423,426],{"className":424,"code":425,"language":35},[33],"POST \u002Fv1\u002Fdevices\u002Fdev_b1d2\u002Frotate-token\n",[37,427,425],{"__ignoreMap":39},[10,429,430],{},"Returns the new token (once). The old token is invalidated immediately.\nThe device's URL changes; you must update it in the device's web UI.",[25,432,434],{"id":433},"identify-led-blink","Identify (LED blink)",[30,436,439],{"className":437,"code":438,"language":35},[33],"POST \u002Fv1\u002Fdevices\u002Fdev_b1d2\u002Fidentify\n",[37,440,438],{"__ignoreMap":39},[10,442,443,444,447],{},"If the device supports the ",[37,445,446],{},"cmd\u002Fidentify"," MQTT command or the equivalent\nHTTP downlink, it makes its LED blink for 30 s. Used during installation\nwhen you have five identical sensors and want to know which is which.\nBest-effort; many sensors do not support it.",[25,449,451],{"id":450},"errors","Errors",[453,454,455,472],"table",{},[456,457,458],"thead",{},[459,460,461,465,469],"tr",{},[462,463,464],"th",{},"HTTP",[462,466,467],{},[37,468,37],{},[462,470,471],{},"When",[473,474,475,489,504],"tbody",{},[459,476,477,481,486],{},[478,479,480],"td",{},"404",[478,482,483],{},[37,484,485],{},"device_not_found",[478,487,488],{},"Wrong id or device belongs to another account",[459,490,491,494,499],{},[478,492,493],{},"409",[478,495,496],{},[37,497,498],{},"local_id_taken",[478,500,501,502],{},"Another device on the same site has that ",[37,503,373],{},[459,505,506,509,514],{},[478,507,508],{},"422",[478,510,511],{},[37,512,513],{},"unknown_model",[478,515,516,518],{},[37,517,258],{}," not in the supported set",[520,521,522],"style",{},"html pre.shiki code .suv1-, html code.shiki .suv1-{--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .s8ozJ, html code.shiki .s8ozJ{--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .s4wv1, html code.shiki .s4wv1{--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":39,"searchDepth":71,"depth":71,"links":524},[525,526,527,528,529,530,531,532,533],{"id":27,"depth":61,"text":28},{"id":262,"depth":61,"text":263},{"id":346,"depth":61,"text":347},{"id":356,"depth":61,"text":357},{"id":386,"depth":61,"text":387},{"id":403,"depth":61,"text":404},{"id":420,"depth":61,"text":421},{"id":433,"depth":61,"text":434},{"id":450,"depth":61,"text":451},"CRUD for hardware units",null,"md",{},true,"\u002Fapi\u002Fdevices",{"title":5,"description":534},"api\u002Fdevices",260,"LayVi1MMT5JhB99xZe5Jo_S4GKb1X68BBCZFHjr22Ik",1779022954069]