Update an auth function rule
const url = 'https://dashboard.quantcdn.io/api/v2/organizations/example/projects/example/rules/auth-function/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"domain":["test-domain.com","www.test-domain.com"],"name":"Test auth function rule","uuid":"123e4567-e89b-12d3-a456-426614174000","weight":100,"disabled":false,"url":["/*"],"country":"country_is","country_is":["US","CA","GB"],"country_is_not":["CN","RU"],"method":"method_is","method_is":["GET","POST"],"method_is_not":["DELETE","PUT"],"ip":"ip_is","ip_is":["192.168.1.0/24","10.0.0.1"],"ip_is_not":["172.16.0.0/12"],"asn":"any","asn_is":["15169"],"asn_is_not":["13335"],"ua":"any","ua_is":["Googlebot"],"ua_is_not":["curl"],"traffic_source":"any","traffic_source_is":["tor-exit"],"traffic_source_is_not":["crawler"],"cookie_name":"session_id","fn_uuid":"7c9e6679-7425-40de-944b-e07fc1f90ae7"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://dashboard.quantcdn.io/api/v2/organizations/example/projects/example/rules/auth-function/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "domain": [ "test-domain.com", "www.test-domain.com" ], "name": "Test auth function rule", "uuid": "123e4567-e89b-12d3-a456-426614174000", "weight": 100, "disabled": false, "url": [ "/*" ], "country": "country_is", "country_is": [ "US", "CA", "GB" ], "country_is_not": [ "CN", "RU" ], "method": "method_is", "method_is": [ "GET", "POST" ], "method_is_not": [ "DELETE", "PUT" ], "ip": "ip_is", "ip_is": [ "192.168.1.0/24", "10.0.0.1" ], "ip_is_not": [ "172.16.0.0/12" ], "asn": "any", "asn_is": [ "15169" ], "asn_is_not": [ "13335" ], "ua": "any", "ua_is": [ "Googlebot" ], "ua_is_not": [ "curl" ], "traffic_source": "any", "traffic_source_is": [ "tor-exit" ], "traffic_source_is_not": [ "crawler" ], "cookie_name": "session_id", "fn_uuid": "7c9e6679-7425-40de-944b-e07fc1f90ae7" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Organization identifier
Project identifier
Rule identifier
Request Bodyrequired
Section titled “Request Bodyrequired”object
Exact hostnames the rule matches, or ‘any’ (the default). Wildcards such as *.example.com are not supported.
Example
[ "test-domain.com", "www.test-domain.com"]Rule name
Example
Test auth function ruleRule UUID
Example
123e4567-e89b-12d3-a456-426614174000Rule order. Must be 0 or greater; lower weights are processed first. If omitted on create, the rule is placed last.
Example
100Whether rule is disabled
Example
falseURL patterns
Example
[ "/*"]Country filter type (country_is, country_is_not, any)
Example
country_isAllowed countries
Example
[ "US", "CA", "GB"]Excluded countries
Example
[ "CN", "RU"]Method filter type (method_is, method_is_not, any)
Example
method_isAllowed HTTP methods
Example
[ "GET", "POST"]Excluded HTTP methods
Example
[ "DELETE", "PUT"]IP filter type (ip_is, ip_is_not, any)
Example
ip_isAllowed IP addresses
Example
[ "192.168.1.0/24", "10.0.0.1"]Excluded IP addresses
Example
[ "172.16.0.0/12"]ASN filter type (asn_is, asn_is_not, any). A PATCH that omits it keeps the current value. Invalid values return 422.
Example
asn_isAllowed AS numbers. Positive integers up to 4294967295, stored as strings. A PATCH replaces the list.
Example
[ "15169"]Excluded AS numbers. Positive integers up to 4294967295, stored as strings. A PATCH replaces the list.
Example
[ "13335"]User agent filter type (ua_is, ua_is_not, any). Invalid values return 422.
Example
ua_isUser agent strings to match. Each item has at most 255 characters. A PATCH replaces the list.
Example
[ "Googlebot"]User agent strings to exclude. Each item has at most 255 characters. A PATCH replaces the list.
Example
[ "curl"]Traffic source filter type (traffic_source_is, traffic_source_is_not, any). Invalid values return 422.
Example
traffic_source_isTraffic sources to match. A PATCH replaces the list.
Example
[ "tor-exit"]Traffic sources to exclude. A PATCH replaces the list.
Example
[ "crawler"]Write name of only_with_cookie: the rule applies only when this cookie is present. Empty string clears it.
Example
session_idUUID of a published function of type edge_auth in this project. A create, or a change of fn_uuid, that names any other function returns 422.
Example
7c9e6679-7425-40de-944b-e07fc1f90ae7Responses
Section titled “Responses”The request has succeeded.
object
Rule name
Rule UUID
Rule ID
Rule order. Must be 0 or greater; lower weights are processed first. If omitted on create, the rule is placed last.
URL patterns
Exact hostnames the rule matches, or ‘any’. Wildcards are not supported.
Whether rule is disabled
Only apply with cookie
HTTP method
Allowed HTTP methods
Excluded HTTP methods
IP address
Allowed IP addresses
Excluded IP addresses
ASN condition type (asn_is, asn_is_not, any)
Allowed AS numbers
Excluded AS numbers
User agent condition type (ua_is, ua_is_not, any)
User agent strings to match
User agent strings to exclude
Traffic source condition type (traffic_source_is, traffic_source_is_not, any)
Traffic sources to match (cloud, vpn, tor-exit, abuser, crawler)
Traffic sources to exclude (cloud, vpn, tor-exit, abuser, crawler)
Country code
Allowed countries
Excluded countries
Rule action
object
UUID of the auth function (type edge_auth) the rule runs
Example
{ "name": "Test redirect rule", "uuid": "123e4567-e89b-12d3-a456-426614174000", "rule_id": "rule-001", "weight": 100, "url": [ "/old-path/*", "/legacy/*" ], "domain": [ "test-domain.com", "www.test-domain.com" ], "disabled": false, "only_with_cookie": "session_id", "method": "GET", "method_is": [ "GET", "POST" ], "method_is_not": [ "DELETE", "PUT" ], "ip": "192.168.1.1", "ip_is": [ "192.168.1.0/24", "10.0.0.1" ], "ip_is_not": [ "172.16.0.0/12" ], "asn": "any", "asn_is": [ "15169", "8075" ], "asn_is_not": [ "13335" ], "ua": "any", "ua_is": [ "Googlebot" ], "ua_is_not": [ "curl" ], "traffic_source": "any", "traffic_source_is": [ "tor-exit" ], "traffic_source_is_not": [ "crawler" ], "country": "US", "country_is": [ "US", "CA", "GB" ], "country_is_not": [ "CN", "RU" ], "action": "redirect", "action_config": { "fn_uuid": "9a7b5c3d-1e2f-4a6b-8c9d-0e1f2a3b4c5d" }}The server could not understand the request due to invalid syntax.
object
Error message
Error flag
Example
{ "message": "The requested resource was not found", "error": true}Access is forbidden.
object
Error message
Error flag
Example
{ "message": "The requested resource was not found", "error": true}Another request is changing this project’s rules, or the rule is managed in code. Retry after a short delay; a managed rule changes only through a rules deploy.
object
Error message
Error flag
Example
{ "message": "The requested resource was not found", "error": true}Fn_uuid does not name a published function of type edge_auth in this project. Checked on create and when fn_uuid changes.
object
Error message
Error flag
Example
{ "message": "The requested resource was not found", "error": true}