Skip to main content
There are two ways to get a custom rule:
  • Import a policy. ZeroDrift extracts rules from your document. Each rule has the policy’s import_id and shows on that policy’s page in Policy Studio. See Import a Policy.
  • Create one rule through the API with Create Custom Rule (POST /api/policies/rules). The request has no policy field, so the rule belongs to no policy and has no import_id.
This page covers the second kind.

Where the rule appears

In ZeroDrift Command, open Policy Studio. Rules that belong to no policy are listed under API-created rules, below Custom Policies. They are not listed under any policy.
Policy Studio API-created rules section with one rule: AI Assisted, Don't send, Created through the API, Active
The section’s help text reads:
These rules are enforced but don’t belong to any policy, so they can’t be edited here. You can delete one here, or manage them through the API.
If your role can’t delete rules, the second sentence reads “Manage them through the API.” instead. The table has five columns. Policy Studio shows the labels in capitals.

Source

Enforcement

An active rule in this section is a custom rule like any other. Untrained custom rules run on Max (anchor_3_0_max). A Max request with no validation_scope checks them all. If you supply a scope, only the selected rules run; naming a custom rule’s rule_id in validation_scope.rules upgrades Flagship to Max. A Flagship request with no scope does not check them. See Enforce Content.

Edit the rule

These rules can’t be edited in Policy Studio. Use the API: The rule’s type can’t be changed. To change it, delete the rule and create a new one.

Delete the rule

Owners, Admins, and Developers see a trash icon at the end of each row. Reviewers and Members don’t. Select the trash icon to open Delete Rule. It asks you to confirm: “Are you sure you want to delete the rule “<name>”? This action cannot be undone.” If the rule is active, the dialog adds “It is active, so messages will stop being checked against it.” before the last sentence. The trash icon calls the same endpoint as Delete Custom Rule (DELETE /api/policies/rules/{rule_id}), so the same 409 refusals apply. If the delete is refused, the dialog stays open and the reason appears in a notification.

When the section is hidden

The API-created rules section does not appear when:
  • your account has no custom rules outside a policy, or
  • Policy Studio can’t reach the rules service.
When the rules service can’t be reached, policy pages also show this notice: “Couldn’t check live rule state. Showing the saved values, which may not include changes made through the API.”

Rules deleted through the API

If you delete a rule that belongs to a policy with DELETE /api/policies/rules/{rule_id}, the policy’s page in Policy Studio still lists it, greyed out, with a Deleted via API badge. The rule no longer runs.

Next

Create Custom Rule

Request fields for AI_SIGNAL, REGEX, and REQUIRE_NEAR rules.

Import a Policy

Turn a policy document into rules that belong to a policy.