A Python-based tool to interact with the UniFi Network Application API.
This project uses the UniFi Network API to gather information about your UniFi
network. It's built using Python and managed with uv
package manager.
The UniFi Network API provides comprehensive network management capabilities:
Category | Capabilities | Example Endpoints |
---|---|---|
Device Management | • List all devices • Get device details • Manage settings • Perform operations (restart, provision) | GET /proxy/network/integration/v1/sites/{site}/devices • GET /proxy/network/integration/v1/sites/{site}/devices/{id} • POST /proxy/network/integration/v1/sites/{site}/devices/{id}/actions |
Network Configuration | • View/manage networks • Configure VLANs • Manage port forwarding • Handle firewall rules | GET /proxy/network/integration/v1/sites/{site}/settings • GET /proxy/network/integration/v1/sites/{site}/vlans • POST /proxy/network/integration/v1/sites/{site}/settings |
Client Management | • List connected clients • View client statistics • Block/unblock clients • Manage client groups | GET /proxy/network/integration/v1/sites/{site}/clients • GET /proxy/network/integration/v1/sites/{site}/client/{mac} • POST /proxy/network/integration/v1/sites/{site}/client/{mac}/block |
Statistics & Monitoring | • System statistics • Network health • Bandwidth usage • Event logs | GET /proxy/network/integration/v1/sites/{site}/health • GET /proxy/network/integration/v1/sites/{site}/stats • GET /proxy/network/integration/v1/sites/{site}/devices/{id}/statistics/latest |
The UniFi Network API uses API key authentication. You'll need to:
- Generate an API key in your UniFi Network Application
- Include it in the
X-API-KEY
header with each request - Use HTTPS for all API calls
Example API call:
curl -k -X GET 'https://192.168.1.1/proxy/network/integration/v1/sites' \
-H 'X-API-KEY: YOUR_API_KEY' \
-H 'Accept: application/json'
Once this package is published to PyPI, you can install it using:
uv tool install unifi-assist
- Clone the repository
- Install dependencies:
uv sync
This will:
- Create a virtual environment if it doesn't exist
- Install all development and runtime dependencies
- Generate/update the lockfile
This project follows Conventional Commits specification. Each commit message should be structured as follows:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types:
feat
: A new feature (minor version bump)fix
: A bug fix (patch version bump)docs
: Documentation only changesstyle
: Changes that don't affect code meaningrefactor
: Code change that neither fixes a bug nor adds a featureperf
: Code change that improves performancetest
: Adding missing tests or correcting existing testschore
: Changes to build process or auxiliary tools
Examples:
feat(api): add device status endpoint
fix: correct token refresh logic
docs: update API authentication guide
test(client): add test for error handling
Breaking Changes:
For commits that break backward compatibility, add BREAKING CHANGE:
in the footer or append a !
after the type:
feat!: remove deprecated login method
BREAKING CHANGE: The `login` method has been removed. Use `authenticate` instead.
Never commit API keys to version control. We recommend using environment variables or a secure configuration file for storing sensitive credentials.
This project is currently in initial development. Documentation will be updated as features are implemented.