Skip to content

List Firewall Rules for Virtual Machine

Retrieve a comprehensive inventory of network security policies configured for a specific virtual machine instance.

HTTP Request

GET {API_URL}/virtual-machines/{id}/firewall-rules

Path Parameters

ParameterRequirementTypeDescription
idRequiredstringTarget virtual machine's unique identifier

Query Parameters

ParameterRequirementTypeDescription
limitOptionalintMaximum number of records to return
offsetOptionalintNumber of records to skip for pagination
sortFieldOptionalstringField identifier for result ordering
sortOrderOptionalstringSort direction: desc or asc

Response Structure

status boolean

Operation result indicator. Returns true for successful execution, false when encountering an error.

message string

Descriptive response indicating the outcome of the rule retrieval request.

total int

Aggregate count of available records.

data object

Collection of implemented firewall rules with detailed configurations.

Rule attributes include:

  • direction: Traffic flow direction (inbound or outbound)
  • protocol: Network protocol specification (tcp, udp, icmp)
  • ethertype: IP protocol version (IPv4 or IPv6)
  • remote_ip_prefix: Allowed IP range in CIDR notation
  • port_range_min: Lower bound of permitted port range (1-65535)
  • port_range_max: Upper bound of permitted port range (1-65535)
  • description: Administrative annotation

Implementation Example

Request

bash
curl -X GET '{API_URL}virtual-machines/{id}/firewall-rules' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'refresh-token: {REFRESH_TOKEN}' \
-H 'Content-Type: application/json'

Response

json
{
    "status": true,
    "message": "Firewall rules retrieved successfully",
    "data": [
        {
            "id": "67714175e19f11c9cb6a6149",
            "direction": "inbound",
            "ethertype": "IPv4",
            "protocol": "tcp",
            "port_range_min": 80,
            "port_range_max": 80,
            "remote_ip_prefix": "0.0.0.0/0",
            "created_at": 1735192903,
            "description": "HTTP"
        },
        {
            "id": "67714175e19f11c9cb6a614b",
            "direction": "inbound",
            "ethertype": "IPv4",
            "protocol": "tcp",
            "port_range_min": 22,
            "port_range_max": 22,
            "remote_ip_prefix": "0.0.0.0/0",
            "created_at": 1735475632,
            "description": ""
        },
        {
            "id": "67714175e19f11c9cb6a614d",
            "direction": "outbound",
            "ethertype": "IPv4",
            "protocol": "any",
            "port_range_min": 1,
            "port_range_max": 65535,
            "remote_ip_prefix": "0.0.0.0/0",
            "created_at": 1735475573,
            "description": ""
        },
        {
            "id": "67714175e19f11c9cb6a614f",
            "direction": "outbound",
            "ethertype": "IPv6",
            "protocol": "any",
            "port_range_min": 1,
            "port_range_max": 65535,
            "remote_ip_prefix": "0.0.0.0/0",
            "created_at": 1735475573,
            "description": ""
        }
    ]
}