Add Rate Limit Condition

POST /v1/firewall/rate-limits/{uuid}/conditions

Add one match condition to a rate-limit rule without resending the whole rule. A rule counts only the requests its conditions match; a rule with no conditions counts every request to its endpoint. The new condition goes last in the rule's evaluation order.

Conditions use the same vocabulary and validation as firewall conditions. Note the field names: this route takes type and value, while the conditions array of Create / Update Rate Limit Rule takes condition_type and condition_value. A later Update Rate Limit Rule replaces all of the rule's conditions, including ones added here.

The change is announced to the edges in every region as soon as it is saved. Requires the rate_limits:update permission in the active account and the custom_rate_limits entitlement.

Path parameters

uuid string (uuid) Req
The rule's uuid from List Rate Limits.

Deprecated: the legacy integer id is still accepted in the path until the sunset, answered with Deprecation and Sunset headers. Use the uuid.

Request body

type string Req
What to match: source_ip, country, asn, browser, user_agent, endpoint, path, method, header, cookie, protocol or port. Case-insensitive; stored lowercased.
operator string Req
equals, contains, starts_with, ends_with, regex, in, not_in, exists or not_exists, limited per type: source_ip, method, protocol and port take equals / in / not_in; country and asn add exists / not_exists; endpoint and path take every operator except exists / not_exists; browser, user_agent, header and cookie take all of them. Case-insensitive.
value string
What to compare with. Required except for exists / not_exists, which take none. For in / not_in, a comma-separated list (stored joined with ", "). Checked per type: country = ISO 3166-1 alpha-2 code (stored uppercased); asn = AS15169 or 15169 (stored as AS15169); method = an HTTP method (stored uppercased); protocol = http, tcp or udp; port = 1–65535; source_ip = an IP or CIDR; endpoint = an endpoint's uuid; regex = a valid regular expression of at most 1000 characters. Other types accept any non-empty text.
logical_operator string
AND (default) or OR: joins this condition to the next one in the rule. Case-insensitive; stored uppercased.

Response (201 Created)

uuid string (uuid)
The condition's public id — use it in Update and Delete Rate Limit Condition.
rule_uuid string (uuid)
The rule it belongs to.
condition_type, operator string
As stored (lowercased).
condition_value string
The stored form of value.
logical_operator string
AND or OR.
created_at datetime
When the condition was added.

Deprecated: until the sunset this response also carries the legacy integer id and *_id fields. Don't use them; read uuid and the *_uuid fields.

Errors

400 Bad Request
Invalid JSON (Invalid JSON payload); a condition that fails validation — "error": "Bad request" with the reason in detail (e.g. unknown condition type "geo", operator "contains" is not valid for condition type "country", "ZZ" is not a valid ISO-3166-1 alpha-2 country code); or an integer id after the sunset (integer_id_unsupported).
401 Unauthorized
Missing or invalid auth.
403 Forbidden
Your role lacks rate_limits:update; your plan doesn't include custom_rate_limits ("code": "entitlement_required"); or the account is suspended (account_suspended).
404 Not Found
Rate limit rule not found — no such rule in the active account.
409 Conflict
quota_paused: the rule is paused over your plan's limits and is read-only.
415 Unsupported Media Type
The request has no Content-Type: application/json header.
Request — count only requests to /login
curl -X POST "https://api.ngris.com/v1/firewall/rate-limits/019ba36e-e098-77b3-9442-42b30e58d656/conditions" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "type": "path", "operator": "starts_with", "value": "/login", "logical_operator": "AND" }'
Response — 201 Created
{ "uuid": "019bec4f-3378-7c19-bd58-40f1aec544ad", "rule_uuid": "019ba36e-e098-77b3-9442-42b30e58d656", "condition_type": "path", "operator": "starts_with", "condition_value": "/login", "logical_operator": "AND", "created_at": "2026-10-20T09:15:00Z" }