Create Custom Rule
Custom Policies
Create Custom Rule
Create a customer-owned AI_SIGNAL, REGEX, or REQUIRE_NEAR rule
POST
Create Custom Rule
Create a custom rule that belongs to your account. Supports
AI_SIGNAL,
REGEX, and REQUIRE_NEAR rule types. Requires a full-access API key.
Created rules start active and run on subsequent validations for your API key.
Request Body
The body is a discriminated union ontype. Shared fields:
string
required
Human-readable rule name
string
required
AI_SIGNAL, REGEX, or REQUIRE_NEARstring
required
fix or flagstring
required
do_not_send or send_with_cautionstring
Editable suggested replacement or warning guidance. Omit to allow warning
fallback;
null clears and suppresses warning fallback.string
Optional remediation guidance
AI_SIGNAL fields
string
required
AI instruction for the signal
array
required
Keyword gate (at least one string)
string
default:"document"
sentence, paragraph, or documentREGEX fields
string
required
Raw Python regex (max 512 chars)
REQUIRE_NEAR fields
string
required
Raw Python regex for the anchor pattern (max 512 chars)
array
required
Raw Python regex patterns checked near the anchor
integer
default:"100"
Character distance around the anchor
string
default:"either"
before, after, or eitherboolean
default:"false"
Case-insensitive matching
string
default:"document"
document or pageinteger
default:"1"
Minimum near-pattern hits required
Response
Returns the created custom rule (CustomRuleResponse), including rule_id,
source: "custom", active, timestamps, and type-specific fields.

