Skip to content

update_port_forward

Patch fields on an existing port-forward rule.

Side effects:

  • Modifies the named forward in place. Only fields supplied in updates change.
  • Takes effect immediately on the next inbound packet.
  • Mutates controller state. Use dry_run=True to preview the change without applying.

Verified write: after applying, the rule is re-read from the controller and the response carries a verification block listing persisted_fields, unchanged_fields (already correct before the write), dropped_fields (silently discarded by the controller), coerced_fields (stored with a different value or type), and unverifiable_fields. fwd_ip is a known drop site on some firmware. A response with verified: false and mutation_applied: true means the controller accepted the write but did not store it exactly — that is not a rollback, and the rule may be in a mixed state. Re-check before assuming a port is closed.

update_port_forward(forward_id="65f...", updates={"enabled": False})
Parameter Type Required Default Description
forward_id string yes The _id from list_port_forwards.
updates object yes Partial record. Common keys: enabled, fwd_port, dst_port, proto, src, fwd, name.
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.