API
Networks
Security Groups
List Security Groups

List Security Groups

Returns security groups and their rules for the authenticated user.

Security groups control inbound and outbound traffic to your instances.


Endpoint

GET /cloud/v1/network/security_groups/list

Example

curl https://api.redu.cloud/cloud/v1/network/security_groups/list \
  -H "x-api-key: YOUR_API_KEY"

Successful Response

This endpoint returns an array of security groups. Each security group includes security_group_rules.

[
  {
    "id": "1c62ad45-128d-45d9-b164-6cefdf5e8739",
    "name": "john-default-access",
    "stateful": true,
    "tenant_id": "719015812e824d5b874b4190dde8f43c",
    "project_id": "719015812e824d5b874b4190dde8f43c",
    "description": "Allow SSH, HTTP, and HTTPS access",
    "shared": false,
    "security_group_rules": [
      {
        "id": "0e01f13b-a7d0-4690-9d77-ec31ec5e75b8",
        "security_group_id": "1c62ad45-128d-45d9-b164-6cefdf5e8739",
        "ethertype": "IPv4",
        "direction": "ingress",
        "protocol": "tcp",
        "port_range_min": 22,
        "port_range_max": 22,
        "remote_ip_prefix": null
      },
      {
        "id": "430d3608-fc80-4f2e-9ea3-5644ce5b3c0a",
        "security_group_id": "1c62ad45-128d-45d9-b164-6cefdf5e8739",
        "ethertype": "IPv4",
        "direction": "ingress",
        "protocol": "tcp",
        "port_range_min": 80,
        "port_range_max": 80,
        "remote_ip_prefix": null
      },
      {
        "id": "b5506f73-3721-40b9-aba0-c4e62af48743",
        "security_group_id": "1c62ad45-128d-45d9-b164-6cefdf5e8739",
        "ethertype": "IPv4",
        "direction": "egress",
        "protocol": null,
        "port_range_min": null,
        "port_range_max": null,
        "remote_ip_prefix": null
      }
    ]
  },
  {
    "id": "42fb786d-0372-42e3-9e53-8770cb36639f",
    "name": "default",
    "stateful": true,
    "tenant_id": "719015812e824d5b874b4190dde8f43c",
    "project_id": "719015812e824d5b874b4190dde8f43c",
    "description": "Default security group",
    "shared": false,
    "security_group_rules": [
      {
        "id": "c7a4ae46-d2f3-47b0-a244-adfa5f313d8e",
        "security_group_id": "42fb786d-0372-42e3-9e53-8770cb36639f",
        "ethertype": "IPv4",
        "direction": "ingress",
        "protocol": null,
        "port_range_min": null,
        "port_range_max": null,
        "remote_ip_prefix": null,
        "remote_group_id": "42fb786d-0372-42e3-9e53-8770cb36639f"
      }
    ]
  }
]

Notes

  • If remote_ip_prefix is null, the rule is not restricted to a CIDR (commonly interpreted as “anywhere”, depending on other rule fields).
  • For egress rules, protocol and port ranges may be null to represent “allow all”.

Response Schema

SecurityGroup

FieldTypeDescription
idstringSecurity group ID
namestringSecurity group name
descriptionstringDescription
statefulbooleanWhether the group is stateful
sharedbooleanWhether the group is shared
tenant_idstringTenant ID (legacy OpenStack field)
project_idstringProject ID
security_group_rulesSecurityGroupRule[]List of rules

SecurityGroupRule

FieldTypeDescription
idstringRule ID
security_group_idstringParent security group ID
ethertypestringIPv4 or IPv6
directionstringingress or egress
protocolstringnull
port_range_minintegernull
port_range_maxintegernull
remote_ip_prefixstringnull
remote_group_idstringnull

Errors

401 Unauthorized

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key"
  }
}

403 Forbidden

The API key does not have access to the requested project.