Traffic Policy Rule Types

GET /v1/traffic-policy/rule-types

Catalog of the rule types you can add to a traffic policy, grouped by the phase they run in. Used by the dashboard's rule editor to offer the right types for each phase.

The list is the same for every account: it is not filtered by plan. Using a type needs its traffic_rule:<type> entitlement (e.g. traffic_rule:rate-limit; see /account/entitlements). The catalog carries no config schema: see Add Rule for each type's config.

Response (200 OK)

A JSON object with one key per phase. Each value is the list of rule types that phase accepts; a type that runs in several phases (e.g. rate-limit, add-headers, edge-function) appears under each of them, with a description for that phase.

on_tcp_connect object[]
Types for new TCP connections: restrict-ips, rate-limit.
on_udp_connect object[]
Types for new UDP sessions: restrict-ips, rate-limit.
on_http_request object[]
Types that run on the HTTP request before it reaches your origin: add-headers, remove-headers, url-rewrite, redirect, custom-response, require-client-cert, jwt-validation, verify-webhook, force-https, webhook, circuit-breaker, api-key-validation, cache-response, validate-body, restrict-ips, rate-limit, cors, set-vars, waf, bot-management, challenge, edge-function.
on_http_response object[]
Types that run on your origin's response: add-headers, remove-headers, custom-error, replace-body, compress-response, image-optimization, edge-function.

Rule type object

type string
Stable slug. Pass it as rule_type when adding a rule, with the phase it is listed under.
name string
Human-readable label.
description string
What the type does in that phase.
Request
curl "https://api.ngris.com/v1/traffic-policy/rule-types" \ -H "X-API-KEY: <your_api_key>"
Python
from ngris import Ngris client = Ngris(api_key="<your_api_key>") catalog = client._get_raw("/traffic-policy/rule-types") for phase, types in catalog.items(): print(phase, ", ".join(t["type"] for t in types))
Response — 200 OK (excerpt)
{ "on_tcp_connect": [ {"type": "restrict-ips", "name": "IP Restriction", "description": "Allow or deny connections from specific IP ranges"}, {"type": "rate-limit", "name": "Rate Limit", "description": "Limit connections per time window"} ], "on_udp_connect": [ {"type": "restrict-ips", "name": "IP Restriction", "description": "Allow or deny packets from specific IP ranges"}, {"type": "rate-limit", "name": "Rate Limit", "description": "Limit packets/sessions per time window"} ], "on_http_request": [ {"type": "add-headers", "name": "Add Headers", "description": "Inject headers into the request"}, {"type": "jwt-validation", "name": "JWT Validation", "description": "Validate JWT tokens in requests"}, {"type": "rate-limit", "name": "Rate Limit", "description": "Limit requests per time window"}, {"type": "edge-function", "name": "Edge Function", "description": "Run a custom JavaScript handler at the edge on the request"} ], "on_http_response": [ {"type": "custom-error", "name": "Custom Error Page", "description": "Replace origin error responses with custom content"}, {"type": "image-optimization", "name": "Image Optimization", "description": "Resize and re-encode image responses (WebP/AVIF) at the edge, cached per variant"} ] }
Was this helpful?
Was this helpful?