---
title: "Get security group by ID"
method: GET
path: "/v1/security-groups/{securityGroupId}"
tags: ["Security groups"]
---

# Get security group by ID

`GET /v1/security-groups/{securityGroupId}`

## Request

- Base URL: `https://api.emma.ms/external`
- URL: `https://api.emma.ms/external/v1/security-groups/{securityGroupId}`
- Auth: HTTP bearer

Returns a security group by its ID.

A security group refers to a set of rules that determine what network traffic is allowed to enter or leave a particular compute instance. It acts as a virtual firewall, controlling inbound and outbound traffic based on predefined rules.

Security groups operate based on predefined rules that allow traffic based on specified criteria, such as source IP address, destination IP address, port number, and protocol.

## Path parameters

- `securityGroupId` integer, required

## Query parameters

- `projectId` integer

## Response `200`

Successful operation

- SecurityGroup
  - `id` integer: Security group id
  - `name` string: Security group name
  - `createdById` integer: ID of the user who created the security group
  - `createdByName` string: Name of the user who created the security group
  - `modifiedById` integer: ID of the user who last edited the security group
  - `modifiedByName` string: Name of the user who last edited the security group
  - `createdAt` string: Date and time of the security group's creation
  - `modifiedAt` string: Date and time of the security group's last update
  - `synchronizationStatus` 'SYNCHRONIZED' | 'DESYNCHRONIZED' | 'SYNCHRONIZING': Synchronization status of the security group. When you make changes in the rules the changes are propagated to the respective provider’s security groups. While this is happening the security groups have the status Synchronizing. After it is done the status changes to Synchronized. When another VM is added to the security group it will not be synchronized at first with the other VMs, therefore the status will be Desynchronized.
  - `recomposingStatus` 'RECOMPOSED' | 'RECOMPOSING': Recomposing status of the security group. When a new Virtual machine is added to the Security group it starts a synchronization process. During this process the Security group will have a Recomposing status.
  - `lastModificationErrorDescription` string: Text of the error when the Security group was last edited
  - `rules` SecurityGroupRule[]: List of the inbound and outbound rules in the Security group
    - `type` string: Type of the security group rule
    - `policy` string: Rule policy (all rules are allowing)
    - `direction` string: Direction of the network traffic: inbound or outbound.
    - `protocol` string: Network protocol of the rule
    - `ports` string: Allowed port or port range
    - `ipRange` string: Allowed IP or IP range
    - `isMutable` boolean: Indicates if the rule can be edited. Some security group rules are added by default, cannot be changed, and are marked as immutable.

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found
- `500`: Internal server error

---

[API](https://skmtc.dev/emma/apis/public-emma-api.md) - [All operations](https://skmtc.dev/emma/apis/public-emma-api/llms.txt) - [OpenAPI document](https://skmtc.dev/emma/apis/public-emma-api/revisions/9e55f0920078?raw)
