Create Traffic Policy
Create an empty traffic policy. After creation, attach rules via POST /v1/policies/{policy_id}/rules — the policy serves as a container with priority and on/off control; the rules do the actual work.
Plan-gated at the feature level: requires the traffic_policies entitlement. Per-rule-type gating is enforced when you add rules.
Path parameters
uuid string (uuid) Req
Endpoint UUID.
Request body
name string Req
Policy name.
description string
Free-form description.
enabled boolean
true activates the policy at creation time. false = saved but skipped during evaluation. Default false.priority int
Evaluation order — lower runs first. Default
0.Response (201 Created)
The newly-created policy with assigned id. The rules array is omitted on create (it is only populated when fetching a policy that already has rules) — see Get / List.
Errors
400 Bad Request
Unknown body fields (strict decoding), missing
name.401 Unauthorized
Missing auth.
403 Forbidden
Plan doesn't include
traffic_policies.404 Not Found
Endpoint doesn't exist.
Request
curl -X POST "https://api.ngris.com/v1/endpoints/<uuid>/policies" \
-H "X-API-KEY: <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "rate-limit",
"description": "100 req/sec per client IP",
"priority": 10,
"enabled": true
}'
Python
from ngris import Ngris
client = Ngris(api_key="<your_api_key>")
policy = client.traffic_policies.create("<endpoint_uuid>", {
"name": "rate-limit",
"priority": 10,
"enabled": True,
})
Response — 201 Created
{
"id": 1,
"endpoint_id": 184,
"name": "rate-limit",
"description": "100 req/sec per client IP",
"enabled": true,
"priority": 10,
"created_at": "2026-04-29T13:00:00Z",
"updated_at": "2026-04-29T13:00:00Z"
}