---
title: "List Security Groups."
method: GET
path: "/security-group"
tags: ["security-group"]
---

# List Security Groups.

`GET /security-group`

## Request

- Base URL: `https://api-ch-gva-2.exoscale.com/v2`
- URL: `https://api-ch-gva-2.exoscale.com/v2/security-group`
- Auth: none declared
- TypeScript: <https://skmtc.dev/exoscale/apis/exoscale-api/docs/security-group/get.ts> (a function with typed inputs; its response is checked against the schema)

Lists security groups. When visibility is set to public, lists public security groups.
Public security groups are objects maintained by Exoscale which contain source addresses for
relevant services hosted by Exoscale. They can be used a source in ingress rules and as a destination
in egress rules.

## Query parameters

- `visibility` 'private' | 'public'

## Response `200`

200

- object
  - `security-groups` SecurityGroup[]
    - `id` string, uuid: Security Group ID
    - `name` string: Security Group name
    - `description` string: Security Group description
    - `external-sources` string[]: Security Group external sources
    - `rules` SecurityGroupRule[]: Security Group rules
      - `description` string: Security Group rule description
      - `start-port` integer: Start port of the range
      - `protocol` 'tcp' | 'esp' | 'icmp' | 'udp' | 'gre' | 'ah' | 'ipip' | 'icmpv6': Network protocol
      - `icmp` object: ICMP details
        - `code` integer
        - `type` integer
      - `end-port` integer: End port of the range
      - `security-group` SecurityGroupResource: Security Group
        - `id` string, uuid: Security Group ID
        - `name` string: Security Group name
        - `visibility` 'private' | 'public': Whether this points to a public security group. This is only valid when in the context of a rule addition which uses a public security group as a source or destination.
      - `id` string, uuid: Security Group rule ID
      - `network` string: CIDR-formatted network allowed
      - `flow-direction` 'ingress' | 'egress': Network flow direction to match

## Changes

- **2023-06-06** `cf7b08181585`: 1 breaking
  - the `security-groups/items/rules/items/description` response property's minLength was decreased from `1` to `0` for the response status `200`
- **2023-02-03** `6e9809fd1444`: 3 breaking, 2 info
  - the response property `security-groups/items/rules/items/security-group/id` became optional for the status `200`
  - the `security-groups/items/rules/items/icmp/code` response property's min was decreased from `0.00` to `-1.00` for the response status `200`
  - the `security-groups/items/rules/items/icmp/type` response property's min was decreased from `0.00` to `-1.00` for the response status `200`
  - added the new optional `query` request parameter `visibility`
  - …1 more

[Operation history](https://skmtc.dev/exoscale/apis/exoscale-api/changes/security-group/get.md)

---

[API](https://skmtc.dev/exoscale/apis/exoscale-api.md) - [All operations](https://skmtc.dev/exoscale/apis/exoscale-api/llms.txt) - [OpenAPI document](https://skmtc.dev/exoscale/apis/exoscale-api/revisions/63da6f74c845?raw)
