unifi-cli
CLI for UniFi Network controller with an interactive TUI dashboard. Designed for both human operators and AI agents.
Quick start
# Install (pick one)
# Configure
# Use
Generate an API key in your UniFi controller under Settings > API.
Installation
From crates.io
From PyPI
# or run without installing:
From GitHub releases
Pre-built binaries for Linux (x64, arm64), macOS (x64, arm64), and Windows (x64) on the releases page.
Configuration
Run unifi config init for interactive setup, or configure manually:
Environment variables
Config file
~/.config/unifi/config.toml:
= "https://unifi.example.com"
= "YOUR_KEY"
Multi-controller profiles
[]
= "https://home.example.com"
= "KEY_1"
[]
= "https://office.example.com"
= "KEY_2"
# or: UNIFI_PROFILE=office unifi clients list
CLI flags
Priority: CLI flags > environment variables > config file.
TUI dashboard
Real-time dashboard with:
- Client list with bandwidth, connection info, and signal strength
- Device overview with status and firmware versions
- Event feed from the controller
- Client actions: kick, block/unblock, lock/unlock AP
- Device actions: restart, upgrade firmware, locate LED
- Filter clients by name with
/
Live port monitor
Commands
Clients
Devices
Events
Networks
System
Configuration
Shell completions
Agent-friendly design
unifi-cli is designed to work well with AI agents and automation scripts.
Automatic JSON output
When stdout is not a terminal (piped or redirected), output switches to JSON automatically:
# Human at terminal: formatted table
# Agent piping output: JSON automatically
data=
# Force JSON mode
Clean stdout/stderr separation
Data goes to stdout. Messages go to stderr. Piping always captures clean data:
Structured mutation responses
# {"action": "block", "mac": "AA:BB:CC:DD:EE:FF", "status": "ok"}
Runtime schema introspection
Distinct exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Authentication error (401/403) |
| 4 | Not found (404) |
| 5 | API error (server error) |
Development
License
MIT