Skip to main content
POST
/
v1
/
regions
/
{region}
/
compute
/
firewalls
Create firewall
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: '<string>',
    rules: [
      {
        priority: 123,
        direction: 'ingress',
        action: 'allow',
        protocol: '<string>',
        source: '<string>',
        destination: '<string>',
        ports: '<string>'
      }
    ],
    networkId: '<string>'
  })
};

fetch('https://api.example.com/v1/regions/{region}/compute/firewalls', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "success": true,
  "data": {
    "id": "<string>",
    "name": "<string>",
    "rules": [
      {
        "priority": 123,
        "direction": "ingress",
        "action": "allow",
        "protocol": "TCP",
        "source": "<string>",
        "destination": "<string>",
        "ports": "<string>"
      }
    ],
    "status": "active",
    "networkId": "<string>",
    "createdAt": "2023-11-07T05:31:56Z"
  }
}

Path Parameters

region
string
required

Region identifier

Body

application/json
name
string
required
rules
object[]
required
networkId
string | null

Response

201 - application/json

Firewall created

success
enum<boolean>
Available options:
true
data
object

Network firewall / security policy