Skip to content

Create security group rule

POST
/api/v1/security-group/{id}/rule
curl --request POST \
--url https://console.cloudlogics.com/api/v1/security-group/8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2/rule \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "description": "HTTPS from anywhere", "direction": "ingress", "dst_port": "443", "ethertype": "IPv4", "protocol": "tcp", "remote_group": "8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2", "remote_ip": "0.0.0.0/0" }'

A rule takes one source: either remote_ip (a CIDR) or remote_group (another group’s UUID). The generated sample below lists both because it shows every available field — send only one of them.

Omit dst_port when protocol is icmp.

Add a rule to a security group. Members may edit only security groups they own; project owners/admins and system admins may edit any security group in the project.

id
required
string

Security group ID

Rule fields

Media typeapplication/json
object
description

Optional free text, stored with the rule.

string
Example
HTTPS from anywhere
direction

Ingress for inbound traffic, egress for outbound.

string
Allowed values: ingress egress
Example
ingress
dst_port

Destination port, sent as a string rather than a number. Omit for icmp. Comes back as the integers port_range_min and port_range_max.

string
Example
443
ethertype

Comes back as ether_type, with an underscore.

string
Allowed values: IPv4 IPv6
Example
IPv4
protocol

Lowercase. Uppercase is not accepted.

string
Allowed values: tcp udp icmp
Example
tcp
remote_group

The UUID of another security group, to allow traffic from anything using that group. Use this or remote_ip, not both.

string
Example
8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2
remote_ip

Source or destination CIDR. 0.0.0.0/0 is the whole internet; a /32 is a single address. Use this or remote_group, not both. Comes back as remote_ip_prefix.

string
Example
0.0.0.0/0

The created rule. Verified against production.

Media typeapplication/json
object
data

A rule as the API returns it. Several field names differ from the ones you send.

object
id
string
security_group_id
string
project_id
string
name

Null for rules created through the API.

string
direction
string
Allowed values: ingress egress
protocol
string
port_range_min

Integer, although you sent dst_port as a string.

integer
port_range_max
integer
ether_type

Underscored, although you sent ethertype.

string
remote_ip_prefix

The CIDR you sent as remote_ip.

string
normalized_cidr
string
remote_group_id
string
remote_address_group_id
string
belongs_to_default_sg
boolean
revision_number
integer
description
string
created_at
string
Example
{
"data": {
"id": "614eee70-0cc3-4d40-90aa-a023d77d7808",
"security_group_id": "8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2",
"project_id": "739c7634e11841a18196db15428400aa",
"direction": "ingress",
"protocol": "tcp",
"port_range_min": 443,
"port_range_max": 443,
"ether_type": "IPv4",
"remote_ip_prefix": "0.0.0.0/0",
"normalized_cidr": "0.0.0.0/0",
"belongs_to_default_sg": false,
"revision_number": 0,
"description": "HTTPS from anywhere",
"created_at": "2026-09-08T20:26:02Z"
}
}

Invalid request

Media typeapplication/json
object
data
error
object
code
integer
message
string
page
object
next
string
prev
string
total_size
integer
Examplegenerated
{
"data": "example",
"error": {
"code": 1,
"message": "example"
},
"page": {
"next": "example",
"prev": "example",
"total_size": 1
}
}

Not permitted to manage this security group

Media typeapplication/json
object
data
error
object
code
integer
message
string
page
object
next
string
prev
string
total_size
integer
Examplegenerated
{
"data": "example",
"error": {
"code": 1,
"message": "example"
},
"page": {
"next": "example",
"prev": "example",
"total_size": 1
}
}

An identical rule is already in this group. Safe to treat as success: the rule you wanted is in place.

Media typeapplication/json
object
data
error
object
code
integer
message
string
page
object
next
string
prev
string
total_size
integer
Example
{
"error": {
"code": 409,
"message": "This rule already exists in the selected security group."
}
}

Internal server error

Media typeapplication/json
object
data
error
object
code
integer
message
string
page
object
next
string
prev
string
total_size
integer
Examplegenerated
{
"data": "example",
"error": {
"code": 1,
"message": "example"
},
"page": {
"next": "example",
"prev": "example",
"total_size": 1
}
}