GET /v1/projects/{project}/rules
List a project's custom bot rules in evaluation order.
curl https://api.botect.ai/v1/projects/123/rules \
-H "Authorization: Bearer YOUR_ACCOUNT_TOKEN"
const res = await fetch('https://api.botect.ai/v1/projects/123/rules', {
headers: { Authorization: `Bearer ${process.env.BOTECT_TOKEN}` },
});
const rules = await res.json();
import os, requests
r = requests.get(
"https://api.botect.ai/v1/projects/123/rules",
headers={"Authorization": f"Bearer {os.environ['BOTECT_TOKEN']}"},
)
rules = r.json()
[
{
"id": 7,
"project_id": 123,
"name": "Protect login from bots",
"expression_source": "score < 30 AND path == "/login" AND NOT verified_bot",
"action": "block",
"is_active": true,
"sort_order": 10,
"created_at": "2026-06-14T10:00:00Z",
"updated_at": "2026-06-14T10:00:00Z"
}
]
Returns the project's custom rules, ordered by sort_order ascending — the same order they're evaluated in.
GET https://api.botect.ai/v1/projects/{project}/rules
Authentication
Account API token via Authorization: Bearer <token>. The project must belong to the token's account. See Authentication.
Path parameters
path
projectinteger
RequiredThe project ID.
Example
Response fields
Each rule object includes:
idinteger
RequiredThe rule ID.
namestring
RequiredHuman-readable label, shown in verdict reasons.
expression_sourcestring
RequiredThe original expression text (for display/edit). The compiled AST is stored internally.
actionstring
Requiredblock, challenge, allow, log, or delay.is_activeboolean
RequiredWhether the rule is evaluated.
sort_orderinteger
RequiredEvaluation order (ascending).
Errors
| Status | code | When |
|---|---|---|
401 | UNAUTHENTICATED | Missing / bad account token |
403 | — | Project does not belong to the token's account |
Was this page helpful?