Skip to content

Custom Rules

Custom rules let you extend Sieve’s built-in moderation with your own wordlists, regex patterns, and allowlists. Rules are processed in Tier 0 (local Rust/WASM) for near-zero latency.

The operation to perform. Use create to add a new rule.

The rule type. One of:

  • wordlist — Match against a list of exact words or phrases.
  • regex — Match against a regular expression pattern.
  • allowlist — Exempt specific words or phrases from being flagged.

The pattern to match. For wordlist and allowlist, pass an array of strings. For regex, pass a single regex pattern string.

Rule evaluation priority. Higher values are evaluated first. Default is 0.

The action to take when the rule matches. One of flag or block.

Terminal window
curl -X POST https://api.getsieve.dev/v1/config/rules \
-H "Authorization: Bearer mod_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"action": "create",
"type": "wordlist",
"pattern": ["bad_word_1", "bad_word_2", "bad_phrase"],
"priority": 10,
"moderation_action": "block"
}'
const response = await fetch("https://api.getsieve.dev/v1/config/rules", {
method: "POST",
headers: {
"Authorization": "Bearer mod_live_abc123...",
"Content-Type": "application/json",
},
body: JSON.stringify({
action: "create",
type: "wordlist",
pattern: ["bad_word_1", "bad_word_2", "bad_phrase"],
priority: 10,
moderation_action: "block",
}),
});
import requests
response = requests.post(
"https://api.getsieve.dev/v1/config/rules",
headers={"Authorization": "Bearer mod_live_abc123..."},
json={
"action": "create",
"type": "wordlist",
"pattern": ["bad_word_1", "bad_word_2", "bad_phrase"],
"priority": 10,
"moderation_action": "block",
},
)
{
"rule_id": "rule_a1b2c3",
"type": "wordlist",
"pattern": ["bad_word_1", "bad_word_2", "bad_phrase"],
"priority": 10,
"moderation_action": "block",
"created_at": "2026-03-28T12:00:00Z"
}
Terminal window
curl -X POST https://api.getsieve.dev/v1/config/rules \
-H "Authorization: Bearer mod_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"action": "create",
"type": "regex",
"pattern": "\\b(buy|sell)\\s+\\w+\\s+(cheap|free)\\b",
"priority": 5,
"moderation_action": "flag"
}'
const response = await fetch("https://api.getsieve.dev/v1/config/rules", {
method: "POST",
headers: {
"Authorization": "Bearer mod_live_abc123...",
"Content-Type": "application/json",
},
body: JSON.stringify({
action: "create",
type: "regex",
pattern: "\\b(buy|sell)\\s+\\w+\\s+(cheap|free)\\b",
priority: 5,
moderation_action: "flag",
}),
});
import requests
response = requests.post(
"https://api.getsieve.dev/v1/config/rules",
headers={"Authorization": "Bearer mod_live_abc123..."},
json={
"action": "create",
"type": "regex",
"pattern": r"\b(buy|sell)\s+\w+\s+(cheap|free)\b",
"priority": 5,
"moderation_action": "flag",
},
)

To list all rules, send a request with action set to list:

Terminal window
curl -X POST https://api.getsieve.dev/v1/config/rules \
-H "Authorization: Bearer mod_live_abc123..." \
-H "Content-Type: application/json" \
-d '{"action": "list"}'

To delete a rule, send a request with action set to delete and include the rule_id:

Terminal window
curl -X POST https://api.getsieve.dev/v1/config/rules \
-H "Authorization: Bearer mod_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"action": "delete",
"rule_id": "rule_a1b2c3"
}'