Validation rules – descriptionRead the Validation rules article to learn how each rule works.
Access the validation rule builder
You can open the validation rule builder from:- Campaign builder: Create a validation rule while configuring a campaign. A validation rule is then automatically assigned to the campaign.
- Campaign details: Open an existing campaign and go to the Rules tab. Enable edit mode to create a validation rule or edit an existing one.
- Validation rules in the Campaign hub: Create reusable rules for future use across campaigns.
Build a validation rule
Follow these steps to create or edit a validation rule. The builder looks slightly different when it’s opened in different places.Name the rule
Name your validation rule.If left unchanged, Voucherify uses the default name.
Builder in Validation rulesWhen creating a validation rule in Validation rules section of the dashboard, you can also select Context.Use Context to prepare a rule for validating a specific resource. Context determines which rule types are available and it’s recommended for advanced use cases.
Add rules
Add rules to choose conditions from available categories:
- Audience: Customer segments, loyalty tiers, or customer metadata.
- Products: Specific products, SKUs, collections, or prices of items.
- Prices & quantities: Order value, item quantity, or price thresholds.
- Budget constraints: Campaign spend restrictions, like total order or discount values, number of redemptions per period or customer.
- Redemptions: Limits for redeeming users and API keys.
- Metadata: Limits related to custom attributes covering customer, order, redemption, or custom event metadata.
Context-dependent rulesDepending on the Context defined in the Name the rule step or the dashboard context (campaign builder, earning rule, distribution, and so on), the number and types of rules will vary.
Define operators and conditions
For each rule, select operators such as is, is more than, after, and so on.
Configure junctions and brackets
Combine rules using logical connectors:
- AND: All rules must be met.
- OR: At least one rule must be met.
Set error messages
Add error message to define a custom message returned in the API response when a specific rule is not met.You can also Add fallback error message to the whole validation rule when an error is not specified for a particular rule.
If no validation rule error message and no fallback message are defined, the API response will not include the
error object for validation rule violations in some cases.Using existing validation rules
In the campaign manager and campaign details, you can:- Create a new validation rule
- Select an existing validation rule
- Clone and edit an existing rule
- Remove an assigned validation rule
Validation rules with bundles and product discounts
For bundle campaigns and product discount campaigns, Voucherify automatically creates a validation rule that includes the configuration of the bundle and discounted products.Related features
Validation rules connect to other Voucherify features. Use the resources below to prepare data and apply rules effectively.Customer segments
Customer segments
Customer segments group customers based on shared attributes or behavior. Use segments in Audience rules to target specific customer groups.Segments update dynamically, so a rule that targets a segment always checks the current membership.
Product collections
Product collections
Product collections group products based on attributes or filters. Use collections in Products rules to define required or excluded cart items.Dynamic collections update automatically when products match the defined filters.
Metadata schemas
Metadata schemas
Metadata lets you store custom attributes on customers, orders, products, and redemptions. Use metadata in validation rules to create conditions based on any custom data.Define metadata schemas in Project Settings to ensure consistent data types across rules.
Custom events
Custom events
Custom events track customer actions sent via API. Use custom event metadata in validation rules for distributions or earning rules.For example, trigger a distribution only when a custom event includes specific metadata.
Campaigns and earning rules
Campaigns and earning rules
Validation rules control eligibility for:Each campaign type supports different rule categories based on its context.
Developer setup: Validation Rules API
Developer setup: Validation Rules API
Developers can manage validation rules using the Validation Rules API.The API supports creating rules, assigning them to campaigns, and listing all assignments.

