go-unifi

Create Firewall Policy

Create a new firewall policy on a site.

POST
/v1/sites/{siteId}/firewall/policies

Create a new firewall policy on a site.

X-Api-Key<token>

UniFi API key. Create one under Control Plane → Admins & Users → your admin → Create API Key (requires controller 9.0.114+).

In: header

Path Parameters

siteId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/v1/sites/497f6eca-6276-4993-bfeb-53cbbbba6f08/firewall/policies" \  -H "Content-Type: application/json" \  -d '{    "enabled": true,    "name": "My firewall policy",    "action": {      "type": "string"    },    "source": {      "zoneId": "c3920607-5069-4ac3-ba10-00754e7a8e8b"    },    "destination": {      "zoneId": "c3920607-5069-4ac3-ba10-00754e7a8e8b"    },    "ipProtocolScope": {      "ipVersion": "string"    },    "loggingEnabled": true  }'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "enabled": true,  "name": "My firewall policy",  "description": "A description for my firewall policy",  "index": 0,  "action": {    "type": "string"  },  "source": {    "zoneId": "c3920607-5069-4ac3-ba10-00754e7a8e8b",    "trafficFilter": {      "type": "string"    }  },  "destination": {    "zoneId": "c3920607-5069-4ac3-ba10-00754e7a8e8b",    "trafficFilter": {      "type": "string"    }  },  "ipProtocolScope": {    "ipVersion": "string"  },  "connectionStateFilter": [    "NEW"  ],  "ipsecFilter": "MATCH_ENCRYPTED",  "loggingEnabled": true,  "schedule": {    "mode": "string"  },  "metadata": {    "origin": "string"  }}