Actions111
- Action Actions
- Certificate Actions
- Datacenter Actions
- Firewall Actions
- Floating IP Actions
- Image Actions
- ISO Actions
- Load Balancer Actions
- Load Balancer Type Actions
- Location Actions
- Network Actions
- Placement Group Actions
- Pricing Actions
- Primary IP Actions
- Server Actions
- Server Type Actions
- SSH Key Actions
- Volume Actions
Firewall → Set Rules
AI-generatedSummary
Replaces all rules of a Hetzner Cloud firewall with the rules array you supply, via POST /v1/firewalls/{id}/actions/set_rules.
Inputs
- Firewall (required) — The firewall to modify, chosen from a searchable list of the project's firewalls or entered by numeric ID. The ID goes into the request URL.
- Rules (JSON) — JSON array of firewall rule objects, for example [{"direction":"in","protocol":"tcp","port":"443","source_ips":["0.0.0.0/0","::/0"]}]. The default is []. It is sent as the body's
rulesproperty and replaces every existing rule. If the value is empty or '{}', no rules are sent. Invalid JSON raises a node error. - Request Options — Node-level settings: batching (items per batch and interval in ms), ignore SSL issues, an HTTP proxy, and a timeout (default 10000 ms).
Output shape
The actions array from the Hetzner API response. Each entry is an action object describing the asynchronous set_rules operation, with fields such as id, command, status and progress.
The call is asynchronous, so the returned status may still be 'running'. To confirm completion, use the Action resource's Get operation. The node does not poll. The default [] sends an empty rules array, which removes all rules from the firewall.
Examples
Example 1: Open HTTPS and SSH to the world on a web firewall
Firewall: pick 'web-firewall' from the list. Rules (JSON): an array with two inbound tcp rules, ports 443 and 22, and source_ips ["0.0.0.0/0","::/0"].
Example 2: Remove all rules from a firewall by ID
Firewall: By ID '42'. Rules (JSON): [].