Skip to main content
The network configuration tools give you programmatic control over your UniFi site’s layer-2 and layer-3 network topology. You can create new VLANs with full DHCP configuration, modify existing network settings without recreating them, and permanently remove networks you no longer need. All three write operations require confirm=True and support a dry_run=True mode so you can validate your configuration before applying it.
All write operations on this page require confirm=True. Use dry_run=True to preview the exact payload that will be sent to the controller before committing. Deleting a network is irreversible — clients and devices on that segment will lose connectivity immediately.

Tools

create_network

Creates a new network (VLAN) in the specified site. You must supply a VLAN ID and subnet in CIDR notation. DHCP is enabled by default and additional options let you configure the DHCP range, DNS servers, and domain name.
string
required
The site identifier where the network will be created.
string
required
Human-readable name for the network (e.g. "IoT Devices").
integer
required
VLAN tag between 1 and 4094.
string
required
Network address in CIDR notation (e.g. "10.10.20.0/24").
string
Network purpose. Accepted values: corporate, guest, vlan-only, wan. Defaults to corporate.
boolean
Enable the built-in DHCP server for this network. Defaults to true.
string
First IP address in the DHCP lease range (e.g. "10.10.20.100").
string
Last IP address in the DHCP lease range (e.g. "10.10.20.254").
string
Primary DNS server IP address.
string
Secondary DNS server IP address.
string
Tertiary DNS server IP address.
string
Quaternary DNS server IP address.
string
Domain name distributed to DHCP clients (e.g. "iot.local").
boolean
required
Must be true to create the network.
boolean
When true, validates all parameters and returns the payload that would be sent to the controller without creating anything.
Example: creating a VLAN for IoT devices
To create a network for VLAN tagging only with no IP assignment (e.g. for a trunk or passthrough segment), set purpose to "vlan-only" and dhcp_enabled to false.

update_network

Modifies an existing network using a fetch-then-merge strategy: the tool fetches the current configuration, applies only the fields you supply, then writes the result back. Fields you omit are left unchanged.
string
required
The site identifier where the network lives.
string
required
The internal ID of the network to update. Use get_network_details or list_vlans to find this value.
string
New human-readable name for the network.
integer
New VLAN tag (1–4094). Changing a VLAN ID re-tags all traffic on that segment.
string
New subnet in CIDR notation.
string
New network purpose: corporate, guest, vlan-only, or wan.
boolean
Enable or disable the DHCP server.
string
New DHCP range start IP.
string
New DHCP range stop IP.
string
New primary DNS server.
string
New secondary DNS server.
string
New tertiary DNS server.
string
New quaternary DNS server.
string
New domain name for DHCP clients.
boolean
required
Must be true to apply changes.
boolean
When true, returns a preview of the changes without writing anything.

delete_network

Permanently removes a network from the site. The tool verifies the network exists before deleting it and raises ResourceNotFoundError if it cannot be found.
Deleting a network is irreversible. Devices and clients on that VLAN segment will lose network access immediately. Verify the network_id with get_network_details before proceeding.
string
required
The site identifier where the network lives.
string
required
The internal ID of the network to delete.
boolean
required
Must be true to delete the network.
boolean
When true, confirms the network exists and returns a preview without deleting.