---
title: "Replace all firewall rules in group"
method: PUT
path: "/api/vps/v1/firewall/{firewallId}/rules"
tags: ["VPS: Firewall"]
---

# Replace all firewall rules in group

`PUT /api/vps/v1/firewall/{firewallId}/rules`

Replaces all firewall rules within a specified firewall group with the provided set of rules
in a single atomic operation, instead of creating or deleting rules one by one.

Any virtual machine using this firewall group will need to be synchronized after replacing rules;
pass the "sync" parameter to trigger synchronization immediately.

## Path parameters

- `firewallId` integer, required

## Request body

- VPSV1FirewallRulesReplaceRequest
  - `rules` VPSV1FirewallRulesStoreRequest[], required — The complete set of firewall rules that atomically replaces all existing rules in the group
    - `protocol` 'TCP' | 'UDP' | 'ICMP' | 'GRE' | 'any' | 'ESP' | 'AH' | 'ICMPv6' | 'SSH' | 'HTTP' | 'HTTPS' | 'MySQL' | 'PostgreSQL', required
    - `port` string, required — Port or port range, ex: 1024:2048
    - `source` 'any' | 'custom', required
    - `source_detail` string, required — IP range, CIDR, single IP or `any`
  - `sync` boolean — Synchronize the firewall group to all its virtual machines after replacing the rules

## Response `200`

Success response

- VPSV1FirewallFirewallResource
  - `id` integer — Firewall ID
  - `name` string — Firewall name
  - `is_synced` boolean — Is current firewall synced with VPS
  - `rules` VPSV1FirewallFirewallRuleResource[] — Array of [`VPS.V1.Firewall.FirewallRuleResource`](#model/vpsv1firewallfirewallruleresource)
    - `id` integer — Firewall rule ID
    - `action` 'accept' | 'drop' — Firewall rule action
    - `protocol` 'TCP' | 'UDP' | 'ICMP' | 'GRE' | 'any' | 'ESP' | 'AH' | 'ICMPv6' | 'SSH' | 'HTTP' | 'HTTPS' | 'MySQL' | 'PostgreSQL' — Firewall rule protocol
    - `port` string — Firewall rule destination port: single or port range
    - `source` string — Firewall rule source. Can be `any` or `custom`
    - `source_detail` string — Firewall rule source detail. Can be `any` or IP address, CIDR or range
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `401` — Unauthenticated response
- `422` — Validation error response
- `500` — Error response

---

[API](https://skmtc.dev/hostinger/apis/hostinger-api.md) · [All operations](https://skmtc.dev/hostinger/apis/hostinger-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hostinger/hostinger-api/revisions/53ccee45e5eb/schema)
