Skip to main content
GET
/
v1
/
validation-rules
/
{validationRuleId}
Get Validation Rule
curl --request GET \
  --url https://{cluster}.voucherify.io/v1/validation-rules/{validationRuleId} \
  --header 'Authorization: Bearer <token>' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>'
{
  "id": "val_TU4de3EP4dlL",
  "name": "Order is less than $40",
  "rules": {
    "1": {
      "name": "order.amount",
      "property": null,
      "conditions": {
        "$less_than": [
          4000
        ]
      },
      "rules": {}
    },
    "logic": "1"
  },
  "applicable_to": {
    "excluded": [],
    "included": [],
    "included_all": false
  },
  "created_at": "2022-08-11T16:42:13.630Z",
  "type": "advanced",
  "context_type": "reward_assignment.pay_with_points",
  "object": "validation_rules"
}

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

validationRuleId
string
required

A unique validation rule ID.

Example:

"val_TU4de3EP4dlL"

Response

200 - application/json

Returns the validation rule object.

Response body schema for GET v1/validation-rules/{validationRuleId}. This is an object representing a request validation rule. This is an object representing a response validation rule.

name
string
required

Custom, unique name for set of validation rules.

Example:

"Business Validation Rule"

rules
object
required

Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from 1. The values are objects containing the rule conditions.

applicable_to
object
required
type
enum<string>
default:expression
required

Type of validation rule.

Available options:
expression,
basic,
advanced,
complex
context_type
enum<string>
default:global
required

Validation rule context type.

Context TypeDefinition
earning_rule.order.paid
earning_rule.custom_event
earning_rule.customer.segment.entered
campaign.discount_coupons
campaign.discount_coupons.discount.apply_to_order
campaign.discount_coupons.discount.apply_to_items
campaign.discount_coupons.discount.apply_to_items_proportionally
campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity
campaign.discount_coupons.discount.fixed.apply_to_items
campaign.gift_vouchers
campaign.gift_vouchers.gift.apply_to_order
campaign.gift_vouchers.gift.apply_to_items
campaign.referral_program
campaign.referral_program.discount.apply_to_order
campaign.referral_program.discount.apply_to_items
campaign.referral_program.discount.apply_to_items_proportionally
campaign.referral_program.discount.apply_to_items_proportionally_by_quantity
campaign.referral_program.discount.fixed.apply_to_items
campaign.promotion
campaign.promotion.discount.apply_to_order
campaign.promotion.discount.apply_to_items
campaign.promotion.discount.apply_to_items_proportionally
campaign.promotion.discount.apply_to_items_proportionally_by_quantity
campaign.promotion.discount.fixed.apply_to_items
campaign.loyalty_program
voucher.discount_voucher
voucher.discount_voucher.discount.apply_to_order
voucher.discount_voucher.discount.apply_to_items
voucher.discount_voucher.discount.apply_to_items_proportionally
voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity
voucher.discount_voucher.discount.fixed.apply_to_items
voucher.gift_voucher
voucher.gift_voucher.gift.apply_to_order
voucher.gift_voucher.gift.apply_to_items
voucher.loyalty_card
distribution.custom_event
reward_assignment.pay_with_points
global
Available options:
earning_rule.order.paid,
earning_rule.custom_event,
earning_rule.customer.segment.entered,
earning_rule.customer.tier.joined,
earning_rule.customer.tier.left,
earning_rule.customer.tier.upgraded,
earning_rule.customer.tier.downgraded,
earning_rule.customer.tier.prolonged,
campaign.discount_coupons,
campaign.discount_coupons.discount.apply_to_order,
campaign.discount_coupons.discount.apply_to_items,
campaign.discount_coupons.discount.apply_to_items_proportionally,
campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity,
campaign.discount_coupons.discount.apply_to_items_by_quantity,
campaign.discount_coupons.discount.fixed.apply_to_items,
campaign.discount_coupons.discount.percent.apply_to_items,
campaign.gift_vouchers,
campaign.gift_vouchers.gift.apply_to_order,
campaign.gift_vouchers.gift.apply_to_items,
campaign.referral_program,
campaign.referral_program.discount.apply_to_order,
campaign.referral_program.discount.apply_to_items,
campaign.referral_program.discount.apply_to_items_proportionally,
campaign.referral_program.discount.apply_to_items_proportionally_by_quantity,
campaign.referral_program.discount.apply_to_items_by_quantity,
campaign.referral_program.discount.fixed.apply_to_items,
campaign.referral_program.discount.percent.apply_to_items,
campaign.promotion,
campaign.promotion.discount.apply_to_order,
campaign.promotion.discount.apply_to_items,
campaign.promotion.discount.apply_to_items_proportionally,
campaign.promotion.discount.apply_to_items_proportionally_by_quantity,
campaign.promotion.discount.apply_to_items_by_quantity,
campaign.promotion.discount.fixed.apply_to_items,
campaign.promotion.discount.percent.apply_to_items,
campaign.loyalty_program,
voucher.discount_voucher,
voucher.discount_voucher.discount.apply_to_order,
voucher.discount_voucher.discount.apply_to_items,
voucher.discount_voucher.discount.apply_to_items_proportionally,
voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity,
voucher.discount_voucher.discount.apply_to_items_by_quantity,
voucher.discount_voucher.discount.fixed.apply_to_items,
voucher.discount_voucher.discount.percent.apply_to_items,
voucher.gift_voucher,
voucher.gift_voucher.gift.apply_to_order,
voucher.gift_voucher.gift.apply_to_items,
voucher.loyalty_card,
distribution.custom_event,
distribution.order.paid,
distribution.order.created,
distribution.order.canceled,
distribution.order.updated,
reward_assignment.pay_with_points,
global
id
string
required

Unique validation rule ID.

Example:

"val_eR1c41hu0vUU"

created_at
string<date-time>
required

Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format.

Example:

"2022-03-23T07:44:00.444Z"

object
string
default:validation_rules
required

The type of the object represented by JSON. This object stores information about the validation rule.

bundle_rules
object

Contains all the definitions for the bundle rules. It is a set of key value pairs representing the rules and logic between them. The keys are numbered consecutively beginning from 1. The values are objects containing the rule conditions.

While updating with the PUT method, you can pass "bundle_rules": null to delete the configuration; in the response, an empty object is then returned.

error
object

Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.

updated_at
string<date-time>

Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format.

Example:

"2022-04-26T08:35:54.960Z"

assignments_count
integer

The number of instances the validation rule has been assigned to different types of redeemables.

I