Skip to main content

List Firewalls

curl -X GET "https://api.ubicloud.com/project/{project_id}/location/{location}/firewall" \
  -H "Authorization: Bearer $API_KEY"

Path Parameters

project_id
string
required
ID of the project
location
string
required
The Ubicloud location/region

Response

count
integer
required
Total number of firewalls
items
array
required
Array of firewall objects

Get Firewall Details

curl -X GET "https://api.ubicloud.com/project/{project_id}/location/{location}/firewall/{firewall_reference}" \
  -H "Authorization: Bearer $API_KEY"

Response

id
string
required
ID of the firewallPattern: ^fw[0-9a-hj-km-np-tv-z]{24}$
name
string
required
Name of the firewall
location
string
required
Location of the firewall
description
string
required
Description of the firewall
firewall_rules
array
required
List of firewall rules
private_subnets
array
required
List of private subnets

Create Firewall

curl -X POST "https://api.ubicloud.com/project/{project_id}/location/{location}/firewall/{firewall_reference}" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Production firewall"
  }'

Body Parameters

description
string
Description of the firewall

Update Firewall

curl -X PATCH "https://api.ubicloud.com/project/{project_id}/location/{location}/firewall/{firewall_reference}" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Updated production firewall"
  }'

Body Parameters

description
string
required
New description for firewall

Delete Firewall

curl -X DELETE "https://api.ubicloud.com/project/{project_id}/location/{location}/firewall/{firewall_reference}" \
  -H "Authorization: Bearer $API_KEY"
Returns a 204 No Content status code on successful deletion.

Create Firewall Rule

curl -X POST "https://api.ubicloud.com/project/{project_id}/location/{location}/firewall/{firewall_reference}/firewall-rule" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cidr": "192.168.1.0/24",
    "port_range": "80-443",
    "description": "Allow HTTP/HTTPS traffic"
  }'

Body Parameters

cidr
string
required
CIDR or private subnet id or name to allow
port_range
string
Port range to allow
description
string
Description to use for the firewall rule

Attach Subnet to Firewall

curl -X POST "https://api.ubicloud.com/project/{project_id}/location/{location}/firewall/{firewall_reference}/attach-subnet" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "private_subnet_id": "pskkmx0f2vke4h36nk9cm8v8q0"
  }'

Body Parameters

private_subnet_id
string
required
Private subnet id to attach

Detach Subnet from Firewall

curl -X POST "https://api.ubicloud.com/project/{project_id}/location/{location}/firewall/{firewall_reference}/detach-subnet" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "private_subnet_id": "pskkmx0f2vke4h36nk9cm8v8q0"
  }'

Body Parameters

private_subnet_id
string
required
Private subnet id to detach

Build docs developers (and LLMs) love