UniFi API Integration¶
Module: app/api/unifi.py
KeyShift uses the UniFi Network Integration API (v1) to read and update Wi-Fi broadcast configurations. Authentication is via an API key passed in the X-API-KEY header.
SSL
SSL verification is disabled (verify=False) to support controllers with self-signed certificates. Consider providing a CA bundle in production.
Class: UNIFI¶
UNIFI.getSiteIDs() → list[str]¶
Fetches all site IDs from the controller.
Endpoint: GET /proxy/network/integration/v1/sites
UNIFI.getWifiID(siteList) → list[str]¶
Fetches all Wi-Fi broadcast IDs across the provided sites.
Endpoint: GET /proxy/network/integration/v1/sites/{siteID}/wifi/broadcasts
UNIFI.getSSIDInfo(siteIDs, wlans) → list[SSID]¶
Fetches full SSID details (name, password, enabled status) for every combination of site and broadcast ID.
Endpoint: GET /proxy/network/integration/v1/sites/{siteID}/wifi/broadcasts/{wlanID}
UNIFI.initDBinfo() → bool¶
Orchestrates a full SSID import:
getSiteIDs()getWifiID(siteIDs)getSSIDInfo(siteIDs, wlans)- Persists each new SSID to the database (skips duplicates by
ssidID)
UNIFI.changePW(ssid, newPw) → bool | str¶
Changes the password of a single SSID on the controller.
- Fetches the current broadcast config via
GET - Strips
idandmetadatafields - Updates
securityConfiguration.passphrase - Sends updated config via
PUT
Returns True on success, an error string on failure.