unifictl
A powerful CLI tool for UniFi networks with AI-first design
Features • Installation • Quick Start • AI Guide • Examples
Overview
unifictl is a comprehensive command-line interface for managing UniFi networks through both the UniFi Site Manager API (cloud) and local UniFi controllers. Built with Rust for performance and reliability, it provides human-friendly commands while offering AI-optimized output for automated network management.
What makes unifictl special?
- 🤖 AI-First Design: LLM-optimized output with token estimation, smart truncation, and JSON schemas
- 🔄 Correlation Commands: Aggregate related network data in single API calls
- 🏥 Diagnostic Mode: Multi-endpoint health checks with actionable recommendations
- 📊 Time-Series Export: Historical data for trend analysis and pattern detection
- 🎯 kubectl-like UX: Intuitive command structure with consistent patterns
- ⚡ Performance: Native binary with minimal overhead, fast execution
- 🛡️ Safety Features: Dry-run mode, interactive confirmations, context-aware errors
Features
🤖 AI-Powered Network Management
LLM-Optimized Output (-o llm)
- Token counting (~4 chars/token)
- Intelligent truncation (>4000 tokens)
- JSON schema metadata
- Field importance levels
- Statistical summaries
Correlation Commands
- Aggregate client + AP + events
- Device + connected clients
- Reduce API calls by 80%
- Single-command troubleshooting
- Cross-reference network data
Diagnostic Mode
- Network health checks
- WiFi performance analysis
- Client troubleshooting
- Pass/fail with recommendations
- Multi-endpoint validation
Time-Series Export
- Traffic statistics (CSV/JSON)
- WiFi metrics over time
- Event log export
- Trend analysis ready
- Bandwidth planning data
🛠️ Core Features
Output Formats & Filtering
- Pretty (default): Human-readable tables with auto-column selection
- JSON: Structured output for scripting and automation
- CSV: Spreadsheet-ready exports for reporting
- Raw: Exact API responses
- LLM: AI-optimized with metadata and schemas
Advanced filtering with --filter, --filter-regex, --sort-by, --columns, and --full-ids
Network Operations
Cloud (Site Manager API)
- Host and site management
- Device inventory across sites
- ISP metrics and analytics (EA)
- SD-WAN configuration (EA)
Local Controller
- Device management (adopt, restart, upgrade)
- Client operations (block, reconnect, metadata)
- Network configuration (VLANs, WLANs, firewall)
- WiFi analytics (connectivity, stats, radio AI)
- Traffic analysis (flows, DPI, routes)
- Event monitoring and logging
- Health and security status
Safety & Reliability
- 🔒 Dry-run mode: Preview deletions without executing
- ✋ Interactive confirmations: Prompts before destructive operations
- 📝 Context-aware errors: Detailed troubleshooting guidance
- 🔄 Watch mode: Live refresh with timestamps
- 🎯 Smart defaults: Sensible configuration precedence
Installation
cargo (recommended)
From Source
Package Managers
Debian/Ubuntu
Arch Linux
Updating to a New Version
cargo
From source
Debian/Ubuntu
Quick Start
1. Login (cloud + local in one step)
# Cloud API key only
# Local controller only (password prompted securely)
# Both at once
3. Basic Commands
# List devices
# Get client details with AI optimization
# Troubleshoot a client
# Run network diagnostics
# Export traffic data
Common Use Cases
🔍 Troubleshoot Client Connectivity
# Get everything about a client in one command
# Returns: client info + connected AP + recent events + AI summary
📊 Network Health Check
# Quick health assessment
# WiFi performance check
# VPN health with packet loss reasons
📈 Bandwidth Analysis
# Export last 24 hours of traffic
START=
END=
🔧 Device Management
# List unadopted devices
# Adopt all pending devices
# Restart a device
🎨 Custom Output
# Live monitoring
# Filtered export
# Regex filtering
AI Agent Integration
For AI-powered network management, see the comprehensive AI Agent Guide.
Quick Example:
# Get LLM-optimized device data
=
=
Command Reference
Cloud API (Site Manager)
# Hosts
# Sites and devices
# ISP metrics and SD-WAN (EA)
Local Controller
# Correlation
# Diagnostics
# Time-Series
||
|||
|||
|||
|||
|||
|||
|||
|||
Testing
# Run unit tests
# Run full endpoint test suite
# Test specific functionality
Current test coverage: 75 endpoints, 100% passing
Configuration
Precedence order: CLI flag → Local config (.unifictl.yaml) → User config (~/.config/unifictl/config.yaml)
# Cloud API key + local controller in one command
Omitting --password causes an interactive prompt with hidden input — this is the recommended approach to avoid exposing credentials in shell history.
Note: TLS verification is disabled by default for self-signed certificates. Use --verify-tls if your controller has a valid certificate.
Troubleshooting
UDM Rate Limiting
UniFi Dream Machines may hit login rate limits with CLI tools that create new sessions per command.
Symptoms: 403 invalid username/password, 429 AUTHENTICATION_FAILED_LIMIT_REACHED, or repeated local login failures
SSH recovery process (current UniFi OS):
# SSH directly to the console as root
# Inspect UniFi-related services
|
# Confirm the login limiter config exists
# Restart the auth service that owns the limiter on current UDM builds
# If needed, also restart the main UniFi services
Notes:
# On newer firmware, `unifi-os` may not exist as a systemd service.
# If you change the limiter, the config file is:
# Example setting
In testing on a current UDM Pro, restarting ulp-go cleared AUTHENTICATION_FAILED_LIMIT_REACHED while systemctl restart unifi and systemctl restart unifi-core unifi-directory uos-agent alone did not.
Common Issues
Port 8443 connectivity: The tool automatically preserves port :8443 for local controllers
Certificate errors: Use the default (no --verify-tls) for self-signed certs
Site parameter: Commands default to configured site; override with --site <NAME>
Development
See AGENTS.md for development guidelines, testing requirements, and contribution workflow.
Quick development setup:
Documentation
- README.md - This file (overview and reference)
- AI_AGENT_GUIDE.md - Comprehensive AI agent integration guide
- EXAMPLES.md - Real-world usage examples
- AGENTS.md - Development and contribution guide
License
GPL-3.0 - see LICENSE file for details
Credits
Built by Mathias Uhl