Termux:API bridges the gap between the Linux terminal and the Android operating system. Once installed, it adds a set ofDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/termux/termux-app/llms.txt
Use this file to discover all available pages before exploring further.
termux-* commands that call Android APIs directly — so you can read GPS coordinates, send SMS messages, post notifications, control the camera, and interact with the clipboard entirely from shell scripts or the command line.
How it works
Termux:API consists of two parts that must both be installed:- The Termux:API APK — a background Android app that handles API calls and holds the necessary Android permissions.
- The
termux-apipackage — a set of shell wrapper scripts installed viapkg, which send requests to the APK via Unix sockets.
termux-* command in the terminal, the shell script passes the request to the APK, which uses Android APIs to fulfill it and returns the result to stdout.
Installation
Install the Termux:API APK
Download and install the Termux:API APK from the same source as your main Termux app (F-Droid or GitHub). Open the app once after installing to register it.
Available commands
The following commands are available after installing thetermux-api package:
| Command | Description |
|---|---|
termux-battery-status | Returns battery level, temperature, health, and charging status as JSON |
termux-camera-photo | Takes a photo using a device camera and saves it to a file |
termux-clipboard-get | Prints the current clipboard contents to stdout |
termux-clipboard-set | Sets the clipboard to the provided text |
termux-contact-list | Lists all contacts on the device as JSON |
termux-dialog | Shows a dialog UI and returns the user’s input |
termux-location | Returns current GPS or network location as JSON |
termux-notification | Posts an Android notification |
termux-sensor | Reads data from device sensors (accelerometer, gyroscope, etc.) |
termux-sms-send | Sends an SMS message to a phone number |
termux-tts-speak | Speaks text aloud using Android’s text-to-speech engine |
termux-vibrate | Vibrates the device |
termux-wifi-connectioninfo | Returns current Wi-Fi connection details as JSON |
Usage examples
Check battery status:jq:
Permissions reference
Each command requires specific Android permissions. They are requested at runtime when you first use a command:- Location —
termux-location - Camera —
termux-camera-photo - Read contacts —
termux-contact-list - Send SMS —
termux-sms-send - Notifications —
termux-notification(on Android 13+)
All
termux-* commands output JSON by default. Pipe the output to jq for formatted or filtered results: pkg install jq.