[{"data":1,"prerenderedAt":166},["ShallowReactive",2],{"page:\u002Farticles\u002Ftermux-api-http":3},{"id":4,"title":5,"author":6,"body":10,"cover":152,"date":153,"description":154,"extension":155,"head":156,"layout":159,"meta":160,"navigation":161,"path":162,"seo":163,"stem":164,"__hash__":165},"pages\u002Farticles\u002F38.termux-api-http.md","Exposing Termux API Features over HTTP",{"name":7,"avatarUrl":8,"link":9},"Likun Cai","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F103620968?v=4","https:\u002F\u002Fgithub.com\u002FAlchemist-Aloha",{"type":11,"value":12,"toc":149},"minimark",[13,17,25,30,33,70,77,100,111,131,134,145],[14,15,5],"h1",{"id":16},"exposing-termux-api-features-over-http",[18,19,20,24],"p",{},[21,22,23],"code",{},"termux-api-http"," is a Node.js bridge from HTTP requests to Android system features exposed by Termux:API. It reports battery, Wi-Fi, location, and device information; triggers toast messages, vibration, and notifications; and exposes contacts, SMS, call logs, and clipboard access.",[26,27,29],"h2",{"id":28},"install-in-termux","Install in Termux",[18,31,32],{},"Install Termux, its Termux:API add-on, the command package, and Node.js:",[34,35,40],"pre",{"className":36,"code":37,"language":38,"meta":39,"style":39},"language-bash shiki shiki-themes github-light github-dark","pkg install termux-api nodejs\nnpm install\n","bash","",[21,41,42,61],{"__ignoreMap":39},[43,44,47,51,55,58],"span",{"class":45,"line":46},"line",1,[43,48,50],{"class":49},"sScJk","pkg",[43,52,54],{"class":53},"sZZnC"," install",[43,56,57],{"class":53}," termux-api",[43,59,60],{"class":53}," nodejs\n",[43,62,64,67],{"class":45,"line":63},2,[43,65,66],{"class":49},"npm",[43,68,69],{"class":53}," install\n",[18,71,72,73,76],{},"Create ",[21,74,75],{},".env"," with a strong key and a deliberate bind address:",[34,78,82],{"className":79,"code":80,"language":81,"meta":39,"style":39},"language-env shiki shiki-themes github-light github-dark","PORT=3000\nBIND_IP=127.0.0.1\nAPI_KEY=replace_with_a_long_random_value\n","env",[21,83,84,89,94],{"__ignoreMap":39},[43,85,86],{"class":45,"line":46},[43,87,88],{},"PORT=3000\n",[43,90,91],{"class":45,"line":63},[43,92,93],{},"BIND_IP=127.0.0.1\n",[43,95,97],{"class":45,"line":96},3,[43,98,99],{},"API_KEY=replace_with_a_long_random_value\n",[18,101,102,103,106,107,110],{},"Start the server with ",[21,104,105],{},"node server.js",". Authenticated calls use the ",[21,108,109],{},"X-API-Key"," header:",[34,112,114],{"className":36,"code":113,"language":38,"meta":39,"style":39},"curl -H \"X-API-Key: your_key\" http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fbattery\n",[21,115,116],{"__ignoreMap":39},[43,117,118,121,125,128],{"class":45,"line":46},[43,119,120],{"class":49},"curl",[43,122,124],{"class":123},"sj4cs"," -H",[43,126,127],{"class":53}," \"X-API-Key: your_key\"",[43,129,130],{"class":53}," http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fbattery\n",[18,132,133],{},"This API crosses a serious trust boundary. Contacts, messages, call logs, location, clipboard contents, notifications, and hardware controls are sensitive. Plain HTTP exposes the key and response data to the network, so do not bind the service publicly. Use loopback for local integrations or place it behind authenticated HTTPS with tight network access. Header authentication is preferable to a query parameter because URLs are commonly logged.",[18,135,136,137,144],{},"Visit the ",[138,139,143],"a",{"href":140,"rel":141},"https:\u002F\u002Fgithub.com\u002FAlchemist-Aloha\u002Ftermux-api-http",[142],"nofollow","termux-api-http repository"," for the complete endpoint list and current security notes.",[146,147,148],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--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);}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":39,"searchDepth":63,"depth":63,"links":150},[151],{"id":28,"depth":63,"text":29},"\u002Farticles\u002Ftermux-remote-cover.webp","2026-08-12T00:38:00.000Z","Wrap Android battery, network, location, notifications, communication data, and device actions in an authenticated Node.js API.","md",{"title":157},{"termux-api-http":158},"A Remote API for an Android Device","page",{},true,"\u002Farticles\u002Ftermux-api-http",{"title":5,"description":154},"articles\u002F38.termux-api-http","G3ka0yRZItabyovT9VpeKrdcC49qnpNABolr4nADs6w",1786980373677]