Required MAC address(es) of device(s) to cancel migration for
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if migration cancellation was successful
When MAC address validation fails
When migration cancellation fails
// Cancel migration for single device
await client.cancel_migrate_device('aa:bb:cc:dd:ee:ff');
// Cancel migration for multiple devices
await client.cancel_migrate_device([
'aa:bb:cc:dd:ee:ff',
'ff:ee:dd:cc:bb:aa'
]);
PHP: cancel_migrate_device($macs) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);
Cancel rolling upgrade
Cancels an ongoing rolling upgrade process for UniFi devices. This stops the automatic firmware upgrade sequence across devices.
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if rolling upgrade cancellation was successful
When rolling upgrade cancellation fails
// Cancel ongoing rolling upgrade
await client.cancel_rolling_upgrade();
// With cancellation support
const controller = new AbortController();
await client.cancel_rolling_upgrade({ signal: controller.signal });
PHP: cancel_rolling_upgrade() -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);
Check for firmware updates
Initiates a check for available firmware updates for all UniFi devices in the site. This triggers the controller to query for new firmware versions.
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if firmware update check was initiated successfully
When firmware update check fails
// Check for firmware updates
await client.check_firmware_update();
// Then list devices to see available updates
const devices = await client.list_devices();
const devicesWithUpdates = devices.filter(device => device.upgradable);
PHP: check_firmware_update() -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);
List UniFi devices (Access Points, Switches, Gateways, etc.)
Optional macs: string | string[]Optional MAC address(es) to filter devices. Can be a single MAC string or array of MACs
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal for request cancellation
Promise resolving to an array of UniFi device objects
Retrieves information about UniFi devices in the network. Can optionally filter by specific MAC addresses. When no MAC addresses are provided, returns all devices.
// Get all devices
const allDevices = await client.list_devices();
// Get specific device by MAC
const device = await client.list_devices('aa:bb:cc:dd:ee:ff');
// Get multiple devices by MAC
const devices = await client.list_devices(['aa:bb:cc:dd:ee:ff', 'ff:ee:dd:cc:bb:aa']);
// Filter access points only
const allDevices = await client.list_devices();
const accessPoints = allDevices.filter(device => device.type === 'uap');
1.0.0
PHP: list_devices($macs = []) -> return $this->fetch_results('/api/s/' . $this->site . '/stat/device', $payload);
Adopt one or more UniFi devices to the current site
Required MAC address(es) of device(s) to adopt. Can be a single MAC string or array of MACs
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal for request cancellation
Promise resolving to true if adoption was successful
Adopts UniFi devices (Access Points, Switches, Gateways) to the current site. Devices must be in an adoptable state (showing as pending adoption in the controller).
When MAC address format is invalid
When device is not in adoptable state or already adopted
// Adopt single device
await client.adopt_device('aa:bb:cc:dd:ee:ff');
// Adopt multiple devices
await client.adopt_device(['aa:bb:cc:dd:ee:ff', 'ff:ee:dd:cc:bb:aa']);
// With error handling
try {
await client.adopt_device('aa:bb:cc:dd:ee:ff');
console.log('Device adopted successfully');
} catch (error) {
console.error('Adoption failed:', error.message);
}
1.0.0
PHP: adopt_device($macs) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);
Adopt a device using custom SSH credentials
Required MAC address of the device to adopt
Required IP address of the device
Required SSH username for device access
Required SSH password for device access
Required Controller URL for device adoption
Optional SSH port (default: 22)
Optional SSH key verification (default: true)
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal for request cancellation
Promise resolving to true if advanced adoption was successful
Adopts a UniFi device using custom SSH credentials for advanced scenarios where the device requires specific authentication parameters.
When required parameters are missing or invalid
When advanced adoption fails
// Advanced adoption with custom credentials
await client.advanced_adopt_device(
'aa:bb:cc:dd:ee:ff',
'192.168.1.100',
'ubnt',
'ubnt',
'https://controller.example.com:8443',
22,
true
);
adopt_device for standard device adoption
1.0.0
PHP: advanced_adopt_device($mac, $ip, $username, $password, $url, $port = 22, $ssh_key_verify = true)
Protected substituteProtected makeDelete device
Permanently removes a device from the UniFi Controller. This operation cannot be undone and the device will need to be re-adopted.
Required MAC address of the device to delete
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if device deletion was successful
When MAC address validation fails
When device deletion fails
// Delete a device by MAC address
await client.delete_device('aa:bb:cc:dd:ee:ff');
This operation is irreversible
PHP: delete_device($mac)
Disable access point
Disables or enables an Access Point device. When disabled, the AP will stop broadcasting wireless networks.
Required Access Point device ID
Required Whether to disable (true) or enable (false) the AP
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if AP disable/enable was successful
When ap_id validation fails
When AP disable/enable fails
// Disable an Access Point
await client.disable_ap('507f1f77bcf86cd799439011', true);
// Enable an Access Point
await client.disable_ap('507f1f77bcf86cd799439011', false);
PHP: disable_ap($ap_id, $disable) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/device/' . trim($ap_id), $payload);
Force provision device
Forces provisioning of one or more UniFi devices. This triggers the device to re-download its configuration from the controller.
Required MAC address(es) of device(s) to force provision
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if force provision was successful
When MAC address validation fails
When force provision fails
// Force provision single device
await client.force_provision('aa:bb:cc:dd:ee:ff');
// Force provision multiple devices
await client.force_provision([
'aa:bb:cc:dd:ee:ff',
'ff:ee:dd:cc:bb:aa'
]);
PHP: force_provision($mac) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr/', $payload);
List access point groups
Retrieves all Access Point groups configured in the site. AP groups allow organizing and managing multiple APs together.
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to an array of AP group objects
When AP group listing fails
// List all AP groups
const apGroups = await client.list_apgroups();
console.log(`Found ${apGroups.length} AP groups`);
// Find specific AP group
const mainGroup = apGroups.find(group => group.name === 'Main Building');
PHP: list_apgroups() -> return $this->fetch_results('/v2/api/site/' . $this->site . '/apgroups');
List access points
Retrieves information about Access Point devices. Can optionally filter by specific MAC address.
Optional mac: stringOptional MAC address to filter by specific AP
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to an array of Access Point objects
When AP listing fails
// List all Access Points
const aps = await client.list_aps();
// Get specific AP by MAC
const ap = await client.list_aps('aa:bb:cc:dd:ee:ff');
PHP: list_aps($mac = '') -> return $this->fetch_results('/api/s/' . $this->site . '/stat/device', $payload);
List device name mappings
Retrieves device name mappings from the controller. This shows custom names assigned to devices.
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to device name mapping data
When device name mapping retrieval fails
// Get device name mappings
const mappings = await client.list_device_name_mappings();
PHP: list_device_name_mappings() -> return $this->fetch_results('/api/s/' . $this->site . '/stat/device-name-mapping');
List device states
Retrieves current state information for all devices. This includes connection status and operational state.
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to device state data
When device state retrieval fails
// Get device states
const states = await client.list_device_states();
PHP: list_device_states() -> return $this->fetch_results('/api/s/' . $this->site . '/stat/device-state');
List devices (basic information)
Retrieves basic device information with reduced data payload. Faster than full device listing for simple operations.
Optional device_mac: stringOptional MAC address to filter by specific device
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to basic device information
When basic device listing fails
// Get basic info for all devices
const devices = await client.list_devices_basic();
// Get basic info for specific device
const device = await client.list_devices_basic('aa:bb:cc:dd:ee:ff');
list_devices for complete device information
PHP: list_devices_basic($device_mac = '') -> return $this->fetch_results('/api/s/' . $this->site . '/stat/device-basic', $payload);
List available firmware versions
Retrieves available firmware versions for devices. Can optionally filter by device type.
Optional device_type: stringOptional device type to filter firmware for
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to firmware version data
When firmware listing fails
// List all available firmware
const firmware = await client.list_firmware();
// List firmware for specific device type
const apFirmware = await client.list_firmware('uap');
PHP: list_firmware($device_type = '') -> return $this->fetch_results('/api/s/' . $this->site . '/stat/firmware', $payload);
List device models
Retrieves information about supported device models. This includes model names, capabilities, and specifications.
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to device model data
When device model listing fails
// Get supported device models
const models = await client.list_models();
list_devices to see actual devices
PHP: list_models() -> return $this->fetch_results('/api/s/' . $this->site . '/stat/device-model');
Locate access point (LED blink)
Enables or disables the locate LED feature on an Access Point. When enabled, the AP's LED will blink to help physically locate the device.
Required MAC address of the Access Point
Required Whether to enable (true) or disable (false) locate mode
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if locate operation was successful
When MAC address validation fails
When locate operation fails
// Enable locate mode (LED blinks)
await client.locate_ap('aa:bb:cc:dd:ee:ff', true);
// Disable locate mode
await client.locate_ap('aa:bb:cc:dd:ee:ff', false);
PHP: locate_ap($mac, $enable) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);
Migrate device to another controller
Migrates one or more UniFi devices to a different controller. The devices will be removed from the current controller and adopted by the target.
Required MAC address(es) of device(s) to migrate
Required Inform URL of the target controller
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if migration was initiated successfully
When MAC address or inform_url validation fails
When device migration fails
// Migrate single device
await client.migrate_device(
'aa:bb:cc:dd:ee:ff',
'http://new-controller.example.com:8080/inform'
);
// Migrate multiple devices
await client.migrate_device(
['aa:bb:cc:dd:ee:ff', 'ff:ee:dd:cc:bb:aa'],
'http://new-controller.example.com:8080/inform'
);
PHP: migrate_device($macs, $inform_url) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);
Power cycle switch port
Power cycles a specific port on a UniFi switch. This turns the port off and then back on to reset connected devices.
Required MAC address of the switch
Required Port index to power cycle (1-based)
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if power cycle was successful
When MAC address or port_idx validation fails
When power cycle fails
// Power cycle port 8 on a switch
await client.power_cycle_switch_port('aa:bb:cc:dd:ee:ff', 8);
PHP: power_cycle_switch_port($mac, $port_idx) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);
Reboot Cloud Key
Reboots the UniFi Cloud Key device. This will temporarily interrupt controller services.
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if reboot was initiated successfully
When Cloud Key reboot fails
// Reboot the Cloud Key
await client.reboot_cloudkey();
This will temporarily interrupt controller services
restart_device to restart other devices
PHP: reboot_cloudkey() -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/system', $payload);
Rename access point
Changes the name of an Access Point device. The new name will be displayed in the controller interface.
Required Access Point device ID
Required New name for the Access Point
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if rename was successful
When ap_id or ap_name validation fails
When AP rename fails
// Rename an Access Point
await client.rename_ap('507f1f77bcf86cd799439011', 'Main Office AP');
PHP: rename_ap($ap_id, $ap_name) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/upd/device/' . trim($ap_id), $payload);
Restart device
Restarts one or more UniFi devices. Can perform either soft restart (graceful) or hard restart (forced).
Required MAC address(es) of device(s) to restart
Optional restart type: 'soft' (default) or 'hard'
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if restart was initiated successfully
When MAC address validation fails
When device restart fails
// Soft restart single device
await client.restart_device('aa:bb:cc:dd:ee:ff');
// Hard restart multiple devices
await client.restart_device(
['aa:bb:cc:dd:ee:ff', 'ff:ee:dd:cc:bb:aa'],
'hard'
);
PHP: restart_device($macs, $reboot_type = 'soft') -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);
Set access point WLAN group
Assigns an Access Point to a specific WLAN group for radio configuration. This controls which wireless networks are broadcast on which radios.
Required Radio type: 'ng' (2.4GHz) or 'na' (5GHz)
Required Access Point device ID
Required WLAN group ID to assign
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if WLAN group assignment was successful
When parameter validation fails
When WLAN group assignment fails
// Assign 2.4GHz radio to a WLAN group
await client.set_ap_wlangroup(
'ng',
'507f1f77bcf86cd799439011',
'wlan-group-id'
);
// Assign 5GHz radio to a different WLAN group
await client.set_ap_wlangroup(
'na',
'507f1f77bcf86cd799439011',
'another-wlan-group-id'
);
PHP: set_ap_wlangroup($type_id, $device_id, $group_id) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/upd/device/' . trim($device_id), $payload);
Set device settings (base method)
Updates device settings using a custom payload. This is a low-level method for advanced device configuration.
Required Device ID to update
Required Configuration payload object
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if device settings were updated successfully
When device_id or payload validation fails
When device settings update fails
// Update device settings with custom payload
await client.set_device_settings_base(
'507f1f77bcf86cd799439011',
{
name: 'New Device Name',
led_override: 'off'
}
);
PHP: set_device_settings_base($device_id, $payload) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/device/' . trim($device_id), $payload);
Set element adoption
Enables or disables automatic device adoption for the site. When enabled, new devices will be automatically adopted.
Required Whether to enable (true) or disable (false) element adoption
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if element adoption setting was updated successfully
When element adoption setting update fails
// Enable automatic device adoption
await client.set_element_adoption(true);
// Disable automatic device adoption
await client.set_element_adoption(false);
adopt_device for manual device adoption
PHP: set_element_adoption($enable) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/set/setting/element_adopt', $payload);
Start rolling upgrade
Initiates a rolling firmware upgrade for specified device types. Devices will be upgraded automatically in sequence to minimize downtime.
Optional array of device types to upgrade (default: ['uap', 'usw', 'ugw', 'uxg'])
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if rolling upgrade was started successfully
When rolling upgrade start fails
// Start rolling upgrade for all device types
await client.start_rolling_upgrade();
// Start rolling upgrade for specific device types
await client.start_rolling_upgrade(['uap', 'usw']);
PHP: start_rolling_upgrade($payload = ['uap', 'usw', 'ugw', 'uxg']) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr/set-rollupgrade', $payload);
Upgrade all devices
Initiates firmware upgrade for all devices of a specified type. This upgrades all devices simultaneously rather than in sequence.
Optional device type to upgrade (default: 'uap')
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if upgrade was initiated successfully
When device upgrade fails
// Upgrade all Access Points
await client.upgrade_all_devices('uap');
// Upgrade all switches
await client.upgrade_all_devices('usw');
PHP: upgrade_all_devices($type = 'uap') -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr/upgrade-all', $payload);
Upgrade device
Initiates firmware upgrade for a specific device. The device will download and install the latest available firmware.
Required MAC address of the device to upgrade
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if upgrade was initiated successfully
When MAC address validation fails
When device upgrade fails
// Upgrade specific device
await client.upgrade_device('aa:bb:cc:dd:ee:ff');
PHP: upgrade_device($mac) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr/upgrade', $payload);
Upgrade device with external firmware
Upgrades one or more devices using firmware from an external URL. This allows using custom or beta firmware versions.
Required URL to the firmware file
Required MAC address(es) of device(s) to upgrade
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if external upgrade was initiated successfully
When firmware_url or MAC address validation fails
When external upgrade fails
// Upgrade single device with external firmware
await client.upgrade_device_external(
'https://firmware.example.com/device-firmware.bin',
'aa:bb:cc:dd:ee:ff'
);
// Upgrade multiple devices with external firmware
await client.upgrade_device_external(
'https://firmware.example.com/device-firmware.bin',
['aa:bb:cc:dd:ee:ff', 'ff:ee:dd:cc:bb:aa']
);
Use only trusted firmware sources
PHP: upgrade_device_external($firmware_url, $macs) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr/upgrade-external', $payload);
Create access point group
Creates a new Access Point group for organizing and managing multiple APs together. AP groups allow applying common settings and configurations to multiple devices.
Required Name for the new AP group
Optional array of device MAC addresses to include in the group
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if AP group creation was successful
When group_name validation fails
When AP group creation fails
// Create empty AP group
await client.create_apgroup('Main Building APs');
// Create AP group with devices
await client.create_apgroup('Office APs', [
'aa:bb:cc:dd:ee:ff',
'ff:ee:dd:cc:bb:aa'
]);
PHP: create_apgroup($group_name, $device_macs = []) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/apgroup', $payload);
Delete access point group
Permanently removes an Access Point group from the controller. Devices in the group will be moved to the default group.
Required ID of the AP group to delete
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to true if AP group deletion was successful
When group_id validation fails
When AP group deletion fails
// Delete an AP group
await client.delete_apgroup('507f1f77bcf86cd799439011');
This operation cannot be undone
PHP: delete_apgroup($group_id) -> return $this->fetch_results_boolean('/v2/api/site/' . $this->site . '/apgroups/' . trim($group_id));
Edit access point group
Updates an existing Access Point group with new name and device assignments. This allows modifying group membership and properties.
Required ID of the AP group to edit
Required New name for the AP group
Required Array of device MAC addresses to include in the group
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to the updated AP group data
When parameter validation fails
When AP group edit fails
// Update AP group name and devices
await client.edit_apgroup(
'507f1f77bcf86cd799439011',
'Updated Office APs',
['aa:bb:cc:dd:ee:ff', 'ff:ee:dd:cc:bb:aa']
);
PHP: edit_apgroup($group_id, $group_name, $device_macs) -> return $this->fetch_results('/v2/api/site/' . $this->site . '/apgroups/' . trim($group_id), $payload);
Cancel device migration
Cancels an ongoing device migration process for one or more UniFi devices. This stops the migration and returns devices to their previous state.