Create Firewall Policy

POST /v1/firewall/policies

Create a new firewall policy (allow/block). The policy starts with no conditions — attach them via POST /v1/policies/{id}/conditions. A policy with zero conditions matches every request, so you typically configure conditions before flipping enabled to true.

Plan-gated: requires the firewall_policies entitlement.

Request body

name string Req
Policy name.
description string
Free-form description.
action string
allow (default) or block. Anything else returns 400.
priority int
Evaluation order. Lower first. Default 100.
enabled boolean
Default true. Set false while you build out conditions, then flip on.

Firewall policies are always account-scoped — they apply to every endpoint owned by the caller. There is no per-endpoint scope and no per-policy custom block status; block-action policies use the user's configured custom firewall error template if active, otherwise the platform default (HTTP 403).

Response (201 Created)

The newly-created policy with assigned id (UUID).

Errors

400 Bad Request
Missing name, invalid action, or invalid JSON.
401 Unauthorized
Missing auth.
403 Forbidden
Plan doesn't include firewall_policies.
Request — block list
curl -X POST "https://api.ngris.com/v1/firewall/policies" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "name": "block-known-bad-ips", "action": "block", "priority": 10, "enabled": false }'
Python
from ngris import Ngris client = Ngris(api_key="<your_api_key>") policy = client.firewall.create_policy({ "name": "block-known-bad-ips", "action": "block", "priority": 10, "enabled": False, }) # Then attach conditions and flip enabled=True
Response — 201 Created
{ "id": "abc-123", "user_id": 1024, "name": "block-known-bad-ips", "action": "block", "priority": 10, "enabled": false, "created_at": "2026-04-29T13:00:00Z", "updated_at": "2026-04-29T13:00:00Z" }
On this page
Create Firewall Policy
Iris