Korzen
Bot Protection
In these docs

Custom rules

Let your own automation through with a rule: what a rule matches, how your server sends its secret header, and where a rule comes in a decision.

Your own automation (an uptime monitor, a QA runner, a partner's integration) is let through by a custom rule you add on the Custom rules page. A rule matches what you choose: a secret header only your automation sends (the recommended kind), a secret token in its User-Agent, your own addresses, a User-Agent's text, a path, a method, an action, any of them together, or every request. A request a rule matches is answered allow, with decided_by custom_rules and no class or bot score, in monitor and block mode alike; the Decisions page names the rule, and the Custom rules page shows how many requests each rule matched.

Send the rule's header in headers, under the name the rule gives it, in any case: its value is compared with the rule's hashed secret and is never kept, logged or scored, whether it matches or not. For a path that serves several actions, such as a GraphQL or RPC endpoint, send the action's name in action: a rule that names an action matches only a request that names the same one. An address rule reads the ip you send.

An address rule is as safe as where your server reads the address, its ip_from. With peer, cloudflare or last_forwarded, the address is what the connection, Cloudflare or your own proxy saw, and a visitor cannot choose it. With first_forwarded, it is the first entry of X-Forwarded-For, which a visitor can write unless a platform in front of your server replaces the header (Vercel does): anyone who writes your address there matches the rule. With custom, it is as safe as your own resolver. Where a visitor can write the address, let your automation through by a secret header instead. The rule is yours, and Bot Protection applies it as you wrote it.

A rule comes after your choice for each verified bot and before the bot engine, which then judges nothing: the first of your rules that allows or blocks names the decision. It never lifts a required token: on an action you send protected_action for, the token is still asked for, as of any visitor, and in block mode action is then block. A request a rule matches is your rule's, never also your own server's. Your plan holds a number of rules, and of them a number that allow: Free 10 and 2, Starter 25 and 5, Pro 100 and 15, Scale 200 and 30. After a move to a smaller plan, the rules past its room stay listed and match nothing until you drop one above them.

Your server sends a secret header only when its SDK names it: list the header in the SDK's allow-rule headers option, allowRuleHeaders in Node, allow_rule_headers in Python, AllowRuleHeaders in Go and .NET. A rule narrowed to an action matches the action your server sends with the decision.