---
title: "Update security group"
method: PUT
path: "/api/v1/security-groups/{id}"
tags: ["Networking"]
---

# Update security group

`PUT /api/v1/security-groups/{id}`

Update a security group's name, description, or rules. Passing `rules` replaces the entire rule set — to add or remove a single rule, GET the current rules first, modify the array, then PUT the result.

## Path parameters

- `id` string, uuid, required

## Headers

- `X-Project-ID` string, uuid, required

## Request body

- UpdateSecurityGroupRequest — At least one field is required. Passing `rules` replaces the entire rule set.
  - `name` string
  - `description` string
  - `rules` SecurityGroupRule[]
    - `protocol` 'TCP' | 'UDP' | 'ICMP' | 'ICMPV6' | 'IPSEC' | 'ALL', required — Network protocol.
    - `rule_type` 'INBOUND' | 'OUTBOUND', required — Direction of traffic.
    - `range` string — Port or port range. Single port (`80`) or range (`8000:9000`). Empty for ICMP/ALL.
    - `ip` string — Source/destination IP for the rule. Empty means any.
    - `size` integer — CIDR block size (e.g. `24` for /24). Used with `ip` to allow a network range.
    - `icmp_type` integer — ICMP message type (only for ICMP/ICMPV6 protocols).

## Response `200`

Security group updated

- object
  - `success` boolean
  - `data` SecurityGroup — A security group — a named set of inbound/outbound rules that can be attached to VM NICs.
    - `id` string, uuid, required — Security group ID.
    - `name` string, required
    - `description` string
    - `rules` SecurityGroupRule[], required
      - `protocol` 'TCP' | 'UDP' | 'ICMP' | 'ICMPV6' | 'IPSEC' | 'ALL', required — Network protocol.
      - `rule_type` 'INBOUND' | 'OUTBOUND', required — Direction of traffic.
      - `range` string — Port or port range. Single port (`80`) or range (`8000:9000`). Empty for ICMP/ALL.
      - `ip` string — Source/destination IP for the rule. Empty means any.
      - `size` integer — CIDR block size (e.g. `24` for /24). Used with `ip` to allow a network range.
      - `icmp_type` integer — ICMP message type (only for ICMP/ICMPV6 protocols).
    - `vm_count` integer — Number of VM NICs currently using this security group.
    - `project_id` string, uuid
    - `created_at` string, date-time
    - `updated_at` string, date-time

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required
- `404` — Resource not found

---

[API](https://skmtc.dev/rafftechnologies/apis/raff-api.md) · [All operations](https://skmtc.dev/rafftechnologies/apis/raff-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/rafftechnologies/raff-api/revisions/2f4df56be77c/schema)
