Update Firewall Policy

PUT /v1/firewall/policies/{uuid}

Edit the policy: name, description, action, priority, enabled flag — and, with conditions, replace its conditions in the same transaction. Without conditions this call doesn't touch them; single conditions are also managed via the /policies/{uuid}/conditions endpoints.

Changes take effect on the next request — no caching window. Toggling enabled is the right knob for staged rollouts: configure conditions, verify on a non-production endpoint, then flip true.

Path parameters

uuid string (uuid) Req
The policy's uuid (= its id) from /firewall/policies.

Request body

Same fields as create: name, description, action, priority, enabled, conditions. Pass any subset; omitted fields keep their existing value. (A non-empty name, a non-nil description, an action of allow/block/challenge, a non-negative priority, or an enabled flag each overwrite the current value when present.)

conditions (array of {type, operator, value, logical_operator?}, as in Add Firewall Condition) replaces all the policy's conditions, in that order, in the same transaction as the other fields. All are validated first; if one is refused nothing changes — the old conditions stay. [] removes every condition (the policy then matches every request); omit the field (or send null) to keep them.

Response (200 OK)

The updated policy, in the list-entry shape (id, uuid, user_uuid, account_uuid, name, description, action, priority, enabled, created_at, updated_at), with its conditions in full (omitted when it has none). Its match statistics are the ones its list row shows, over the same 7-day window: hit_count, and last_matched / hits_daily (both omitted when the policy hasn't matched in the window). Best-effort, as on the list.

Deprecated: until the sunset this response also carries the legacy integer user_id and account_id fields. Don't use them; read user_uuid and account_uuid.

Errors

400 Bad Request
Invalid action, an invalid condition (named: "Condition 2: …", field conditions[1].value; nothing is changed), missing fields, invalid JSON.
401 Unauthorized
Missing auth.
403 Forbidden
Plan doesn't include firewall_policies.
404 Not Found
Policy doesn't exist, belongs to another account, or the path segment isn't a uuid.
Request
curl -X PUT "https://api.ngris.com/v1/firewall/policies/019c32cb-35d7-786f-b2c5-d108951e23d8" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "priority": 5, "conditions": [ {"type": "source_ip", "operator": "in", "value": "203.0.113.0/24", "logical_operator": "OR"}, {"type": "country", "operator": "in", "value": "RU, KP"} ] }'
Python
from ngris import Ngris client = Ngris(api_key="<your_api_key>") client.firewall.update_policy("019c32cb-35d7-786f-b2c5-d108951e23d8", { "enabled": True, "priority": 5, "conditions": [ {"type": "source_ip", "operator": "in", "value": "203.0.113.0/24", "logical_operator": "OR"}, {"type": "country", "operator": "in", "value": "RU, KP"}, ], })
Response — 200 OK
{ "id": "019c32cb-35d7-786f-b2c5-d108951e23d8", "uuid": "019c32cb-35d7-786f-b2c5-d108951e23d8", "user_uuid": "019a52c2-ca1e-78ba-ab5c-50362cc29134", "account_uuid": "019a68b9-1a79-7820-a884-41f554aba6bd", "name": "block-known-bad-ips", "action": "block", "priority": 5, "enabled": true, "created_at": "2026-04-29T13:00:00Z", "updated_at": "2026-04-29T14:10:00Z", "conditions": [ {"id": "019c32cb-35d8-7a41-9e2f-5b7c1d0e4f21", "uuid": "019c32cb-35d8-7a41-9e2f-5b7c1d0e4f21", "policy_id": "019c32cb-35d7-786f-b2c5-d108951e23d8", "policy_uuid": "019c32cb-35d7-786f-b2c5-d108951e23d8", "condition_type": "source_ip", "operator": "in", "condition_value": "203.0.113.0/24", "logical_operator": "OR", "created_at": "2026-04-29T14:10:00Z"}, {"id": "019c32cb-35d8-7a42-8b1e-3c6d2a9f0e12", "uuid": "019c32cb-35d8-7a42-8b1e-3c6d2a9f0e12", "policy_id": "019c32cb-35d7-786f-b2c5-d108951e23d8", "policy_uuid": "019c32cb-35d7-786f-b2c5-d108951e23d8", "condition_type": "country", "operator": "in", "condition_value": "RU, KP", "logical_operator": "AND", "created_at": "2026-04-29T14:10:00Z"} ], "hit_count": 42, "last_matched": "2026-04-29T12:58:10Z", "hits_daily": [3, 5, 8, 4, 6, 9, 7] }
Was this helpful?
On this page
Update Firewall Policy
Was this helpful?