Skip to content

create_vlan

Create a VLAN-tagged network on the controller.

Side effects:

  • Adds a new network record with the given VLAN ID, IP subnet, and DHCP scope. The first usable address (.1) becomes the gateway.
  • Mutates controller state. Use dry_run=True to preview the change without applying.
create_vlan(name="iot", vlan_id=50, subnet="10.50.0.0/24")
Parameter Type Required Default Description
name string yes Network display name (e.g. "iot", "cameras").
vlan_id integer yes 802.1Q VLAN ID, 2-4094.
subnet string yes Subnet in either gateway-IP form ("10.50.0.1/24", what the UniFi controller stores) or network form ("10.50.0.0/24"). Network form is auto-promoted to gateway form before the POST so callers don’t have to remember which one UniFi wants. /24 only.
dhcp_start string no “” First DHCP lease address. Empty = derived from IOT_DHCP_START_OFFSET.
dhcp_stop string no “” Last DHCP lease address. Empty = derived from IOT_DHCP_STOP_OFFSET.
purpose string no “corporate” "corporate" for normal LANs, "guest" for hotspot-style isolation.
controller string no “default” Name of the UniFi controller to target. Defaults to "default".
dry_run boolean no false Preview the change without applying it. Returns the predicted change set.