Skip to content

Ubiquiti UniFi

The UniFi adapter manages Ubiquiti UniFi controller-managed switches, access points, and security gateways via the UniFi Network Application API.

FactDetail
MaturityBeta
Test coverage136 passing tests
Gold-standard contractDG ✓ CB ✓ RR ✓ TS ✓ SSRF ✓ RG ✓
Frontend UINone yet

The adapter auto-detects the console type at init:

  • UniFi Network Application (Classic) - e.g., self-hosted on :8443; uses /api/login auth endpoint.
  • UniFi OS consoles - UDM, UDM-Pro, Cloud Key Gen2+; uses /api/auth/login with /proxy/network/api/ prefix for network API calls.

No configuration flag is required; the adapter probes the controller at startup and selects the correct auth flow.

Read paths (19 methods - all redact secrets on return)

Section titled “Read paths (19 methods - all redact secrets on return)”
MethodDescription
list_sitesAll sites on the controller
get_site_healthSite-level health summary
list_devicesSwitches, APs, gateways
get_deviceSingle device detail
list_port_overridesPort profile assignments
list_clientsConnected clients
get_clientSingle client detail
list_networksVLANs, subnets, DHCP scopes
get_networkSingle network detail
list_wlansWireless networks (PSK stripped on read)
get_wlanSingle WLAN (PSK stripped on read)
list_firewall_rulesFirewall rules
list_firewall_groupsFirewall groups
list_port_forwardsPort forwarding rules
list_radius_usersRADIUS users
list_vpn_clientsVPN clients
get_controller_infoController version and metadata
get_sysinfoSystem resource usage
list_alertsActive alerts

Write paths (9 methods - all dual-gated + audit-logged)

Section titled “Write paths (9 methods - all dual-gated + audit-logged)”

Every write requires ADAPTER_READ_ONLY=false in the environment and force: true on the apply request body. Every endpoint enforces a minimum site_admin role. Every successful write emits a structured unifi.write_attempted audit log line (PSK is never logged).

MethodDescription
restart_device(site, mac)Reboot an AP or switch
update_port_override(site, device_mac, port_idx, profile_id)Assign VLAN / PoE profile to a port
set_port_poe(site, device_mac, port_idx, mode)Set PoE mode: auto / off / passive24 / passthrough
update_wlan_password(site, wlan_id, new_psk)Rotate a WLAN PSK
enable_wlan(site, wlan_id, enabled)Toggle WLAN broadcast on/off
block_client(site, client_mac)Block a client
unblock_client(site, client_mac)Unblock a client
forget_client(site, client_mac)Remove a client from controller memory
disable_device(site, device_mac, disabled)Admin-disable a device without removing it
  • No frontend UI pages.
  • Captive-portal / hotspot config writes.
  • Topology API is not available in this release.
  • SDN backup / restore endpoints.
  • Layer 2/3 device adoption flows (manual SSH adoption only).
  • Network CRUD writes - VLANs and DHCP scopes are read-only for now.
/api/v1/unifi/{controller_id}/sites/
/api/v1/unifi/{controller_id}/sites/{site}/devices/
/api/v1/unifi/{controller_id}/sites/{site}/clients/
/api/v1/unifi/{controller_id}/sites/{site}/networks/
/api/v1/unifi/{controller_id}/sites/{site}/wlans/
/api/v1/unifi/{controller_id}/sites/{site}/firewall/
/api/v1/unifi/{controller_id}/system/info
/api/v1/unifi/{controller_id}/system/sites/{site}/sysinfo
/api/v1/unifi/{controller_id}/system/sites/{site}/alerts

See /api/v1/docs for the full OpenAPI schema.

FieldValue
credential_typeusername_password
usernameUniFi controller local administrator username
passwordAdministrator password

For Classic (self-hosted on port 8443):

https://unifi.example.com:8443

For UDM / UDM-Pro / Cloud Key Gen2+:

https://192.168.1.1

The adapter appends the correct API prefix automatically after detecting the console type.

Terminal window
# Create the controller record (credentials are stored inline - no separate /credentials step)
curl -X POST https://<freesdn-host>/api/v1/controllers \
-H "Cookie: freesdn_access=<token>" \
-H "X-CSRF-Token: <csrf>" \
-H "Content-Type: application/json" \
-d '{
"name": "unifi-prod",
"controller_type": "unifi",
"host": "https://unifi.example.com:8443",
"port": 8443,
"site_id": "<site-uuid>",
"username": "admin",
"password": "<controller-password>"
}'
# Verify discovery
curl https://<freesdn-host>/api/v1/unifi/<controller-id>/sites \
-H "Cookie: freesdn_access=<token>"
curl https://<freesdn-host>/api/v1/unifi/<controller-id>/sites/default/devices \
-H "Cookie: freesdn_access=<token>"

See the Adapter Overview for the dual-gate explanation. For UniFi specifically:

  1. Set ADAPTER_READ_ONLY=false in your environment file.
  2. Restart the API: docker compose --env-file .env.pro up -d api.
  3. Issue the write directly to the REST endpoint with force: true in the request body (e.g., POST /api/v1/unifi/{cid}/sites/{site}/devices/{mac}/restart with body {"force": true}). The adapter executes the action immediately on the live controller. There is no separate apply step for these endpoints - the force flag in the body IS the explicit operator confirmation.

All product names, logos, and brands are property of their respective owners. FreeSDN is an independent project and is not affiliated with or endorsed by the vendors it integrates with. See Trademarks.