Skip to main content
POST
/
api
/
v1
/
accounts
/
{accountId}
/
projects
/
{projectId}
/
security-groups
Create a security group
curl --request POST \
  --url https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "project_id": "proj-abc123xyz-v1",
  "name": "web-servers-sg",
  "description": "Security group for web servers",
  "rules": [
    {
      "direction": "ingress",
      "protocol": "tcp",
      "port_range_min": 80,
      "port_range_max": 80,
      "remote_ip_prefix": "0.0.0.0/0",
      "description": "Allow HTTP traffic"
    },
    {
      "direction": "ingress",
      "protocol": "tcp",
      "port_range_min": 443,
      "port_range_max": 443,
      "remote_ip_prefix": "0.0.0.0/0",
      "description": "Allow HTTPS traffic"
    },
    {
      "direction": "ingress",
      "protocol": "tcp",
      "port_range_min": 22,
      "port_range_max": 22,
      "remote_ip_prefix": "10.0.0.0/8",
      "description": "Allow SSH from internal network"
    }
  ]
}
'
{
  "security_group": {
    "id": "sg-abc123xyz-v1",
    "account_id": "<string>",
    "project_id": "<string>",
    "name": "<string>",
    "description": "<string>",
    "status": "active",
    "metadata": {},
    "rules": [
      {
        "id": "sgr-abc123xyz-v1",
        "security_group_id": "<string>",
        "direction": "ingress",
        "protocol": "<string>",
        "port_range_min": 123,
        "port_range_max": 123,
        "remote_ip_prefix": "<string>",
        "remote_security_group_id": "<string>",
        "icmp_type": 123,
        "icmp_code": 123,
        "priority": 123,
        "description": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "updated_at": "2023-11-07T05:31:56Z",
        "is_deleted": true
      }
    ],
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "is_deleted": true
  },
  "message": "Security group created successfully"
}

Authorizations

Authorization
string
header
required

JWT token from authentication service

Headers

x-account-id
string

Account ID from authentication (must match path accountId)

x-user-id
string

User ID performing the action

X-Request-ID
string

Unique request ID for tracing

Path Parameters

accountId
string
required

Account external ID

Pattern: ^acct-[a-zA-Z0-9]+-v1$
projectId
string
required

Project external ID

Pattern: ^proj-[a-zA-Z0-9]+-v1$

Body

application/json
project_id
string
required

Project external ID

Example:

"proj-abc123xyz-v1"

name
string
required

Security group name

Required string length: 1 - 255
Example:

"web-servers-sg"

description
string

Optional description

Example:

"Security group for web server instances"

rules
object[]

Initial firewall rules

metadata
object

Optional metadata key-value pairs

Response

Security group created successfully

security_group
object
message
string
Example:

"Security group created successfully"