---
title: "Create a new firewall rule"
method: POST
path: "/project/{project_id}/location/{location}/firewall/{firewall_reference}/firewall-rule"
tags: ["Firewall Rule"]
---

# Create a new firewall rule

`POST /project/{project_id}/location/{location}/firewall/{firewall_reference}/firewall-rule`

## Request body

- object
  - `cidr` string, required — CIDR or private subnet id or name to allow
  - `firewall_id` string
  - `port_range` string — Port range to allow
  - `protocol` string — Protocol to allow (tcp or udp, default tcp)
  - `description` string — Description to use for the firewall rule
  - `project_id` string

## Response `200`

A Firewall Rule or array of them

- union
  - FirewallRule
    - `cidr` string, required — CIDR of the firewall rule
    - `id` string, required — ID of the firewall rule
    - `port_range` string, required — Port range of the firewall rule
    - `protocol` 'tcp' | 'udp', required — Protocol of the firewall rule (tcp or udp)
    - `description` string, required — Description of the firewall rule
  - FirewallRule[]
    - `cidr` string, required — CIDR of the firewall rule
    - `id` string, required — ID of the firewall rule
    - `port_range` string, required — Port range of the firewall rule
    - `protocol` 'tcp' | 'udp', required — Protocol of the firewall rule (tcp or udp)
    - `description` string, required — Description of the firewall rule

## Other responses

- `default` — An error response

## Changes

- **2026-05-21** `65eaca27bbb7` — 3 info
  - added the new optional request property `protocol`
  - added the required property `anyOf[#/components/schemas/FirewallRule]/protocol` to the response with the `200` status
  - added the required property `anyOf[subschema #2]/items/protocol` to the response with the `200` status
- **2025-11-04** `d468e27625fc` — 5 breaking, 1 info
  - the response's body type changed from `object` to no type for status `200`
  - removed the required property `cidr` from the response with the `200` status
  - removed the required property `description` from the response with the `200` status
  - removed the required property `id` from the response with the `200` status
  - …2 more
- **2025-10-25** `d81708f425bb` — 2 info
  - added the new optional request property `description`
  - added the required property `description` to the response with the `200` status

[Change history](https://skmtc.dev/ubicloud/apis/clover-api/changes/project/:project_id/location/:location/firewall/:firewall_reference/firewall-rule/post.md)

---

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