Managing security groups
A security group is a set of firewall rules applied to your instances. Each rule opens a protocol and port range to a source address range, in one direction.
Every operation on this page has been run against production, so the examples are the real requests and responses, not illustrations.
Authentication
Section titled “Authentication”Send your console API key in an Authorization header. The API does not accept cookie
or session authentication — a request without the header returns:
{ "error": { "code": 401, "message": "Missing or invalid Authorization header" } }export CL_KEY="clk_live_your_key_here"1. Create a group
Section titled “1. Create a group”curl -X POST https://console.cloudlogics.com/api/v1/security-group \ -H "Authorization: Bearer $CL_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "web-servers", "description": "Public web tier"}'name is required, must be 3–50 characters, and may contain only a-z, 0-9 and
hyphens. Uppercase is converted to lowercase. Omitting the name returns 400
with "name cannot be empty".
A new group has no inbound rules, so nothing can reach an instance using it until you add
some. You can also pass a rules array here to create the group and its rules in one
call, using the same rule shape as the next section.
Every field, with its allowed values, is listed on the operation page for this endpoint.
2. Add a rule
Section titled “2. Add a rule”POST /security-group/{id}/rule
curl -X POST https://console.cloudlogics.com/api/v1/security-group/$GROUP_ID/rule \ -H "Authorization: Bearer $CL_KEY" \ -H "Content-Type: application/json" \ -d '{ "direction": "ingress", "protocol": "tcp", "dst_port": "443", "ethertype": "IPv4", "remote_ip": "0.0.0.0/0", "description": "HTTPS from anywhere" }'Returns 201 with the created rule:
{ "data": { "id": "614eee70-0cc3-4d40-90aa-a023d77d7808", "security_group_id": "8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2", "project_id": "739c7634e11841a18196db15428400aa", "name": null, "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", "remote_group_id": null, "remote_address_group_id": null, "description": "HTTPS from anywhere", "belongs_to_default_sg": false, "revision_number": 0, "created_at": "2026-09-08T20:26:02Z" }}Adding the same rule twice returns 409:
{ "error": { "code": 409, "message": "This rule already exists in the selected security group." } }That makes the call safe to retry — a 409 means the rule you wanted is already in place.
The request body is an empty JSON object. Both identifiers travel in the path.
To see what is already attached, use
GET /server/{server_id}/security-group.
6. Detach a group
Section titled “6. Detach a group”DELETE /server/{server_id}/security-group/{id}
curl -X DELETE \ https://console.cloudlogics.com/api/v1/server/$SERVER_ID/security-group/$GROUP_ID \ -H "Authorization: Bearer $CL_KEY"Detaching leaves the group itself intact — it only removes it from that one instance.
Doing the same thing in the console
Section titled “Doing the same thing in the console”Everything above is also available under Network & Security → Security Groups, and a group can be attached or detached from an instance’s own page with Add Security Group. The console is the quickest way to check your work while you are getting the API calls right.
