Create security group rule
const url = 'https://console.cloudlogics.com/api/v1/security-group/8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2/rule';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"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"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Security group ID
Request Body
Section titled “Request Body”Rule fields
object
Optional free text, stored with the rule.
Example
HTTPS from anywhereIngress for inbound traffic, egress for outbound.
Example
ingressDestination port, sent as a string rather than a number. Omit for icmp. Comes back as the integers port_range_min and port_range_max.
Example
443Comes back as ether_type, with an underscore.
Example
IPv4Lowercase. Uppercase is not accepted.
Example
tcpThe UUID of another security group, to allow traffic from anything using that group. Use this or remote_ip, not both.
Example
8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2Source 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.
Example
0.0.0.0/0Responses
Section titled “Responses”The created rule. Verified against production.
object
A rule as the API returns it. Several field names differ from the ones you send.
object
Null for rules created through the API.
Integer, although you sent dst_port as a string.
Underscored, although you sent ethertype.
The CIDR you sent as remote_ip.
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
object
object
object
Examplegenerated
{ "data": "example", "error": { "code": 1, "message": "example" }, "page": { "next": "example", "prev": "example", "total_size": 1 }}Not permitted to manage this security group
object
object
object
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.
object
object
object
Example
{ "error": { "code": 409, "message": "This rule already exists in the selected security group." }}Internal server error
object
object
object
Examplegenerated
{ "data": "example", "error": { "code": 1, "message": "example" }, "page": { "next": "example", "prev": "example", "total_size": 1 }}