---
title: "Create a security group"
method: POST
path: "/agent/compute/firewall"
tags: ["Compute"]
---

# Create a security group

`POST /agent/compute/firewall`

## Request

- Base URL: `https://edge.network`
- URL: `https://edge.network/agent/compute/firewall`
- Auth: HTTP bearer

Create a security group with inbound/outbound firewall rules, then attach it to VMs.

## Headers

- `X-Dry-Run` 'true' | 'false'
- `Idempotency-Key` string

## Request body

- object
  - `name` string, required
  - `description` string
  - `rules` object[]
    - `direction` 'inbound' | 'outbound'
    - `protocol` 'tcp' | 'udp' | 'icmp' | 'all'
    - `portRange` string: Port or range, e.g. "80" or "8000-9000". Omit for all ports.
    - `source` string

## Response `201`

Success.

- object
  - `security_group` SecurityGroup, required
    - `id` string, required
    - `name` string, required
    - `description` string, nullable
    - `rules` object[]
      - `direction` 'inbound' | 'outbound'
      - `protocol` 'tcp' | 'udp' | 'icmp' | 'all'
      - `portRange` string: Port or range, e.g. "80" or "8000-9000". Omit for all ports.
      - `source` string: Source CIDR, e.g. 0.0.0.0/0.
  - `tell_user` string: Human-readable summary of what happened, for the agent to relay to its operator.

## Other responses

- `400`: Validation error — the response body explains what to fix.
- `401`: Missing or invalid agent access code. The body includes self-signup pointers.
- `429`: Rate limited. Honour Retry-After and the RateLimit-* headers before retrying.

---

[API](https://skmtc.dev/edge/apis/edge-network-agent-api.md) · [All operations](https://skmtc.dev/edge/apis/edge-network-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/edge/apis/edge-network-agent-api/revisions/49b5f2adf020?raw)
