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"
}
]
}
'import requests
url = "https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups"
payload = {
"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"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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'
}
]
})
};
fetch('https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups"
payload := strings.NewReader("{\n \"project_id\": \"proj-abc123xyz-v1\",\n \"name\": \"web-servers-sg\",\n \"description\": \"Security group for web servers\",\n \"rules\": [\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 80,\n \"port_range_max\": 80,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTP traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 443,\n \"port_range_max\": 443,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTPS traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 22,\n \"port_range_max\": 22,\n \"remote_ip_prefix\": \"10.0.0.0/8\",\n \"description\": \"Allow SSH from internal network\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"proj-abc123xyz-v1\",\n \"name\": \"web-servers-sg\",\n \"description\": \"Security group for web servers\",\n \"rules\": [\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 80,\n \"port_range_max\": 80,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTP traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 443,\n \"port_range_max\": 443,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTPS traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 22,\n \"port_range_max\": 22,\n \"remote_ip_prefix\": \"10.0.0.0/8\",\n \"description\": \"Allow SSH from internal network\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"proj-abc123xyz-v1\",\n \"name\": \"web-servers-sg\",\n \"description\": \"Security group for web servers\",\n \"rules\": [\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 80,\n \"port_range_max\": 80,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTP traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 443,\n \"port_range_max\": 443,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTPS traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 22,\n \"port_range_max\": 22,\n \"remote_ip_prefix\": \"10.0.0.0/8\",\n \"description\": \"Allow SSH from internal network\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"security_group": {
"id": "sg-abc123xyz-v1",
"account_id": "<string>",
"project_id": "<string>",
"name": "<string>",
"description": "<string>",
"metadata": {},
"rules": [
{
"id": "sgr-abc123xyz-v1",
"security_group_id": "<string>",
"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"
}{
"error": "Validation failed: name is required",
"code": "BAD_REQUEST"
}{
"error": "account_id mismatch between header and path",
"code": "UNAUTHORIZED"
}{
"error": "Internal server error",
"code": "INTERNAL_ERROR"
}Firewall
Create a Security Group
Creates a new security group with optional rules for a project
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"
}
]
}
'import requests
url = "https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups"
payload = {
"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"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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'
}
]
})
};
fetch('https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups"
payload := strings.NewReader("{\n \"project_id\": \"proj-abc123xyz-v1\",\n \"name\": \"web-servers-sg\",\n \"description\": \"Security group for web servers\",\n \"rules\": [\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 80,\n \"port_range_max\": 80,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTP traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 443,\n \"port_range_max\": 443,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTPS traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 22,\n \"port_range_max\": 22,\n \"remote_ip_prefix\": \"10.0.0.0/8\",\n \"description\": \"Allow SSH from internal network\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"proj-abc123xyz-v1\",\n \"name\": \"web-servers-sg\",\n \"description\": \"Security group for web servers\",\n \"rules\": [\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 80,\n \"port_range_max\": 80,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTP traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 443,\n \"port_range_max\": 443,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTPS traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 22,\n \"port_range_max\": 22,\n \"remote_ip_prefix\": \"10.0.0.0/8\",\n \"description\": \"Allow SSH from internal network\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aion.xyz/api/v1/accounts/{accountId}/projects/{projectId}/security-groups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"proj-abc123xyz-v1\",\n \"name\": \"web-servers-sg\",\n \"description\": \"Security group for web servers\",\n \"rules\": [\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 80,\n \"port_range_max\": 80,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTP traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 443,\n \"port_range_max\": 443,\n \"remote_ip_prefix\": \"0.0.0.0/0\",\n \"description\": \"Allow HTTPS traffic\"\n },\n {\n \"direction\": \"ingress\",\n \"protocol\": \"tcp\",\n \"port_range_min\": 22,\n \"port_range_max\": 22,\n \"remote_ip_prefix\": \"10.0.0.0/8\",\n \"description\": \"Allow SSH from internal network\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"security_group": {
"id": "sg-abc123xyz-v1",
"account_id": "<string>",
"project_id": "<string>",
"name": "<string>",
"description": "<string>",
"metadata": {},
"rules": [
{
"id": "sgr-abc123xyz-v1",
"security_group_id": "<string>",
"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"
}{
"error": "Validation failed: name is required",
"code": "BAD_REQUEST"
}{
"error": "account_id mismatch between header and path",
"code": "UNAUTHORIZED"
}{
"error": "Internal server error",
"code": "INTERNAL_ERROR"
}Authorizations
JWT token from authentication service
Headers
Account ID from authentication (must match path accountId)
User ID performing the action
Unique request ID for tracing
Path Parameters
Account external ID
Pattern:
^acct-[a-zA-Z0-9]+-v1$Project external ID
Pattern:
^proj-[a-zA-Z0-9]+-v1$Body
application/json
Project external ID
Example:
"proj-abc123xyz-v1"
Security group name
Required string length:
1 - 255Example:
"web-servers-sg"
Optional description
Example:
"Security group for web server instances"
Initial firewall rules
Show child attributes
Show child attributes
Optional metadata key-value pairs
⌘I
