Constructors

Device Management

  • Move device

    Moves a UniFi device from the current site to another site. This is useful for reorganizing devices across different site configurations.

    Parameters

    • mac: string

      Required MAC address of the device to move

    • site_id: string

      Required Target site ID to move the device to

    • site: string = 'default'

      Current site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if device move was successful

    Throws

    When MAC address or site_id is invalid

    Throws

    When device move fails

    Example

    // Move device to different site
    await networkAPI.move_device('aa:bb:cc:dd:ee:ff', 'branch-office');

    // Move multiple devices (call multiple times)
    const devicesToMove = ['aa:bb:cc:dd:ee:ff', 'ff:ee:dd:cc:bb:aa'];
    for (const mac of devicesToMove) {
    await networkAPI.move_device(mac, 'new-site');
    }

    Warning

    Moving a device will cause it to be reconfigured for the target site

    See

    • list_devices to get device information
    • list_sites to get available site IDs

    PHP: move_device($mac, $site_id) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/sitemgr', $payload);

Methods - Other

Methods - WLAN Management

  • Create a new WLAN (Wireless Network) configuration

    Parameters

    • name: string

      Required Name of the WLAN (SSID)

    • x_passphrase: string

      Required Network password/passphrase (ignored for open networks)

    • usergroup_id: string

      Required ID of the user group to assign clients to

    • wlangroup_id: string

      Required ID of the WLAN group for AP assignment

    • enabled: boolean = true

      Optional whether the WLAN is enabled (default: true)

    • hide_ssid: boolean = false

      Optional whether to hide the SSID (default: false)

    • is_guest: boolean = false

      Optional whether this is a guest network (default: false)

    • security: string = 'open'

      Optional security type: 'open', 'wpapsk', 'wpaeap' (default: 'open')

    • wpa_mode: string = 'wpa2'

      Optional WPA mode: 'wpa', 'wpa2', 'wpa3' (default: 'wpa2')

    • wpa_enc: string = 'ccmp'

      Optional WPA encryption: 'auto', 'ccmp', 'tkip' (default: 'ccmp')

    • Optional vlan_enabled: boolean

      Optional whether VLAN is enabled

    • Optional vlan_id: string

      Optional VLAN network ID

    • uapsd_enabled: boolean = false

      Optional whether U-APSD is enabled (default: false)

    • schedule_enabled: boolean = false

      Optional whether scheduling is enabled (default: false)

    • schedule: any[] = []

      Optional schedule configuration array (default: [])

    • Optional ap_group_ids: string[]

      Optional array of AP group IDs to restrict WLAN to

    • additional_payload: any = {}

      Optional additional configuration parameters

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal for request cancellation

    Returns Promise<boolean>

    Promise resolving to true if WLAN creation was successful

    Description

    Creates a new wireless network with specified security settings, user groups, and advanced configuration options. The WLAN will be available on all Access Points unless restricted to specific AP groups.

    Throws

    When required parameters are missing or invalid

    Throws

    When WLAN creation fails or name already exists

    Example

    // Basic open network
    await networkAPI.create_wlan('Public WiFi', '', 'default', 'default');

    // Secure WPA2 network
    await networkAPI.create_wlan(
    'Corporate WiFi',
    'strongpassword123',
    'corporate_group',
    'default',
    true, // enabled
    false, // visible SSID
    false, // not guest
    'wpapsk',
    'wpa2',
    'ccmp'
    );

    // Guest network with VLAN
    await networkAPI.create_wlan(
    'Guest Network',
    'guestpass',
    'guest_group',
    'guest_wlan_group',
    true, // enabled
    false, // visible
    true, // is guest
    'wpapsk',
    'wpa2',
    'ccmp',
    true, // VLAN enabled
    'guest_vlan_id'
    );

    See

    Since

    1.0.0

    Remarks

    PHP: create_wlan($name, $x_passphrase, $usergroup_id, $wlangroup_id, $enabled = true, $hide_ssid = false, $is_guest = false, $security = 'open', $wpa_mode = 'wpa2', $wpa_enc = 'ccmp', $vlan_enabled = null, $vlan_id = null, $uapsd_enabled = false, $schedule_enabled = false, $schedule = [], $ap_group_ids = null, $payload = [])

Network Analysis

  • List country codes

    Retrieves a list of supported country codes for wireless regulatory compliance. Country codes determine allowed wireless channels and power levels.

    Parameters

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to an array of country code objects

    Throws

    When country code listing fails

    Example

    // Get all supported country codes
    const countryCodes = await networkAPI.list_country_codes();
    console.log(`Supported countries: ${countryCodes.length}`);

    // Find specific country
    const usCode = countryCodes.find(country => country.code === 'US');

    See

    list_current_channels to see current channel usage

    PHP: list_country_codes() -> return $this->fetch_results('/api/s/' . $this->site . '/stat/ccode');

  • List current channels

    Retrieves information about currently used wireless channels across all Access Points. This helps with channel planning and interference analysis.

    Parameters

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to an array of current channel usage objects

    Throws

    When current channel listing fails

    Example

    // Get current channel usage
    const channels = await networkAPI.list_current_channels();
    console.log(`Active channels: ${channels.length}`);

    // Find 5GHz channels
    const fiveGhzChannels = channels.filter(ch => ch.radio === 'na');

    See

    PHP: list_current_channels() -> return $this->fetch_results('/api/s/' . $this->site . '/stat/current-channel');

  • Spectrum scan

    Initiates a spectrum scan on a specific Access Point to analyze wireless interference and channel utilization. This helps optimize wireless performance.

    Parameters

    • mac: string

      Required MAC address of the Access Point to perform spectrum scan

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if spectrum scan was initiated successfully

    Throws

    When MAC address is invalid

    Throws

    When spectrum scan initiation fails

    Example

    // Start spectrum scan on specific AP
    await networkAPI.spectrum_scan('aa:bb:cc:dd:ee:ff');

    // Check scan results after completion
    setTimeout(async () => {
    const results = await networkAPI.spectrum_scan_state('aa:bb:cc:dd:ee:ff');
    console.log('Scan results:', results);
    }, 30000); // Wait 30 seconds for scan to complete

    See

    PHP: spectrum_scan($mac) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr', $payload);

  • Spectrum scan state

    Retrieves the results of a spectrum scan performed on a specific Access Point. This provides detailed information about wireless interference and channel utilization.

    Parameters

    • mac: string

      Required MAC address of the Access Point to get spectrum scan results

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to spectrum scan results

    Throws

    When MAC address is invalid

    Throws

    When spectrum scan state retrieval fails

    Example

    // Get spectrum scan results
    const scanResults = await networkAPI.spectrum_scan_state('aa:bb:cc:dd:ee:ff');

    // Analyze interference levels
    if (scanResults.spectrum_table) {
    const highInterference = scanResults.spectrum_table.filter(
    entry => entry.utilization > 50
    );
    console.log(`High interference channels: ${highInterference.length}`);
    }

    See

    PHP: spectrum_scan_state($mac) -> return $this->fetch_results('/api/s/' . $this->site . '/stat/spectrum-scan/' . strtolower(trim($mac)));

Network Management - Network Management

  • Create network

    Creates a new network configuration in the UniFi Controller. Networks define IP subnets, VLAN settings, and routing policies.

    Parameters

    • payload: any

      Required Network configuration object

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to the created network configuration

    Throws

    When payload validation fails

    Throws

    When network creation fails

    Example

    // Create a basic network
    const network = await client.create_network({
    name: 'Guest Network',
    purpose: 'guest',
    ip_subnet: '192.168.100.1/24',
    networkgroup: 'LAN',
    vlan_enabled: true,
    vlan: 100
    });

    // Create VLAN network with DHCP
    await client.create_network({
    name: 'IoT Network',
    purpose: 'vlan-only',
    ip_subnet: '10.0.50.1/24',
    vlan_enabled: true,
    vlan: 50,
    dhcpd_enabled: true,
    dhcpd_start: '10.0.50.10',
    dhcpd_stop: '10.0.50.200'
    });

    See

    Since

    1.0.0

    Remarks

    PHP: create_network($payload)

  • List network configurations

    Retrieves network configurations from the UniFi Controller. Can optionally filter by specific network ID.

    Parameters

    • Optional network_id: string

      Optional network configuration ID to filter by

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to network configuration(s)

    Throws

    When network retrieval fails

    Example

    // Get all network configurations
    const networks = await client.list_networkconf();
    console.log(`Found ${networks.length} networks`);

    // Get specific network by ID
    const network = await client.list_networkconf('507f1f77bcf86cd799439011');
    console.log(`Network: ${network.name} (${network.ip_subnet})`);

    // Find networks by purpose
    const allNetworks = await client.list_networkconf();
    const guestNetworks = allNetworks.filter(net => net.purpose === 'guest');
    const vlanNetworks = allNetworks.filter(net => net.vlan_enabled);

    See

    Since

    1.0.0

    Remarks

    PHP: list_networkconf($network_id = '') -> return $this->fetch_results('/api/s/' . $this->site . '/rest/networkconf/' . trim($network_id));

  • Delete network

    Deletes a network configuration from the UniFi Controller. This removes the network and all associated settings permanently.

    Parameters

    • network_id: string

      Required Network configuration ID to delete

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if network deletion was successful

    Throws

    When network_id is invalid

    Throws

    When network deletion fails

    Example

    // Delete a network by ID
    await client.delete_network('507f1f77bcf86cd799439011');

    // Find and delete a network by name
    const networks = await client.list_networkconf();
    const guestNetwork = networks.find(net => net.name === 'Guest Network');
    if (guestNetwork) {
    await client.delete_network(guestNetwork._id);
    }

    Warning

    Deleting a network that is in use may cause connectivity issues

    See

    Since

    1.0.0

    Remarks

    PHP: delete_network($network_id) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/networkconf/' . trim($network_id));

  • Update network settings, base

    Updates network configuration settings for a specific network. This method allows modification of network parameters like DHCP settings, VLAN configuration, and other network properties.

    Parameters

    • network_id: string

      Required Network configuration ID to update

    • payload: any

      Required Network configuration updates

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if network update was successful

    Throws

    When network_id is invalid or empty

    Throws

    When network update fails

    Example

    // Update DHCP settings
    await client.set_networksettings_base('507f1f77bcf86cd799439011', {
    dhcpd_enabled: true,
    dhcpd_start: '192.168.1.100',
    dhcpd_stop: '192.168.1.200',
    dhcpd_leasetime: 86400
    });

    // Enable VLAN on existing network
    await client.set_networksettings_base('507f1f77bcf86cd799439011', {
    vlan_enabled: true,
    vlan: 50
    });

    // Update network name and purpose
    await client.set_networksettings_base('507f1f77bcf86cd799439011', {
    name: 'Updated Network Name',
    purpose: 'corporate'
    });

    See

    Since

    1.0.0

    Remarks

    PHP: set_networksettings_base($network_id, $payload) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/networkconf/' . trim($network_id), $payload);

  • List routing rules

    Retrieves routing rules configured in the UniFi Controller. Can optionally filter by specific route ID.

    Parameters

    • Optional route_id: string

      Optional route ID to filter by

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to routing rule(s)

    Throws

    When routing rule retrieval fails

    Example

    // Get all routing rules
    const routes = await client.list_routing();
    console.log(`Found ${routes.length} routing rules`);

    // Get specific route by ID
    const route = await client.list_routing('507f1f77bcf86cd799439011');
    console.log(`Route: ${route.name} -> ${route.nexthop}`);

    // Find routes by type
    const allRoutes = await client.list_routing();
    const staticRoutes = allRoutes.filter(route => route.type === 'static');

    See

    create_routing to create routing rules (if available)

    Since

    1.0.0

    Remarks

    PHP: list_routing($route_id = '') -> return $this->fetch_results('/api/s/' . $this->site . '/rest/routing/' . trim($route_id));

  • List port configurations

    Retrieves port configuration profiles from the UniFi Controller. These profiles define VLAN assignments, PoE settings, and other port-specific configurations for switches.

    Parameters

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to port configuration profiles

    Throws

    When port configuration retrieval fails

    Example

    // Get all port configurations
    const portConfigs = await client.list_portconf();
    console.log(`Found ${portConfigs.length} port configurations`);

    // Find configurations by name
    const voipConfig = portConfigs.find(config => config.name === 'VoIP');
    if (voipConfig) {
    console.log(`VoIP VLAN: ${voipConfig.native_networkconf_id}`);
    }

    See

    create_portconf to create port configurations (if available)

    Since

    1.0.0

    Remarks

    PHP: list_portconf() -> return $this->fetch_results('/api/s/' . $this->site . '/list/portconf');

  • List port forwarding statistics

    Retrieves statistics for port forwarding rules including traffic counters and connection information.

    Parameters

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to port forwarding statistics

    Throws

    When port forwarding statistics retrieval fails

    Example

    // Get port forwarding statistics
    const stats = await client.list_portforward_stats();
    stats.forEach(stat => {
    console.log(`Rule ${stat.name}: ${stat.tx_bytes} bytes transferred`);
    });

    See

    list_portforwarding to get port forwarding rules

    Since

    1.0.0

    Remarks

    PHP: list_portforward_stats() -> return $this->fetch_results('/api/s/' . $this->site . '/stat/portforward_stats');

  • List port forwarding rules

    Retrieves port forwarding rules configured in the UniFi Controller. These rules define how external traffic is forwarded to internal hosts.

    Parameters

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to port forwarding rules

    Throws

    When port forwarding rules retrieval fails

    Example

    // Get all port forwarding rules
    const rules = await client.list_portforwarding();
    console.log(`Found ${rules.length} port forwarding rules`);

    // Find rules by protocol
    const httpRules = rules.filter(rule => rule.dst_port === '80');
    const httpsRules = rules.filter(rule => rule.dst_port === '443');

    See

    create_portforwarding to create port forwarding rules (if available)

    Since

    1.0.0

    Remarks

    PHP: list_portforwarding() -> return $this->fetch_results('/api/s/' . $this->site . '/list/portforward');

  • Create DNS record

    Creates a new DNS record in the UniFi Controller's DNS server. Supports various record types including A, AAAA, MX, TXT, SRV, and NS.

    Parameters

    • record_type: "A" | "AAAA" | "MX" | "TXT" | "SRV" | "NS"

      Required DNS record type

    • value: string

      Required DNS record value

    • key: string

      Required DNS record key/name

    • Optional ttl: number

      Optional time-to-live in seconds

    • enabled: boolean = true

      Optional whether the record is enabled (default: true)

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to the created DNS record

    Throws

    When record parameters are invalid

    Throws

    When DNS record creation fails

    Example

    // Create A record
    await client.create_dns_record('A', '192.168.1.100', 'server.local');

    // Create CNAME record with TTL
    await client.create_dns_record('CNAME', 'server.local', 'www.local', 3600);

    // Create MX record
    await client.create_dns_record('MX', '10 mail.local', 'local');

    // Create disabled record
    await client.create_dns_record('A', '192.168.1.200', 'test.local', 300, false);

    See

    Since

    1.0.0

    Remarks

    PHP: create_dns_record($record_type, $value, $key, $ttl = null, $enabled = true)

  • List DNS records

    Retrieves DNS records configured in the UniFi Controller's DNS server.

    Parameters

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to DNS records

    Throws

    When DNS records retrieval fails

    Example

    // Get all DNS records
    const records = await client.list_dns_records();
    console.log(`Found ${records.length} DNS records`);

    // Find records by type
    const aRecords = records.filter(record => record.record_type === 'A');
    const mxRecords = records.filter(record => record.record_type === 'MX');

    See

    Since

    1.0.0

    Remarks

    PHP: list_dns_records() -> return $this->fetch_results('/api/s/' . $this->site . '/rest/dnsrecord');

  • Delete DNS record

    Deletes a DNS record from the UniFi Controller's DNS server.

    Parameters

    • record_id: string

      Required DNS record ID to delete

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if DNS record deletion was successful

    Throws

    When record_id is invalid

    Throws

    When DNS record deletion fails

    Example

    // Delete a DNS record by ID
    await client.delete_dns_record('507f1f77bcf86cd799439011');

    // Find and delete a record by name
    const records = await client.list_dns_records();
    const testRecord = records.find(record => record.key === 'test.local');
    if (testRecord) {
    await client.delete_dns_record(testRecord._id);
    }

    See

    Since

    1.0.0

    Remarks

    PHP: delete_dns_record($record_id)

  • Create dynamic DNS configuration

    Creates a new dynamic DNS configuration in the UniFi Controller. Dynamic DNS automatically updates DNS records when IP addresses change.

    Parameters

    • payload: any

      Required Dynamic DNS configuration object

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if dynamic DNS creation was successful

    Throws

    When payload validation fails

    Throws

    When dynamic DNS creation fails

    Example

    // Create dynamic DNS configuration
    await client.create_dynamicdns({
    service: 'dyndns',
    host_name: 'myhost.dyndns.org',
    username: 'myusername',
    password: 'mypassword',
    enabled: true
    });

    See

    Since

    1.0.0

    Remarks

    PHP: create_dynamicdns($payload) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/dynamicdns', $payload);

  • List dynamic DNS configurations

    Retrieves dynamic DNS configurations from the UniFi Controller.

    Parameters

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to dynamic DNS configurations

    Throws

    When dynamic DNS retrieval fails

    Example

    // Get all dynamic DNS configurations
    const configs = await client.list_dynamicdns();
    console.log(`Found ${configs.length} dynamic DNS configurations`);

    // Find enabled configurations
    const enabledConfigs = configs.filter(config => config.enabled);

    See

    Since

    1.0.0

    Remarks

    PHP: list_dynamicdns() -> return $this->fetch_results('/api/s/' . $this->site . '/rest/dynamicdns');

  • Update dynamic DNS configuration

    Updates an existing dynamic DNS configuration in the UniFi Controller.

    Parameters

    • dynamicdns_id: string

      Required Dynamic DNS configuration ID to update

    • payload: any

      Required Dynamic DNS configuration updates

    • site: string = 'default'
    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if dynamic DNS update was successful

    Throws

    When dynamicdns_id is invalid or empty

    Throws

    When dynamic DNS update fails

    Example

    // Update dynamic DNS configuration
    await client.set_dynamicdns('507f1f77bcf86cd799439011', {
    enabled: false,
    host_name: 'newhost.dyndns.org'
    });

    // Change credentials
    await client.set_dynamicdns('507f1f77bcf86cd799439011', {
    username: 'newusername',
    password: 'newpassword'
    });

    See

    Since

    1.0.0

    Remarks

    PHP: set_dynamicdns($dynamicdns_id, $payload) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/dynamicdns/' . trim($dynamicdns_id), $payload);

WLAN Management

  • Delete WLAN

    Permanently deletes a WLAN configuration from the UniFi Controller. This removes the wireless network and all associated settings.

    Parameters

    • wlan_id: string

      Required WLAN configuration ID to delete

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if WLAN deletion was successful

    Throws

    When wlan_id is invalid

    Throws

    When WLAN deletion fails

    Example

    // Delete a WLAN by ID
    await networkAPI.delete_wlan('507f1f77bcf86cd799439011');

    // Find and delete WLAN by name
    const wlans = await networkAPI.list_wlanconf();
    const guestWlan = wlans.find(wlan => wlan.name === 'Guest Network');
    if (guestWlan) {
    await networkAPI.delete_wlan(guestWlan._id);
    }

    Warning

    Deleting a WLAN will disconnect all clients using that network

    See

    PHP: delete_wlan($wlan_id) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/wlanconf/' . trim($wlan_id));

  • Disable WLAN

    Temporarily disables or enables a WLAN without deleting the configuration. This allows you to quickly turn wireless networks on/off as needed.

    Parameters

    • wlan_id: string

      Required WLAN configuration ID to disable/enable

    • disable: boolean

      Required Whether to disable (true) or enable (false) the WLAN

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if WLAN disable/enable was successful

    Throws

    When wlan_id is invalid

    Throws

    When WLAN disable/enable fails

    Example

    // Disable a WLAN
    await networkAPI.disable_wlan('507f1f77bcf86cd799439011', true);

    // Enable a WLAN
    await networkAPI.disable_wlan('507f1f77bcf86cd799439011', false);

    // Find and disable guest network during maintenance
    const wlans = await networkAPI.list_wlanconf();
    const guestWlan = wlans.find(wlan => wlan.name === 'Guest Network');
    if (guestWlan) {
    await networkAPI.disable_wlan(guestWlan._id, true);
    }

    See

    PHP: disable_wlan($wlan_id, $disable) -> return $this->set_wlansettings_base($wlan_id, $payload);

  • List WLAN groups

    Retrieves a list of WLAN groups configured in the UniFi Controller. WLAN groups allow you to organize and manage wireless networks across different Access Points.

    Parameters

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to an array of WLAN group objects

    Throws

    When WLAN group listing fails

    Example

    // Get all WLAN groups
    const wlanGroups = await networkAPI.list_wlan_groups();
    console.log(`Found ${wlanGroups.length} WLAN groups`);

    // Find a specific WLAN group
    const defaultGroup = wlanGroups.find(group => group.name === 'Default');

    See

    PHP: list_wlan_groups() -> return $this->fetch_results('/api/s/' . $this->site . '/list/wlangroup');

  • List WLAN configuration

    Retrieves a list of all WLAN (wireless network) configurations from the UniFi Controller. This includes SSIDs, security settings, user groups, and other wireless network parameters.

    Parameters

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<any>

    Promise resolving to an array of WLAN configuration objects

    Throws

    When WLAN configuration listing fails

    Example

    // Get all WLAN configurations
    const wlans = await networkAPI.list_wlanconf();
    console.log(`Found ${wlans.length} wireless networks`);

    // Filter enabled WLANs only
    const enabledWlans = wlans.filter(wlan => wlan.enabled);

    // Find guest networks
    const guestWlans = wlans.filter(wlan => wlan.is_guest);

    See

    PHP: list_wlanconf() -> return $this->fetch_results('/api/s/' . $this->site . '/list/wlanconf');

  • Set WLAN settings

    Updates WLAN configuration settings with the provided payload. This is a high-level method that delegates to set_wlansettings_base.

    Parameters

    • wlan_id: string

      Required WLAN configuration ID to update

    • payload: any

      Required Configuration settings to update

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if WLAN settings update was successful

    Throws

    When wlan_id or payload is invalid

    Throws

    When WLAN settings update fails

    Example

    // Update WLAN security settings
    await networkAPI.set_wlansettings('507f1f77bcf86cd799439011', {
    security: 'wpapsk',
    wpa_mode: 'wpa2',
    x_passphrase: 'newpassword123'
    });

    // Enable/disable WLAN
    await networkAPI.set_wlansettings('507f1f77bcf86cd799439011', {
    enabled: false
    });

    See

    PHP: set_wlansettings($wlan_id, $payload) -> return $this->set_wlansettings_base($wlan_id, $payload);

  • Set WLAN settings base

    Low-level method to update WLAN configuration settings directly. This method provides direct access to the UniFi Controller's WLAN configuration API.

    Parameters

    • wlan_id: string

      Required WLAN configuration ID to update

    • payload: any

      Required Configuration settings to update

    • site: string = 'default'

      Site identifier (default: 'default')

    • Optional options: {
          signal?: AbortSignal;
      }

      Optional request configuration

      • Optional signal?: AbortSignal

        Optional AbortSignal to cancel the request

    Returns Promise<boolean>

    Promise resolving to true if WLAN settings update was successful

    Throws

    When wlan_id or payload is invalid

    Throws

    When WLAN settings update fails

    Example

    // Update multiple WLAN settings
    await networkAPI.set_wlansettings_base('507f1f77bcf86cd799439011', {
    name: 'Updated Network Name',
    enabled: true,
    hide_ssid: false,
    security: 'wpapsk',
    wpa_mode: 'wpa2',
    wpa_enc: 'ccmp',
    x_passphrase: 'newsecurepassword'
    });

    See

    PHP: set_wlansettings_base($wlan_id, $payload) -> return $this->fetch_results_boolean('/api/s/' . $this->site . '/rest/wlanconf/' . trim($wlan_id), $payload);