{
  "openapi": "3.1.0",
  "info": {
    "title": "Events - Events bus_val_rule",
    "version": "2024-01-01",
    "description": ""
  },
  "paths": {},
  "components": {
    "schemas": {
      "EventBusValRuleCreatedData": {
        "title": "Event Business Validation Rule Created",
        "type": "object",
        "description": "Event data object schema for `bus_val_rule.created`.",
        "properties": {
          "rule": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookValidationRule"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "example": "2024-01-01T11:11:11.111Z",
            "description": "Timestamp representing the date and time when the validation rule was created in the ISO 8601 format.",
            "format": "date-time"
          }
        }
      },
      "EventBusValRuleUpdatedData": {
        "title": "Event Business Validation Rule Updated",
        "type": "object",
        "description": "Event data object schema for `bus_val_rule.updated`.",
        "properties": {
          "rule": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookValidationRule"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "type": "string",
            "example": "2024-01-01T11:11:11.111Z",
            "description": "Timestamp representing the date and time when the validation rule was updated in the ISO 8601 format.",
            "format": "date-time"
          }
        }
      },
      "EventBusValRuleAssignmentCreatedData": {
        "title": "Event Business Validation Rule Assignment Created",
        "type": "object",
        "description": "Event data object schema for `bus_val_rule.assignment.created`.",
        "properties": {
          "rule": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookValidationRule"
              },
              {
                "type": "null"
              }
            ]
          },
          "assignment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BusValRuleAssignment"
              },
              {
                "type": "null"
              }
            ]
          },
          "voucher": {
            "$ref": "#/components/schemas/SimpleVoucher"
          },
          "campaign": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SimpleCampaign"
              },
              {
                "type": "null"
              }
            ]
          },
          "distribution": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BusValRuleAssignmentDistribution"
              },
              {
                "type": "null"
              }
            ]
          },
          "promotion_tier": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SimplePromotionTier"
              },
              {
                "type": "null"
              }
            ]
          },
          "earning_rule": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SimpleEarningRule"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "EventBusValRuleAssignmentDeletedData": {
        "title": "Event Business Validation Rule Assignment Deleted",
        "type": "object",
        "description": "Event data object schema for `bus_val_rule.assignment.deleted`.",
        "properties": {
          "rule": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookValidationRule"
              },
              {
                "type": "null"
              }
            ]
          },
          "assignment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BusValRuleAssignment"
              },
              {
                "type": "null"
              }
            ]
          },
          "voucher": {
            "$ref": "#/components/schemas/SimpleVoucher"
          },
          "campaign": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SimpleCampaign"
              },
              {
                "type": "null"
              }
            ]
          },
          "distribution": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BusValRuleAssignmentDistribution"
              },
              {
                "type": "null"
              }
            ]
          },
          "promotion_tier": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SimplePromotionTier"
              },
              {
                "type": "null"
              }
            ]
          },
          "earning_rule": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SimpleEarningRule"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "EventBusValRuleDeletedData": {
        "title": "Event Business Validation Rule Deleted",
        "type": "object",
        "description": "Event data object schema for `bus_val_rule.deleted`.",
        "properties": {
          "rule": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookValidationRule"
              },
              {
                "type": "null"
              }
            ]
          },
          "deleted_at": {
            "type": "string",
            "example": "2024-01-01T11:11:11.111Z",
            "description": "Timestamp representing the date and time when the validation rule was deleted in the ISO 8601 format.",
            "format": "date-time"
          }
        }
      },
      "WebhookValidationRule": {
        "title": "Validation Rule",
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookValidationRuleBase"
          },
          {
            "title": "Validation Rule",
            "type": "object",
            "description": "This is an object representing a response validation rule.",
            "properties": {
              "id": {
                "type": "string",
                "example": "val_eR1c41hu0vUU",
                "description": "Unique validation rule ID."
              },
              "created_at": {
                "type": "string",
                "example": "2022-03-23T07:44:00.444Z",
                "description": "Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format.",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "example": "2022-04-26T08:35:54.960Z",
                "description": "Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format.",
                "format": "date-time"
              },
              "assignments_count": {
                "description": "The number of instances the validation rule has been assigned to different types of redeemables.",
                "type": "integer"
              },
              "object": {
                "type": "string",
                "default": "validation_rules",
                "description": "The type of the object represented by JSON. This object stores information about the validation rule."
              }
            },
            "required": [
              "id",
              "name",
              "rules",
              "applicable_to",
              "created_at",
              "type",
              "context_type",
              "object"
            ]
          }
        ]
      },
      "BusValRuleAssignment": {
        "title": "Business Validation Rule Assignment",
        "description": "Assignments of business validation rule",
        "example": {
          "id": "asgm_LnY1g7UNFA9KyDrD",
          "rule_id": "val_3gPNA6SnH4ae",
          "related_object_id": "camp_CZOnEGiZfwIKWmSjhIoIT7Ol",
          "related_object_type": "campaign",
          "object": "validation_rules_assignment",
          "validation_status": "PARTIALLY_VALID",
          "validation_omitted_rules": [
            "1"
          ]
        },
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier for a assignment"
          },
          "rule_id": {
            "type": "string",
            "description": "The unique identifier for a rule"
          },
          "related_object_id": {
            "type": "string",
            "description": "The unique identifier for a related object"
          },
          "related_object_type": {
            "type": "string",
            "description": "The type of related object"
          },
          "created_at": {
            "type": "string",
            "description": "Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.",
            "example": "2022-03-09T11:19:04.819Z",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "description": "Timestamp representing the date and time when the object was last updated in ISO 8601 format.",
            "example": "2022-03-09T11:19:04.819Z",
            "format": "date-time"
          },
          "object": {
            "type": "string",
            "description": "The type of the object represented by JSON.",
            "default": "validation_rules_assignment",
            "enum": [
              "validation_rules_assignment"
            ]
          },
          "validation_status": {
            "type": "string",
            "description": "The validation status of the assignment",
            "enum": [
              "VALID",
              "PARTIALLY_VALID",
              "INVALID"
            ]
          },
          "validation_omitted_rules": {
            "type": "array",
            "description": "The list of omitted rules",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "rule_id",
          "related_object_id",
          "related_object_type",
          "object"
        ]
      },
      "SimpleVoucher": {
        "type": "object",
        "title": "Simple Voucher",
        "description": "Simplified voucher data.",
        "properties": {
          "id": {
            "type": "string",
            "description": "A unique identifier that represents the voucher assigned by Voucherify."
          },
          "code": {
            "type": "string",
            "description": "Voucher code."
          },
          "gift": {
            "description": "Gift object response.",
            "allOf": [
              {
                "$ref": "#/components/schemas/Gift"
              }
            ]
          },
          "discount": {
            "$ref": "#/components/schemas/Discount"
          },
          "loyalty_card": {
            "description": "Defines the loyalty card details.",
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/SimpleLoyaltyCard"
              }
            ]
          },
          "type": {
            "type": "string",
            "description": "Type of the voucher.",
            "enum": [
              "DISCOUNT_VOUCHER",
              "LOYALTY_CARD",
              "GIFT_VOUCHER"
            ]
          },
          "campaign": {
            "type": "string",
            "description": "Campaign name."
          },
          "campaign_id": {
            "type": "string",
            "description": "Campaign unique ID."
          },
          "is_referral_code": {
            "type": "boolean",
            "description": "Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`."
          },
          "holder_id": {
            "type": "string",
            "example": "cust_eWgXlBBiY6THFRJwX45Iakv4",
            "description": "Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify."
          },
          "referrer_id": {
            "type": "string",
            "description": "Unique identifier of the referrer assigned by Voucherify.",
            "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix"
          },
          "category_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Unique identifier of the category that this voucher belongs to.",
            "example": "cat_0b6152ce12414820dc"
          },
          "categories": {
            "type": "array",
            "description": "Contains details about the category.",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          },
          "active": {
            "type": "boolean",
            "description": "Shows whether the voucher is on or off. `true` indicates an *active* voucher and `false` indicates an *inactive* voucher."
          },
          "created_at": {
            "type": "string",
            "example": "2021-12-22T10:13:06.487Z",
            "description": "Timestamp representing the date and time when the order was created in the ISO 8601 format.",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "example": "2024-01-01T11:11:11.111Z",
            "description": "Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.",
            "format": "date-time"
          },
          "redemption": {
            "type": "object",
            "description": "Defines the redemption limits on vouchers.",
            "properties": {
              "quantity": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "How many times a voucher can be redeemed. A `null` value means unlimited."
              },
              "redeemed_quantity": {
                "type": "integer",
                "example": 1,
                "description": "How many times a voucher has already been redeemed."
              },
              "redeemed_points": {
                "type": "integer",
                "description": "Total loyalty points redeemed."
              }
            },
            "required": [
              "quantity",
              "redeemed_quantity"
            ]
          },
          "start_date": {
            "type": "string",
            "example": "2021-12-01T00:00:00.000Z",
            "format": "date-time",
            "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date."
          },
          "expiration_date": {
            "type": "string",
            "example": "2021-12-31T00:00:00.000Z",
            "format": "date-time",
            "description": "Expiration timestamp defines when the code expires in ISO 8601 format.  Voucher is *inactive after* this date."
          },
          "metadata": {
            "type": "object",
            "description": "A set of custom key/value pairs that you can attach to a voucher. The metadata object stores all custom attributes assigned to the voucher."
          },
          "object": {
            "type": "string",
            "description": "The type of the object represented by JSON.",
            "default": "voucher",
            "enum": [
              "voucher"
            ]
          }
        },
        "required": [
          "type",
          "code",
          "created_at",
          "object"
        ]
      },
      "SimpleCampaign": {
        "title": "Simple Campaign",
        "type": "object",
        "description": "Simplified campaign data.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Campaign ID."
          },
          "name": {
            "type": "string",
            "description": "Campaign name."
          },
          "campaign_type": {
            "type": "string",
            "description": "Type of campaign."
          },
          "type": {
            "type": "string",
            "description": "Defines whether the campaign can be updated with new vouchers after campaign creation or if the campaign consists of generic (standalone) vouchers.\n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria\n-  `STATIC`: vouchers need to be manually published\n- `STANDALONE`: campaign for single vouchers",
            "enum": [
              "AUTO_UPDATE",
              "STATIC",
              "STANDALONE"
            ]
          },
          "is_referral_code": {
            "type": "boolean",
            "description": "Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`."
          },
          "voucher": {
            "$ref": "#/components/schemas/SimpleCampaignVoucher"
          },
          "referral_program": {
            "$ref": "#/components/schemas/ReferralProgram"
          },
          "auto_join": {
            "type": "boolean",
            "description": "Indicates whether customers will be able to auto-join the campaign if any earning rule is fulfilled."
          },
          "join_once": {
            "type": "boolean",
            "description": "If this value is set to `true`, customers will be able to join the campaign only once. It is always `false` for generic (standalone) vouchers campaigns and it cannot be changed in them. It is always `true` for loyalty campaigns and it cannot be changed in them."
          },
          "active": {
            "type": "boolean",
            "description": "Indicates whether the campaign is active."
          },
          "category_id": {
            "type": [
              "null",
              "string"
            ],
            "description": "The unique category ID that this campaign belongs to."
          },
          "category": {
            "type": "string",
            "description": "Unique category name."
          },
          "categories": {
            "type": "array",
            "description": "Contains details about the category.",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          },
          "metadata": {
            "type": "object",
            "description": "A set of custom key/value pairs that you can attach to a campaign. The metadata object stores all custom attributes assigned to the campaign."
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is inactive *before* this date. ",
            "example": "2022-09-20T00:00:00.000Z"
          },
          "expiration_date": {
            "type": "string",
            "format": "date-time",
            "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format.  Campaign is inactive *after* this date.",
            "example": "2022-09-30T00:00:00.000Z"
          },
          "description": {
            "type": "string",
            "description": "An optional field to keep extra textual information about the campaign such as a campaign description and details."
          },
          "created_at": {
            "type": "string",
            "example": "2024-01-01T11:11:11.111Z",
            "description": "Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "example": "2024-01-01T11:11:11.111Z",
            "description": "Timestamp representing the date and time when the campaign was updated in the ISO 8601 format.",
            "format": "date-time"
          },
          "object": {
            "type": "string",
            "default": "campaign",
            "enum": [
              "campaign"
            ],
            "description": "The type of the object represented by JSON. This object stores information about the campaign."
          }
        }
      },
      "BusValRuleAssignmentDistribution": {
        "type": "object",
        "description": "Assign a validation rule to a distribution.",
        "title": "Distribution",
        "properties": {
          "distribution": {
            "type": "string",
            "description": "Unique identifier of the distribution to which the validation rule is assigned.",
            "example": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd"
          }
        }
      },
      "SimplePromotionTier": {
        "title": "Simple Promotion Tier",
        "type": "object",
        "description": "This is an object representing a simple promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone.",
        "properties": {
          "id": {
            "type": "string",
            "example": "promo_63fYCt81Aw0h7lzyRkrGZh9p",
            "description": "Unique promotion tier ID."
          },
          "name": {
            "type": "string",
            "description": "Name of the promotion tier."
          },
          "banner": {
            "type": "string",
            "description": "Text to be displayed to your customers on your website."
          },
          "campaign": {
            "type": "object",
            "description": "Contains details about promotion tier's parent campaign.",
            "properties": {
              "id": {
                "type": "string",
                "description": "Unique campaign ID."
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "A set of custom key/value pairs that you can attach to a promotion tier. The metadata object stores all custom attributes assigned to the promotion tier."
          }
        }
      },
      "SimpleEarningRule": {
        "title": "Simple Earning Rule",
        "type": "object",
        "description": "Simplified earning rule data.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique earning rule identifier assigned by Voucherify."
          },
          "campaign_id": {
            "type": "string",
            "description": "Unique identifier of the parent campaign assigned by Voucherify."
          },
          "validation_rule_id": {
            "type": "string",
            "description": "A unique validation rule identifier assigned by Voucherify."
          },
          "parameters": {
            "type": "object",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EarningRuleObjectOrderPaid"
              },
              {
                "$ref": "#/components/schemas/EarningRuleProportionalCustomEvent"
              },
              {
                "$ref": "#/components/schemas/EarningRuleObjectEnteredSegment"
              },
              {
                "$ref": "#/components/schemas/EarningRuleObjectTier"
              }
            ]
          },
          "automation_id": {
            "type": "string",
            "description": "For internal use by Voucherify."
          },
          "active": {
            "type": "boolean",
            "description": "A flag to toggle the earning rule on or off."
          },
          "source": {
            "type": "object",
            "required": [
              "object_id",
              "object_type"
            ],
            "description": "Contains the custom earning rule name and parent campaign.",
            "properties": {
              "banner": {
                "type": "string",
                "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard."
              },
              "object_id": {
                "type": "string",
                "description": "A unique campaign identifier assigned by Voucherify."
              },
              "object_type": {
                "type": "string",
                "description": "Defines the object associated with the earning rule. Defaults to `campaign`.",
                "default": "campaign",
                "enum": [
                  "campaign"
                ]
              }
            }
          },
          "loyalty": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EarningRuleFixed"
              },
              {
                "$ref": "#/components/schemas/EarningRuleProportional"
              },
              {
                "$ref": "#/components/schemas/EarningRuleProportionalOrderItems"
              }
            ]
          },
          "segment": {
            "type": "object",
            "description": "Contains the id of a customer segment. Required for the `customer.segment.entered` option in event.",
            "properties": {
              "id": {
                "type": "string",
                "description": "Unique identifier of a customer segment assigned by Voucherify."
              }
            },
            "required": [
              "id"
            ]
          },
          "loyalty_tier": {
            "type": "string",
            "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x",
            "description": "Customer's loyalty tier within the campaign."
          },
          "custom_event": {
            "type": "object",
            "properties": {
              "schema_id": {
                "type": "string"
              }
            },
            "required": [
              "schema_id"
            ]
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that is attached to an earning rule object."
          },
          "event": {
            "description": "Defines the event which triggers the earning rule to add points to a loyalty card.",
            "allOf": [
              {
                "$ref": "#/components/schemas/EarningRuleEvent"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "WebhookValidationRuleBase": {
        "title": "Validation Rule Base",
        "type": "object",
        "description": "This is an object representing a request validation rule.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Custom, unique name for set of validation rules.",
            "example": "Business Validation Rule"
          },
          "rules": {
            "$ref": "#/components/schemas/WebhookValidationRuleRules"
          },
          "bundle_rules": {
            "$ref": "#/components/schemas/WebhookValidationRuleBundleRules"
          },
          "error": {
            "type": "object",
            "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.",
            "properties": {
              "message": {
                "type": "string",
                "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules."
              }
            }
          },
          "applicable_to": {
            "type": "object",
            "properties": {
              "excluded": {
                "type": "array",
                "description": "Defines which items are excluded from a discount.",
                "items": {
                  "$ref": "#/components/schemas/ApplicableTo"
                }
              },
              "included": {
                "type": "array",
                "description": "Defines which items are included in a discount.",
                "items": {
                  "$ref": "#/components/schemas/ApplicableTo"
                }
              },
              "included_all": {
                "type": "boolean",
                "description": "Indicates whether all items are included in the discount."
              }
            }
          },
          "type": {
            "type": "string",
            "enum": [
              "expression",
              "basic",
              "advanced",
              "complex"
            ],
            "default": "expression",
            "description": "Type of validation rule."
          },
          "context_type": {
            "type": "string",
            "default": "global",
            "enum": [
              "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"
            ],
            "description": "Validation rule context type.  \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid |  |\n| earning_rule.custom_event |  |\n| earning_rule.customer.segment.entered |  |\n| campaign.discount_coupons |  |\n| campaign.discount_coupons.discount.apply_to_order |  |\n| campaign.discount_coupons.discount.apply_to_items |  |\n| campaign.discount_coupons.discount.apply_to_items_proportionally |  |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity |  |\n| campaign.discount_coupons.discount.fixed.apply_to_items |  |\n| campaign.gift_vouchers |  |\n| campaign.gift_vouchers.gift.apply_to_order |  |\n| campaign.gift_vouchers.gift.apply_to_items |  |\n| campaign.referral_program |  |\n| campaign.referral_program.discount.apply_to_order |  |\n| campaign.referral_program.discount.apply_to_items |  |\n| campaign.referral_program.discount.apply_to_items_proportionally |  |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity |  |\n| campaign.referral_program.discount.fixed.apply_to_items |  |\n| campaign.promotion |  |\n| campaign.promotion.discount.apply_to_order |  |\n| campaign.promotion.discount.apply_to_items |  |\n| campaign.promotion.discount.apply_to_items_proportionally |  |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity |  |\n| campaign.promotion.discount.fixed.apply_to_items |  |\n| campaign.loyalty_program |  |\n| voucher.discount_voucher |  |\n| voucher.discount_voucher.discount.apply_to_order |  |\n| voucher.discount_voucher.discount.apply_to_items |  |\n| voucher.discount_voucher.discount.apply_to_items_proportionally |  |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity |  |\n| voucher.discount_voucher.discount.fixed.apply_to_items |  |\n| voucher.gift_voucher |  |\n| voucher.gift_voucher.gift.apply_to_order |  |\n| voucher.gift_voucher.gift.apply_to_items |  |\n| voucher.loyalty_card |  |\n| distribution.custom_event |  |\n| reward_assignment.pay_with_points |  |\n| global |  |"
          }
        }
      },
      "Gift": {
        "title": "Gift",
        "type": "object",
        "description": "Contains current gift card balance information.",
        "properties": {
          "amount": {
            "type": "number",
            "description": "Total gift card income over the lifetime of the card. The value is multiplied by 100 to represent 2 decimal places. For example `10000 cents` for `$100.00`."
          },
          "subtracted_amount": {
            "type": "integer",
            "description": "Total amount of subtracted credits over the gift card lifetime."
          },
          "balance": {
            "type": "number",
            "description": "Available funds. The value is multiplied by 100 to represent 2 decimal places. For example `10000 cents` for `$100.00`. `balance` = `amount` - `subtracted_amount` - `redemption.redeemed_amount`."
          },
          "effect": {
            "type": "string",
            "description": "Defines how the credits are applied to the customer's order.",
            "enum": [
              "APPLY_TO_ORDER",
              "APPLY_TO_ITEMS"
            ]
          }
        },
        "required": [
          "amount",
          "balance"
        ]
      },
      "Discount": {
        "title": "Discount",
        "type": "object",
        "description": "Contains information about discount.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/DiscountAmount"
          },
          {
            "$ref": "#/components/schemas/DiscountUnit"
          },
          {
            "$ref": "#/components/schemas/DiscountUnitMultiple"
          },
          {
            "$ref": "#/components/schemas/DiscountPercent"
          },
          {
            "$ref": "#/components/schemas/DiscountFixed"
          }
        ]
      },
      "SimpleLoyaltyCard": {
        "title": "Simple Loyalty Card",
        "type": "object",
        "description": "Simplified loyalty card data.",
        "required": [
          "points"
        ],
        "properties": {
          "points": {
            "type": "integer",
            "description": "Total number of points added to the loyalty card over its lifespan."
          },
          "balance": {
            "type": "integer",
            "description": "Points available for reward redemption. This is calculated as follows: `balance` = `points` - `expired_points` - `subtracted_points` - `redemption.redeemed_points`."
          },
          "next_expiration_date": {
            "type": "string",
            "description": "The next closest date when the next set of points are due to expire."
          },
          "next_expiration_points": {
            "type": "integer",
            "description": "The amount of points that are set to expire next."
          },
          "pending_points": {
            "type": "integer",
            "description": "Shows the number of pending points that will be added to the loyalty card when they are activated automatically or manually."
          },
          "expired_points": {
            "type": "integer",
            "description": "Shows the total number of expired points over the lifetime of the loyalty card."
          },
          "subtracted_points": {
            "type": "integer",
            "description": "Shows the total number of subtracted points over the lifetime of the loyalty card."
          }
        }
      },
      "Category": {
        "title": "Category",
        "description": "This is an object representing a category.",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique category ID assigned by Voucherify."
          },
          "name": {
            "type": "string",
            "description": "Category name."
          },
          "hierarchy": {
            "type": "integer",
            "description": "Category hierarchy. Categories with lower hierarchy are processed before categories with higher hierarchy value.",
            "minimum": 0
          },
          "object": {
            "type": "string",
            "default": "category",
            "enum": [
              "category"
            ],
            "description": "The type of the object represented by the JSON. This object stores information about the category."
          },
          "created_at": {
            "type": "string",
            "description": "Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format.",
            "example": "2022-07-14T10:45:13.156Z",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "example": "2022-08-16T10:52:08.094Z",
            "description": "Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format.",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "hierarchy",
          "created_at",
          "object"
        ]
      },
      "SimpleCampaignVoucher": {
        "type": "object",
        "description": "Simplified campaign voucher data.",
        "title": "Simple Campaign Voucher",
        "properties": {
          "type": {
            "type": "string",
            "description": "Type of the voucher.",
            "enum": [
              "DISCOUNT_VOUCHER",
              "LOYALTY_CARD",
              "GIFT_VOUCHER"
            ]
          },
          "discount": {
            "description": "Defines the voucher discount type and details.",
            "allOf": [
              {
                "$ref": "#/components/schemas/Discount"
              }
            ]
          },
          "gift": {
            "description": "Defines the voucher gift details.",
            "allOf": [
              {
                "$ref": "#/components/schemas/Gift"
              }
            ]
          },
          "loyalty_card": {
            "description": "Defines the voucher loyalty card details.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CampaignLoyaltyCard"
              }
            ]
          },
          "redemption": {
            "type": "object",
            "description": "Defines the redemption limits on vouchers.",
            "properties": {
              "quantity": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "How many times a voucher can be redeemed. A `null` value means unlimited."
              },
              "redeemed_quantity": {
                "type": "integer",
                "example": 1,
                "description": "How many times a voucher has already been redeemed."
              }
            },
            "required": [
              "quantity",
              "redeemed_quantity"
            ]
          },
          "code_config": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CodeConfig"
              }
            ],
            "required": [
              "length",
              "charset",
              "pattern"
            ]
          }
        },
        "required": [
          "type",
          "redemption",
          "code_config"
        ]
      },
      "ReferralProgram": {
        "title": "Referral Program",
        "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.",
        "type": "object",
        "properties": {
          "conversion_event_type": {
            "type": "string",
            "enum": [
              "redemption",
              "custom_event"
            ],
            "description": "Define how a referral is triggered."
          },
          "custom_event": {
            "type": "object",
            "description": "Contains details about the custom event.",
            "properties": {
              "id": {
                "type": "string",
                "example": "ms_Ll9enAm2BCN0M1s4VxWobLFM",
                "description": "Unique custom event ID."
              },
              "name": {
                "type": "string",
                "description": "Custom event name."
              }
            }
          },
          "referee_reward": {
            "type": "object",
            "description": "Defines the referee reward.",
            "properties": {
              "related_object_parent": {
                "type": "object",
                "description": "Details of the resource from which the reward originates.",
                "properties": {
                  "id": {
                    "type": "string",
                    "example": "camp_kdxp3vf1clQ9CFs1jpqv3tZe",
                    "description": "Unique ID of the reward source."
                  },
                  "name": {
                    "type": "string",
                    "description": "Name of the reward source."
                  },
                  "object": {
                    "type": "string",
                    "default": "CAMPAIGN",
                    "enum": [
                      "CAMPAIGN"
                    ],
                    "description": "Type of resource represented by the source of the reward."
                  }
                }
              },
              "type": {
                "type": "string",
                "enum": [
                  "LOYALTY_CARD",
                  "GIFT_VOUCHER"
                ],
                "description": "Type of reward."
              },
              "amount": {
                "type": "integer",
                "description": "Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000."
              }
            }
          }
        }
      },
      "EarningRuleObjectOrderPaid": {
        "description": "Object representing an earning rule for a paid order.",
        "type": "object",
        "title": "Earning Rule Object for Order Paid",
        "properties": {
          "event": {
            "type": "string",
            "default": "order.paid",
            "enum": [
              "order.paid"
            ],
            "description": "Defines the event which triggers the earning rule to add points to a loyalty card.  \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. "
          },
          "banner": {
            "type": "string",
            "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard."
          },
          "loyalty": {
            "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EarningRuleFixed"
              },
              {
                "$ref": "#/components/schemas/EarningRuleProportional"
              },
              {
                "$ref": "#/components/schemas/EarningRuleProportionalOrderItems"
              }
            ]
          }
        }
      },
      "EarningRuleProportionalCustomEvent": {
        "title": "Earning Rule Proportional Custom Event",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "PROPORTIONAL",
            "enum": [
              "PROPORTIONAL"
            ],
            "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio."
          },
          "calculation_type": {
            "type": "string",
            "default": "CUSTOM_EVENT_METADATA",
            "enum": [
              "CUSTOM_EVENT_METADATA"
            ],
            "description": "CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute)."
          },
          "custom_event": {
            "type": "object",
            "required": [
              "metadata"
            ],
            "properties": {
              "metadata": {
                "type": "object",
                "required": [
                  "every",
                  "points",
                  "property"
                ],
                "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.",
                "properties": {
                  "every": {
                    "type": "integer",
                    "description": "For how many increments of the customer metadata property to grant points for."
                  },
                  "points": {
                    "type": "integer",
                    "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card."
                  },
                  "points_formula": {
                    "type": "string",
                    "description": "Formula used to dynamically calculate the rewarded points."
                  },
                  "property": {
                    "type": "string",
                    "description": "\nCustom event metadata property."
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "calculation_type",
          "custom_event"
        ]
      },
      "EarningRuleObjectEnteredSegment": {
        "description": "Object representing an earning rule for entering a customer segment.",
        "type": "object",
        "title": "Earning Rule Object for Entered Segment",
        "properties": {
          "validation_rule_id": {
            "type": "string",
            "example": "val_248vs7tUjlIE",
            "description": "Unique identifier of the validation rule."
          },
          "loyalty": {
            "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EarningRuleFixed"
              },
              {
                "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata"
              }
            ]
          },
          "segment": {
            "type": "object",
            "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.",
            "properties": {
              "id": {
                "type": "string",
                "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API."
              }
            }
          },
          "event": {
            "type": "string",
            "default": "customer.segment.entered",
            "enum": [
              "customer.segment.entered"
            ],
            "description": "Defines the event which triggers the earning rule to add points to a loyalty card.  \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment."
          },
          "source": {
            "type": "object",
            "description": "Contains the custom earning rule name and parent campaign.",
            "properties": {
              "banner": {
                "type": "string",
                "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard."
              }
            }
          },
          "active": {
            "type": "boolean",
            "description": "A flag to toggle the earning rule on or off."
          },
          "start_date": {
            "type": "string",
            "example": "2022-02-02T13:00:00.000Z",
            "format": "date-time",
            "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format."
          },
          "expiration_date": {
            "type": "string",
            "format": "date-time",
            "example": "2022-03-03T14:30:00.000Z",
            "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format."
          },
          "validity_timeframe": {
            "type": "object",
            "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.",
            "properties": {
              "duration": {
                "type": "string",
                "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.",
                "example": "PT1H"
              },
              "interval": {
                "type": "string",
                "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.",
                "example": "P2D"
              }
            }
          },
          "validity_day_of_week": {
            "type": "array",
            "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday",
            "items": {
              "type": "integer",
              "enum": [
                0,
                1,
                2,
                3,
                4,
                5,
                6
              ]
            }
          },
          "validity_hours": {
            "$ref": "#/components/schemas/ValidityHours"
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format."
          }
        }
      },
      "EarningRuleObjectTier": {
        "description": "Object representing an earning rule for tiers.",
        "type": "object",
        "title": "Earning Rule Object for Tiers",
        "properties": {
          "id": {
            "type": "string",
            "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK",
            "description": "Unique identifier of the earning rule."
          },
          "created_at": {
            "type": "string",
            "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.",
            "example": "2022-02-02T13:18:32.557Z",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.",
            "example": "2022-02-03T13:09:27.206Z",
            "format": "date-time"
          },
          "validation_rule_id": {
            "type": "string",
            "example": "val_248vs7tUjlIE",
            "description": "Unique identifier of the validation rule."
          },
          "loyalty": {
            "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EarningRuleFixed"
              },
              {
                "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata"
              }
            ]
          },
          "event": {
            "type": "string",
            "description": "Defines the event which triggers the earning rule to add points to a loyalty card.",
            "enum": [
              "customer.loyalty.tier.joined",
              "customer.loyalty.tier.left",
              "customer.loyalty.tier.upgraded",
              "customer.loyalty.tier.downgraded",
              "customer.loyalty.tier.prolonged"
            ]
          },
          "loyalty_tier": {
            "type": "object",
            "description": "Defines the tier associated with the earning rule definition.",
            "properties": {
              "id": {
                "type": "string",
                "description": "Unique identifier of the loyalty tier associated with the earning rule.",
                "example": "ltr_pudTGWasuIqxdiDM0go31OV1"
              }
            }
          },
          "source": {
            "type": "object",
            "description": "Contains the custom earning rule name and parent campaign.",
            "properties": {
              "banner": {
                "type": "string",
                "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard."
              },
              "object_id": {
                "type": "string",
                "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3",
                "description": "Unique identifier of the campaign."
              },
              "object_type": {
                "type": "string",
                "default": "campaign",
                "description": "Defines the object associated with the earning rule. Defaults to `campaign`."
              }
            }
          },
          "active": {
            "type": "boolean",
            "description": "A flag to toggle the earning rule on or off."
          },
          "start_date": {
            "type": "string",
            "example": "2022-02-02T13:00:00.000Z",
            "format": "date-time",
            "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format."
          },
          "expiration_date": {
            "type": "string",
            "format": "date-time",
            "example": "2022-03-03T14:30:00.000Z",
            "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format."
          },
          "validity_timeframe": {
            "type": "object",
            "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.",
            "properties": {
              "duration": {
                "type": "string",
                "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.",
                "example": "PT1H"
              },
              "interval": {
                "type": "string",
                "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.",
                "example": "P2D"
              }
            }
          },
          "validity_day_of_week": {
            "type": "array",
            "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday",
            "items": {
              "type": "integer",
              "enum": [
                0,
                1,
                2,
                3,
                4,
                5,
                6
              ]
            }
          },
          "validity_hours": {
            "$ref": "#/components/schemas/ValidityHours"
          },
          "object": {
            "type": "string",
            "default": "earning_rule",
            "description": "The type of the object represented by JSON. Default is `earning_rule`."
          },
          "automation_id": {
            "type": "string",
            "description": "For internal use by Voucherify.",
            "example": "auto_4jH1yq9WJS0oJ8suagCrltyb"
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format."
          }
        }
      },
      "EarningRuleFixed": {
        "title": "Define fixed amount of points",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "FIXED",
            "enum": [
              "FIXED"
            ],
            "description": "The number of points to be added to the loyalty card."
          },
          "points": {
            "type": "integer",
            "description": "Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points."
          },
          "points_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the rewarded points."
          }
        },
        "required": [
          "type",
          "points"
        ]
      },
      "EarningRuleProportional": {
        "title": "Calculate points proportionally",
        "oneOf": [
          {
            "$ref": "#/components/schemas/EarningRuleProportionalOrder"
          },
          {
            "$ref": "#/components/schemas/EarningRuleProportionalOrderItems"
          },
          {
            "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata"
          },
          {
            "$ref": "#/components/schemas/EarningRuleProportionalCustomEvent"
          }
        ]
      },
      "EarningRuleProportionalOrderItems": {
        "title": "Define amount of points proportional to order items",
        "oneOf": [
          {
            "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsQuantity"
          },
          {
            "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsAmount"
          },
          {
            "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsSubtotalAmount"
          }
        ]
      },
      "EarningRuleEvent": {
        "title": "Earning Rule Event",
        "example": "`order.paid`, `customer.segment.entered`, `customer.loyalty.tier.upgraded`, `customer.loyalty.tier.downgraded`, `customer.loyalty.tier.prolonged`, `customer.loyalty.tier.joined`, `customer.loyalty.tier.left`",
        "type": "string"
      },
      "WebhookValidationRuleRules": {
        "title": "Validation Rule Rules",
        "type": "object",
        "description": "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.",
        "properties": {
          "logic": {
            "type": "string",
            "example": "(1 and 2) and (3)",
            "description": "Defines the logic between the rules."
          }
        },
        "additionalProperties": {
          "type": "object",
          "description": "Contains the name of the validation rule.",
          "properties": {
            "name": {
              "type": "string",
              "description": "Voucherify's specific rule name.  The list of available names is provided below.  \n\n|**Type**|**Name** |\n---- | -----------|\n|**Customer** | customer.segment<br>customer.metadata* |\n|**Order** |order.amount<br>order.initial_amount<br>order.items.count<br>order.items.price_any<br>order.items.price_each<br>order.items.metadata_any (deprecated)<br>order.items.metadata_each (deprecated)<br>order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted<br>campaign.orders.amount<br>campaign.redemptions.count<br>campaign.redemptions.count.daily<br>campaign.redemptions.count.monthly<br>campaign.redemptions.customers_count<br>campaign.redemptions.customers_count.daily<br>campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount<br>redemption.count.daily<br>redemption.count.monthly<br>redemption.count.per_customer<br>redemption.count.per_customer.daily<br>redemption.count.per_customer.monthly<br>redemption.api_key<br>redemption.count.per_api_key<br>redemption.user.login<br>redemption.count.per_user<br>redemption.metadata<br>redemption.reward.pay_with_points.points_used |\n| **Product** | product.id (deprecated)<br>product.price (deprecated)<br>product.quantity (deprecated)<br>product.discount_applicable (deprecated)<br>product.metadata (deprecated)*<br>product.metadata.aggregated_quantity (deprecated)<br>product.metadata.aggregated_amount (deprecated)<br>product.metadata.discount_applicable (deprecated)<br>product.metadata.match_all (deprecated) |\n| **SKU** | sku.id (deprecated)<br>sku.price (deprecated)<br>sku.quantity (deprecated)<br>sku.discount_applicable (deprecated) |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every<br>order.items.any<br>order.items.none<br>order.items.cheapest<br>order.items.most_expensive | order.items.quantity<br>order.items.aggregated_quantity<br>order.items.price<br>order.items.aggregated_amount<br>order.items.metadata* |  \n\n\n\n*Requires the `property` field to be defined."
            },
            "property": {
              "type": [
                "string",
                "null"
              ],
              "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n customer_metadata<br>custom_event_metadata<br>order_items_metadata<br>order_metadata<br>product_metadata<br>redemption_metadata"
            },
            "conditions": {
              "$ref": "#/components/schemas/ValidationRuleConditions"
            },
            "rules": {
              "$ref": "#/components/schemas/WebhookValidationRuleRules01"
            },
            "error": {
              "type": "object",
              "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.",
              "properties": {
                "message": {
                  "type": "string",
                  "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule."
                }
              }
            }
          }
        }
      },
      "WebhookValidationRuleBundleRules": {
        "title": "Validation Rule Bundle Rules",
        "type": "object",
        "description": "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.\n\nWhile updating with the PUT method, you can pass `\"bundle_rules\": null` to delete the configuration; in the response, an empty object is then returned.",
        "properties": {
          "logic": {
            "type": "string",
            "example": "(1 and 2) and (3)",
            "description": "Defines the logic between the rules."
          }
        },
        "additionalProperties": {
          "type": "object",
          "description": "Contains the name of the bundle rule.",
          "properties": {
            "name": {
              "type": "string",
              "description": "Voucherify's specific bundle rule name. Currently, it is only `order.items.any`.",
              "enum": [
                "order.items.any"
              ]
            },
            "conditions": {
              "type": "object",
              "description": "Defines the conditions of the bundle rule. The order items in the customer's cart must meet the conditions. Because the rule concerns order items, the only permissible condition is `$is`.",
              "properties": {
                "$is": {
                  "type": "array",
                  "maxItems": 1,
                  "items": {
                    "type": "object",
                    "description": "",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Unique identifier of the product, SKU, or collection assigned by Voucherify."
                      },
                      "type": {
                        "type": "string",
                        "description": "Type of the order item. It can be a `product_or_sku` or `products_collection`",
                        "enum": [
                          "product_or_sku",
                          "products_collection"
                        ]
                      },
                      "object": {
                        "type": "string",
                        "description": "Object used in the bundle rule. It can be a `products_collection`, `product`, or `sku`.",
                        "enum": [
                          "products_collection",
                          "product",
                          "sku"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "object"
                    ]
                  }
                }
              }
            },
            "rules": {
              "properties": {
                "logic": {
                  "type": "string",
                  "example": "(1 and 2) and (3)",
                  "description": "Defines the logic between the sub-rules."
                }
              },
              "additionalProperties": {
                "type": "object",
                "description": "Contains the name of the validation sub-rule.",
                "maxProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Voucherify's specific sub-rule name. Currently, it is only `order.items.aggregated_quantity`.",
                    "enum": [
                      "order.items.aggregated_quantity"
                    ]
                  },
                  "conditions": {
                    "type": "object",
                    "description": "Defines the conditions of the bundle rule. The quantity of order items in the customer's cart must meet the conditions.",
                    "properties": {
                      "$is": {
                        "type": "array",
                        "maxItems": 1,
                        "items": {
                          "type": "number",
                          "minimum": 1,
                          "description": "The number of units in the customer's cart must be equal or higher than the defined number."
                        }
                      }
                    }
                  },
                  "rules": {
                    "type": "object",
                    "description": "An empty object."
                  }
                }
              }
            },
            "error": {
              "type": "object",
              "description": "**CURRENTLY UNSUPPORTED**. Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.",
              "properties": {
                "message": {
                  "type": "string",
                  "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule."
                }
              }
            }
          }
        }
      },
      "ApplicableTo": {
        "title": "Applicable To",
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "product",
              "sku",
              "products_collection"
            ],
            "description": "This object stores information about the resource to which the discount is applicable."
          },
          "id": {
            "type": "string",
            "description": "Unique product collection, product, or SKU identifier assigned by Voucherify."
          },
          "source_id": {
            "type": "string",
            "description": "The source identifier from your inventory system."
          },
          "product_id": {
            "type": "string",
            "description": "Parent product's unique ID assigned by Voucherify."
          },
          "product_source_id": {
            "type": "string",
            "description": "Parent product's source ID from your inventory system."
          },
          "price": {
            "type": "number",
            "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price."
          },
          "price_formula": {
            "type": "number",
            "description": "Formula used to dynamically calculate the discounted price of an item."
          },
          "effect": {
            "description": "Defines how the discount is applied to the customer's order.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ApplicableToEffect"
              }
            ]
          },
          "quantity_limit": {
            "type": "integer",
            "description": "The maximum number of units allowed to be discounted per order line item."
          },
          "aggregated_quantity_limit": {
            "type": "integer",
            "description": "The maximum number of units allowed to be discounted combined across all matched order line items."
          },
          "amount_limit": {
            "type": "integer",
            "description": "Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600."
          },
          "aggregated_amount_limit": {
            "type": "integer",
            "description": "Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects:\n- `APPLY_TO_ITEMS` (each item subtotal is discounted equally)\n- `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value)"
          },
          "product_campaign_quantity_limit": {
            "type": "integer",
            "description": "Limits the number of discounted item units (product, SKU, collection) that all customers can receive in a given campaign. If a product is selected, the limit covers all discounts across all SKUs belonging to that product. If a product collection is selected, the limit covers all products/SKUs within the collection.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_campaign_quantity_limit_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the maximum units per campaign.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_customer_campaign_quantity_limit": {
            "type": "integer",
            "description": "Limits the number of discounted item units (product, SKU, collection) that one customer can receive in a given campaign.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_customer_campaign_quantity_limit_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the maximum units per customer in a campaign.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_in_collection_campaign_quantity_limit": {
            "type": "integer",
            "description": "Limits the number of discounted item units of a given product in a collection that all customers can receive in a given campaign.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_in_collection_campaign_quantity_limit_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the maximum units per campaign for a product in a collection.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_in_collection_customer_campaign_quantity_limit": {
            "type": "integer",
            "description": "Limits the number of discounted item units of a given product in a collection that one customer can receive in a campaign.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_in_collection_customer_campaign_quantity_limit_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the maximum units per customer for a product in a collection.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_promotion_tier_quantity_limit": {
            "type": "integer",
            "description": "Limits the number of discounted item units that all customers can receive in a promotion tier.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_promotion_tier_quantity_limit_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the maximum units per promotion tier.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_customer_promotion_tier_quantity_limit": {
            "type": "integer",
            "description": "Limits the number of discounted item units that one customer can receive in a given promotion tier.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_customer_promotion_tier_quantity_limit_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the maximum units per customer in a promotion tier.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_in_collection_promotion_tier_quantity_limit": {
            "type": "integer",
            "description": "Limits the number of discounted item units of a given product in a collection that all customers can receive in a given promotion tier.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_in_collection_promotion_tier_quantity_limit_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the maximum units per promotion tier for a product in a collection.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_in_collection_customer_promotion_tier_quantity_limit": {
            "type": "integer",
            "description": "Limits the number of discounted item units of a given product in a collection that one customer can receive in a promotion tier.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "product_in_collection_customer_promotion_tier_quantity_limit_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the maximum units per customer in a promotion tier for a product in a collection.\n\nThis limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more."
          },
          "order_item_indices": {
            "type": "array",
            "description": "Lists which order lines are (not) covered by the discount. The order in the array is determined by the sequence of applied discounts, while the numbers correspond to the order lines sent in the `order` object in the request. The first order line is assigned `0`, the second order line is assigned `1`, and so on.",
            "items": {
              "type": "integer"
            }
          },
          "order_item_units": {
            "type": "array",
            "description": "Lists which units within order lines are covered by the discount. The order line items are listed according to sequence of applied discounts while the `index` corresponds to the order line sent in the `order` object in the request.",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "description": "Number assigned to the order line item in accordance with the order sent in the request.",
                  "minimum": 0
                },
                "units": {
                  "type": "array",
                  "description": "Numbers of units in the order line covered by the discount; e.g. `2, 5, 8` for 10 units with the setting `\"skip_initially\": 1`, `\"repeat\": 3`. The counting of units starts from `1`. The maximum quantity of all handled units is 1000. If the quantity of all order items exceeds 1000, this array is not returned, but `units_limit_exceeded: true`. However, the discount is calculated properly for all relevant units.",
                  "items": {
                    "type": "integer"
                  }
                },
                "units_limit_exceeded": {
                  "type": "boolean",
                  "description": "Returned as `true` only when the sum total of `quantity` of all order items exceeds 1000."
                }
              }
            }
          },
          "repeat": {
            "type": "integer",
            "description": "Determines the recurrence of the discount, e.g. `\"repeat\": 3` means that the discount is applied to every third item."
          },
          "skip_initially": {
            "type": "integer",
            "description": "Determines how many items are skipped before the discount is applied."
          },
          "target": {
            "type": "string",
            "description": "Determines to which kinds of objects the discount is applicable. `ITEM` includes products and SKUs. `UNIT` means particular units within an order line.",
            "enum": [
              "ITEM",
              "UNIT"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "effect"
        ]
      },
      "DiscountAmount": {
        "type": "object",
        "title": "Amount",
        "properties": {
          "type": {
            "type": "string",
            "default": "AMOUNT",
            "enum": [
              "AMOUNT"
            ],
            "description": "Defines the type of the voucher."
          },
          "amount_off": {
            "type": "number",
            "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000."
          },
          "amount_off_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the discount."
          },
          "aggregated_amount_limit": {
            "type": "integer",
            "description": "Maximum discount amount per order."
          },
          "effect": {
            "description": "Defines how the discount is applied to the customer's order.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DiscountAmountVouchersEffectTypes"
              }
            ]
          },
          "is_dynamic": {
            "type": "boolean",
            "description": "Flag indicating whether the discount was calculated using a formula."
          }
        },
        "required": [
          "type",
          "amount_off"
        ]
      },
      "DiscountUnit": {
        "type": "object",
        "title": "Unit",
        "properties": {
          "type": {
            "type": "string",
            "default": "UNIT",
            "enum": [
              "UNIT"
            ],
            "description": "Discount type."
          },
          "unit_off": {
            "type": "integer",
            "description": "Number of units to be granted a full value discount."
          },
          "unit_off_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the number of units."
          },
          "effect": {
            "description": "Defines how the unit is added to the customer's order.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DiscountUnitVouchersEffectTypes"
              }
            ]
          },
          "unit_type": {
            "type": "string",
            "description": "The product deemed as free, chosen from product inventory (e.g. time, items)."
          },
          "product": {
            "description": "Contains information about the product.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SimpleProductDiscountUnit"
              }
            ]
          },
          "sku": {
            "$ref": "#/components/schemas/SimpleSkuDiscountUnit"
          },
          "is_dynamic": {
            "type": "boolean",
            "description": "Flag indicating whether the discount was calculated using a formula."
          }
        },
        "required": [
          "type",
          "unit_type"
        ]
      },
      "DiscountUnitMultiple": {
        "type": "object",
        "title": "Unit Multiple",
        "properties": {
          "type": {
            "type": "string",
            "default": "UNIT",
            "enum": [
              "UNIT"
            ],
            "description": "Discount type."
          },
          "effect": {
            "type": "string",
            "default": "ADD_MANY_ITEMS",
            "enum": [
              "ADD_MANY_ITEMS"
            ],
            "description": "Defines how the discount is applied to the customer's order."
          },
          "units": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiscountUnitMultipleOneUnit"
            }
          }
        },
        "required": [
          "type",
          "units"
        ]
      },
      "DiscountPercent": {
        "type": "object",
        "title": "Percent",
        "properties": {
          "type": {
            "type": "string",
            "default": "PERCENT",
            "enum": [
              "PERCENT"
            ],
            "description": "Defines the type of the voucher."
          },
          "percent_off": {
            "type": "number",
            "description": "The percent discount that the customer will receive."
          },
          "percent_off_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the discount."
          },
          "amount_limit": {
            "type": "number",
            "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600."
          },
          "aggregated_amount_limit": {
            "type": "integer",
            "description": "Maximum discount amount per order."
          },
          "effect": {
            "description": "Defines how the discount is applied to the customer's order.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DiscountPercentVouchersEffectTypes"
              }
            ]
          },
          "is_dynamic": {
            "type": "boolean",
            "description": "Flag indicating whether the discount was calculated using a formula."
          }
        },
        "required": [
          "type",
          "percent_off"
        ]
      },
      "DiscountFixed": {
        "title": "Fixed",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "FIXED",
            "enum": [
              "FIXED"
            ],
            "description": "Defines the type of the voucher."
          },
          "fixed_amount": {
            "type": "number",
            "description": "Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value."
          },
          "fixed_amount_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the discount."
          },
          "effect": {
            "description": "Defines how the discount is applied to the customer's order.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DiscountFixedVouchersEffectTypes"
              }
            ]
          },
          "is_dynamic": {
            "type": "boolean",
            "description": "Flag indicating whether the discount was calculated using a formula."
          }
        },
        "required": [
          "type",
          "fixed_amount"
        ]
      },
      "CampaignLoyaltyCard": {
        "type": "object",
        "description": "Schema model for a campaign loyalty card.",
        "title": "Campaign Loyalty Card",
        "properties": {
          "points": {
            "type": "integer",
            "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card."
          },
          "expiration_rules": {
            "type": "object",
            "description": "Defines the loyalty point expiration rule. This expiration rule applies when there are no `expiration_rules` defined for an earning rule.",
            "properties": {
              "period_type": {
                "type": "string",
                "description": "Type of period. Can be set for `MONTH` or `FIXED_DAY_OF_YEAR`. `MONTH` requires the `period_value` field. `FIXED_DAY_OF_YEAR` requires the `fixed_month` and `fixed_day` fields.",
                "enum": [
                  "FIXED_DAY_OF_YEAR",
                  "MONTH"
                ]
              },
              "period_value": {
                "type": "integer",
                "description": "Value of the period. Required for the `period_type: MONTH`."
              },
              "rounding_type": {
                "type": "string",
                "description": "Type of rounding of the expiration period. Optional for the `period_type: MONTH`.",
                "enum": [
                  "END_OF_MONTH",
                  "END_OF_QUARTER",
                  "END_OF_HALF_YEAR",
                  "END_OF_YEAR",
                  "PARTICULAR_MONTH"
                ]
              },
              "rounding_value": {
                "type": "integer",
                "description": "Value of rounding of the expiration period. Required for the `rounding_type`."
              },
              "fixed_month": {
                "type": "integer",
                "description": "Determines the month when the points expire; `1` is January, `2` is February, and so on. Required for the `period_type: FIXED_DAY_OF_YEAR`.",
                "minimum": 1,
                "maximum": 12
              },
              "fixed_day": {
                "type": "integer",
                "description": "Determines the day of the month when the points expire. Required for the `period_type: FIXED_DAY_OF_YEAR`.",
                "minimum": 1,
                "maximum": 31
              }
            },
            "required": [
              "period_type"
            ]
          }
        },
        "required": [
          "points"
        ]
      },
      "CodeConfig": {
        "title": "Code Config",
        "type": "object",
        "description": "Contains information about the config used for the voucher code. Defines the code's pattern (prefix, postfix, length, charset, etc).",
        "properties": {
          "length": {
            "type": "number",
            "description": "Number of characters in a generated code (excluding prefix and postfix)."
          },
          "charset": {
            "type": "string",
            "description": "Characters that can appear in the code.  \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789`  \n- Custom: a custom character set"
          },
          "prefix": {
            "type": "string",
            "description": "A text appended before the code."
          },
          "postfix": {
            "type": "string",
            "description": "A text appended after the code."
          },
          "pattern": {
            "type": "string",
            "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`."
          },
          "initial_count": {
            "type": "integer",
            "description": "Internal value, does not change anything if provided."
          }
        }
      },
      "EarningRuleProportionalCustomerMetadata": {
        "title": "Define amount of points proportional to customer metadata",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "PROPORTIONAL",
            "enum": [
              "PROPORTIONAL"
            ],
            "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio."
          },
          "calculation_type": {
            "type": "string",
            "default": "CUSTOMER_METADATA",
            "enum": [
              "CUSTOMER_METADATA"
            ],
            "description": "CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object)"
          },
          "customer": {
            "type": "object",
            "required": [
              "metadata"
            ],
            "properties": {
              "metadata": {
                "type": "object",
                "required": [
                  "every",
                  "points",
                  "property"
                ],
                "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.",
                "properties": {
                  "every": {
                    "type": "integer",
                    "description": "For how many increments of the customer metadata property to grant points for."
                  },
                  "points": {
                    "type": "integer",
                    "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card."
                  },
                  "points_formula": {
                    "type": "string",
                    "description": "Formula used to dynamically calculate the rewarded points."
                  },
                  "property": {
                    "type": "string",
                    "description": "Customer metadata property."
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "calculation_type",
          "customer"
        ]
      },
      "ValidityHours": {
        "title": "Validity Hours",
        "type": "object",
        "description": "Determines the hours of validity, e.g. to create a happy hours scenario.",
        "properties": {
          "daily": {
            "type": "array",
            "description": "Defines the recurring period(s) when the resource is active. The periods should not overlap.",
            "items": {
              "type": "object",
              "description": "Defines the recurring period(s) when the resource will be active.",
              "properties": {
                "start_time": {
                  "type": "string",
                  "format": "time",
                  "description": "Defines the starting hour of validity in the HH:mm format. The resource is *inactive before* this time.",
                  "example": "12:00"
                },
                "days_of_week": {
                  "type": "array",
                  "description": "Integer array corresponding to the particular days of the week in which the resource is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3`  Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday",
                  "items": {
                    "type": "integer",
                    "enum": [
                      0,
                      1,
                      2,
                      3,
                      4,
                      5,
                      6
                    ]
                  }
                },
                "expiration_time": {
                  "type": "string",
                  "format": "time",
                  "description": "Defines the ending hour of validity in the HH:mm format. The resource is *inactive after* this time.",
                  "example": "14:00"
                }
              }
            }
          }
        }
      },
      "EarningRuleProportionalOrder": {
        "title": "Define amount of points proportional to the order",
        "oneOf": [
          {
            "$ref": "#/components/schemas/EarningRuleProportionalOrderAmount"
          },
          {
            "$ref": "#/components/schemas/EarningRuleProportionalOrderTotalAmount"
          },
          {
            "$ref": "#/components/schemas/EarningRuleProportionalOrderMetadata"
          }
        ]
      },
      "EarningRuleProportionalOrderItemsQuantity": {
        "title": "Order Items Quantity",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "PROPORTIONAL",
            "enum": [
              "PROPORTIONAL"
            ],
            "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio."
          },
          "calculation_type": {
            "type": "string",
            "default": "ORDER_ITEMS_QUANTITY",
            "enum": [
              "ORDER_ITEMS_QUANTITY"
            ],
            "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in the `order_items.quantity.applicable_to` array or `order_items.quantity.object` & `.id` (X points for every Y items excluding free items)."
          },
          "order_items": {
            "type": "object",
            "required": [
              "quantity"
            ],
            "properties": {
              "quantity": {
                "type": "object",
                "required": [
                  "every",
                  "points"
                ],
                "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.",
                "properties": {
                  "every": {
                    "type": "integer",
                    "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000."
                  },
                  "points": {
                    "type": "integer",
                    "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card."
                  },
                  "points_formula": {
                    "type": "string",
                    "description": "Formula used to dynamically calculate the rewarded points."
                  },
                  "object": {
                    "type": "string",
                    "description": "Type of object which will be covered by the earning rule. This is required together with `id`. Can be replaced by the `applicable_to` array. In response, the value of the first object is returned even if `applicable_to` array was used.",
                    "enum": [
                      "products_collection",
                      "product",
                      "sku"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "description": "Unique ID of the resource assigned by Voucherify. This is required together with `object`. Can be replaced by the `applicable_to` array. In response, the value of the first object is returned even if `applicable_to` array was used. Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for product collection, `prod_0bae32322150fd0546` for a product, or `sku_0b7d7dfb090be5c619` for a SKU."
                  },
                  "applicable_to": {
                    "type": "array",
                    "description": "Defines products, SKUs, or product collections covered by the earning rule. Can be replaced by `object` and `id` to define only one object.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string",
                          "description": "Type of object which will be covered by the earning rule.",
                          "enum": [
                            "products_collection",
                            "product",
                            "sku"
                          ]
                        },
                        "id": {
                          "type": "string",
                          "description": "Unique ID of the resource assigned by Voucherify. Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for product collection, `prod_0bae32322150fd0546` for a product, or `sku_0b7d7dfb090be5c619` for a SKU."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "calculation_type",
          "order_items"
        ]
      },
      "EarningRuleProportionalOrderItemsAmount": {
        "title": "Order Items Amount",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "PROPORTIONAL",
            "enum": [
              "PROPORTIONAL"
            ],
            "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio."
          },
          "calculation_type": {
            "type": "string",
            "default": "ORDER_ITEMS_AMOUNT",
            "enum": [
              "ORDER_ITEMS_AMOUNT"
            ],
            "description": "ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the `order_items.quantity.applicable_to` array or `order_items.quantity.object` & `.id` (X points for every Y spent on items excluding discounts)"
          },
          "order_items": {
            "type": "object",
            "required": [
              "amount"
            ],
            "properties": {
              "amount": {
                "type": "object",
                "required": [
                  "every",
                  "points"
                ],
                "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.",
                "properties": {
                  "every": {
                    "type": "integer",
                    "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000."
                  },
                  "points": {
                    "type": "integer",
                    "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card."
                  },
                  "points_formula": {
                    "type": "string",
                    "description": "Formula used to dynamically calculate the rewarded points."
                  },
                  "object": {
                    "type": "string",
                    "description": "Type of object which will be covered by the earning rule. This is required together with `id`. Can be replaced by the `applicable_to` array. In response, the value of the first object is returned even if `applicable_to` array was used.",
                    "enum": [
                      "products_collection",
                      "product",
                      "sku"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "description": "Unique ID of the resource assigned by Voucherify. This is required together with `object`. Can be replaced by the `applicable_to` array. In response, the value of the first object is returned even if `applicable_to` array was used. Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for product collection, `prod_0bae32322150fd0546` for a product, or `sku_0b7d7dfb090be5c619` for a SKU."
                  },
                  "applicable_to": {
                    "type": "array",
                    "description": "Defines products, SKUs, or product collections covered by the earning rule. Can be replaced by `object` and `id` to define only one object.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string",
                          "description": "Type of object which will be covered by the earning rule.",
                          "enum": [
                            "products_collection",
                            "product",
                            "sku"
                          ]
                        },
                        "id": {
                          "type": "string",
                          "description": "Unique ID of the resource assigned by Voucherify. Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for product collection, `prod_0bae32322150fd0546` for a product, or `sku_0b7d7dfb090be5c619` for a SKU."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "calculation_type",
          "order_items"
        ]
      },
      "EarningRuleProportionalOrderItemsSubtotalAmount": {
        "title": "Order Items Subtotal Amount",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "PROPORTIONAL",
            "enum": [
              "PROPORTIONAL"
            ],
            "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio."
          },
          "calculation_type": {
            "type": "string",
            "default": "ORDER_ITEMS_SUBTOTAL_AMOUNT",
            "enum": [
              "ORDER_ITEMS_SUBTOTAL_AMOUNT"
            ],
            "description": "ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts)"
          },
          "order_items": {
            "type": "object",
            "required": [
              "subtotal_amount"
            ],
            "properties": {
              "subtotal_amount": {
                "type": "object",
                "required": [
                  "every",
                  "points"
                ],
                "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.",
                "properties": {
                  "every": {
                    "type": "integer",
                    "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000."
                  },
                  "points": {
                    "type": "integer",
                    "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card."
                  },
                  "points_formula": {
                    "type": "string",
                    "description": "Formula used to dynamically calculate the rewarded points."
                  },
                  "object": {
                    "type": "string",
                    "description": "Type of object which will be covered by the earning rule. This is required together with `id`. Can be replaced by the `applicable_to` array. In response, the value of the first object is returned even if `applicable_to` array was used.",
                    "enum": [
                      "products_collection",
                      "product",
                      "sku"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "description": "Unique ID of the resource assigned by Voucherify. This is required together with `object`. Can be replaced by the `applicable_to` array. In response, the value of the first object is returned even if `applicable_to` array was used. Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for product collection, `prod_0bae32322150fd0546` for a product, or `sku_0b7d7dfb090be5c619` for a SKU."
                  },
                  "applicable_to": {
                    "type": "array",
                    "description": "Defines products, SKUs, or product collections covered by the earning rule. Can be replaced by `object` and `id` to define only one object.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string",
                          "description": "Type of object which will be covered by the earning rule.",
                          "enum": [
                            "products_collection",
                            "product",
                            "sku"
                          ]
                        },
                        "id": {
                          "type": "string",
                          "description": "Unique ID of the resource assigned by Voucherify. Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for product collection, `prod_0bae32322150fd0546` for a product, or `sku_0b7d7dfb090be5c619` for a SKU."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "calculation_type",
          "order_items"
        ]
      },
      "ValidationRuleConditions": {
        "title": "Validation Rule Conditions",
        "type": "object",
        "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n\n| **Condition (key)** | **Definition**                                                | \n|---------------------|---------------------------------------------------------------|\n| `$is`                 | A property is a predefined value.                             |                           \n| `$is_not`             | A property is not a predefined value.                         |                           \n| `$in`                 | A property is one value of the values in a predefined list of values.   |                          \n|`$not_in`                 | A property is not one of the values in a predefined list of values.   |                          \n| `$less_than`          | A property is less than a predefined value. Can be also used with datetime.                  |                     \n| `$less_than_or_equal` | A property is less than or equal to a predefined value. Can be also used with datetime.       | \n| `$more_than`          | A property is more than a predefined value. Can be also used with datetime.                  | \n| `$more_than_or_equal` | A property is more than or equal to a predefined value. Can be also used with datetime.      | \n| `$starts_with`        | A property starts with the predefined sequence of characters. | \n| `$ends_with `         | A property ends with the predefined sequence of characters.   | \n| `$contains`           | A property contains the predefined sequence of characters.    | \n| `$timeframe`          | A property occurs within the time frame, i.e. every 1 day for 1 hour, e.g. `$timeframe: [\"2024-11-12T14:59:23.019Z;P1D;PT1H\"]`                                                       | \n| `$timeframe_absolute` | A property occurs between two dates and times, e.g. `2024-11-14T16:02:00.000Z;2024-11-28T16:02:00.000Z`                                                        | \n| `$timeframe_daily_hours` | A property occurs between selected hours on selected days of the week, e.g. `18:00;20:01;2,3`, where `0` equals Sunday, `1` equals Monday, `2` equals Tuesday, `3` equals Wednesday, `4` equals Thursday, `5` equals Friday, and `6` equals Saturday.                                                       | \n| `$dow`                | A property occurs within given days of the week, where `0` equals Sunday, `1` equals Monday, `2` equals Tuesday, `3` equals Wednesday, `4` equals Thursday, `5` equals Friday, and `6` equals Saturday.                                                        | \n| `$count`              | For array metadata; the property must have exactly the defined number of elements.                                                        | \n| `$count_more`         | For array metadata; the property must have more elements than the defined number.                                                        | \n| `$count_less`         | For array metadata; the property must have less elements than the defined number.                                                        | \n| `$from`               | The property must belong to the predefined value. Related to product collections and best used together with the `$is` condition.                                                        | \n | `$after`               | The value is after the date.                                                        | \n| `$before`               | The value is before the date.                                                        | \n| `$more_than_ago`               | The date is more than the defined value ago expressed in number of days, relative to today, e.g. more than 3 days ago.                                                        | \n| `$less_than_ago`               | The date is less than the defined value ago expressed in number of days, relative to today, less than 3 days ago.                                                        | \n| `is_days_ago`               | The date is exactly the defined value ago expressed in number of days, relative to today, e.g. exactly 3 days ago.                                                        | \n| `$more_than_future`               | The date is more than the defined value in the future expressed in number of days, relative to today, e.g. more than 3 days in the future.                                                        | \n| `$less_than_ago`               | The date is less than the defined value in the future expressed in number of days, relative to today, e.g. less than 3 days in the future.                                                        | \n| `$is_days_in_future`               | The date is exactly the defined value in the future expressed in number of days, relative to today, e.g. exactly 3 days in the future.                                                        | \n",
        "properties": {
          "$is": {
            "$ref": "#/components/schemas/AnyOne"
          },
          "$is_not": {
            "$ref": "#/components/schemas/AnyOne"
          },
          "$in": {
            "$ref": "#/components/schemas/Any"
          },
          "$not_in": {
            "$ref": "#/components/schemas/Any"
          },
          "$less_than": {
            "$ref": "#/components/schemas/AnyOne"
          },
          "$less_than_or_equal": {
            "$ref": "#/components/schemas/AnyOne"
          },
          "$more_than": {
            "$ref": "#/components/schemas/AnyOne"
          },
          "$more_than_or_equal": {
            "$ref": "#/components/schemas/AnyOne"
          },
          "$starts_with": {
            "$ref": "#/components/schemas/AnyString"
          },
          "$ends_with": {
            "$ref": "#/components/schemas/AnyString"
          },
          "$contains": {
            "$ref": "#/components/schemas/AnyString"
          },
          "$timeframe": {
            "$ref": "#/components/schemas/AnyString"
          },
          "$timeframe_absolute": {
            "$ref": "#/components/schemas/AnyString"
          },
          "$timeframe_daily_hours": {
            "$ref": "#/components/schemas/AnyString"
          },
          "$dow": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            }
          },
          "$count": {
            "$ref": "#/components/schemas/AnyNumber"
          },
          "$count_more": {
            "$ref": "#/components/schemas/AnyNumber"
          },
          "$count_less": {
            "$ref": "#/components/schemas/AnyNumber"
          },
          "$not_differ": {
            "$ref": "#/components/schemas/Any"
          },
          "$not_intersect": {
            "$ref": "#/components/schemas/Any"
          },
          "$from": {
            "$ref": "#/components/schemas/Any"
          },
          "$after": {
            "$ref": "#/components/schemas/AnyDateDateTime"
          },
          "$before": {
            "$ref": "#/components/schemas/AnyDateDateTime"
          },
          "$more_than_ago": {
            "$ref": "#/components/schemas/AnyNumber"
          },
          "$less_than_ago": {
            "$ref": "#/components/schemas/AnyNumber"
          },
          "$is_days_ago": {
            "$ref": "#/components/schemas/AnyNumber"
          },
          "$more_than_future": {
            "$ref": "#/components/schemas/AnyNumber"
          },
          "$less_than_future": {
            "$ref": "#/components/schemas/AnyNumber"
          },
          "$is_days_in_future": {
            "$ref": "#/components/schemas/AnyNumber"
          }
        }
      },
      "WebhookValidationRuleRules01": {
        "title": "Validation Rule Rules",
        "type": "object",
        "description": "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.",
        "properties": {
          "logic": {
            "type": "string",
            "example": "(1 and 2) and (3)",
            "description": "Defines the logic between the rules."
          }
        },
        "additionalProperties": {
          "type": "object",
          "description": "Contains the name of the validation rule.",
          "properties": {
            "name": {
              "type": "string",
              "description": "Voucherify's specific rule name.  The list of available names is provided below.  \n\n|**Type**|**Name** |\n---- | -----------|\n|**Customer** | customer.segment<br>customer.metadata* |\n|**Order** |order.amount<br>order.initial_amount<br>order.items.count<br>order.items.price_any<br>order.items.price_each<br>order.items.metadata_any (deprecated)<br>order.items.metadata_each (deprecated)<br>order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted<br>campaign.orders.amount<br>campaign.redemptions.count<br>campaign.redemptions.count.daily<br>campaign.redemptions.count.monthly<br>campaign.redemptions.customers_count<br>campaign.redemptions.customers_count.daily<br>campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount<br>redemption.count.daily<br>redemption.count.monthly<br>redemption.count.per_customer<br>redemption.count.per_customer.daily<br>redemption.count.per_customer.monthly<br>redemption.api_key<br>redemption.count.per_api_key<br>redemption.user.login<br>redemption.count.per_user<br>redemption.metadata<br>redemption.reward.pay_with_points.points_used |\n| **Product** | product.id (deprecated)<br>product.price (deprecated)<br>product.quantity (deprecated)<br>product.discount_applicable (deprecated)<br>product.metadata (deprecated)*<br>product.metadata.aggregated_quantity (deprecated)<br>product.metadata.aggregated_amount (deprecated)<br>product.metadata.discount_applicable (deprecated)<br>product.metadata.match_all (deprecated) |\n| **SKU** | sku.id (deprecated)<br>sku.price (deprecated)<br>sku.quantity (deprecated)<br>sku.discount_applicable (deprecated) |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every<br>order.items.any<br>order.items.none<br>order.items.cheapest<br>order.items.most_expensive | order.items.quantity<br>order.items.aggregated_quantity<br>order.items.price<br>order.items.aggregated_amount<br>order.items.metadata* |  \n\n\n\n*Requires the `property` field to be defined."
            },
            "property": {
              "type": [
                "string",
                "null"
              ],
              "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n customer_metadata<br>custom_event_metadata<br>order_items_metadata<br>order_metadata<br>product_metadata<br>redemption_metadata"
            },
            "conditions": {
              "$ref": "#/components/schemas/ValidationRuleConditions"
            },
            "rules": {
              "$ref": "#/components/schemas/WebhookValidationRuleRules02"
            },
            "error": {
              "type": "object",
              "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.",
              "properties": {
                "message": {
                  "type": "string",
                  "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule."
                }
              }
            }
          }
        }
      },
      "ApplicableToEffect": {
        "title": "Applicable To Effect",
        "type": "string",
        "enum": [
          "APPLY_TO_EVERY",
          "APPLY_TO_CHEAPEST",
          "APPLY_FROM_CHEAPEST",
          "APPLY_TO_MOST_EXPENSIVE",
          "APPLY_FROM_MOST_EXPENSIVE"
        ]
      },
      "DiscountAmountVouchersEffectTypes": {
        "title": "Discount Amount Vouchers Effect Types",
        "enum": [
          "APPLY_TO_ORDER",
          "APPLY_TO_ITEMS",
          "APPLY_TO_ITEMS_PROPORTIONALLY",
          "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY",
          "APPLY_TO_ITEMS_BY_QUANTITY"
        ],
        "type": "string"
      },
      "DiscountUnitVouchersEffectTypes": {
        "title": "Discount Unit Vouchers Effect Types",
        "enum": [
          "ADD_MISSING_ITEMS",
          "ADD_NEW_ITEMS",
          "ADD_MANY_ITEMS",
          "ADD_SAME_ITEMS"
        ],
        "type": "string"
      },
      "SimpleProductDiscountUnit": {
        "type": "object",
        "title": "Simple Product Discount Unit",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique product ID, assigned by Voucherify."
          },
          "source_id": {
            "type": "string",
            "description": "Product's source ID."
          },
          "name": {
            "type": "string",
            "description": "Product name."
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "SimpleSkuDiscountUnit": {
        "type": "object",
        "title": "Simple Sku Discount Unit",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique SKU ID, assigned by Voucherify."
          },
          "source_id": {
            "type": "string",
            "description": "Product variant's source ID."
          },
          "name": {
            "type": "string",
            "description": "Sku name"
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "DiscountUnitMultipleOneUnit": {
        "type": "object",
        "title": "One Unit",
        "properties": {
          "unit_off": {
            "type": "number",
            "description": "Number of units to be granted a full value discount."
          },
          "unit_off_formula": {
            "type": "string",
            "description": "Formula used to dynamically calculate the number of units."
          },
          "effect": {
            "type": "string",
            "enum": [
              "ADD_NEW_ITEMS",
              "ADD_MISSING_ITEMS"
            ],
            "description": "Defines how the unit is added to the customer's order.\n\n"
          },
          "unit_type": {
            "type": "string",
            "description": "The product deemed as free, chosen from product inventory (e.g. time, items)."
          },
          "product": {
            "description": "Contains information about the product.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SimpleProductDiscountUnit"
              }
            ]
          },
          "sku": {
            "description": "Contains information about the sku.",
            "allOf": [
              {
                "$ref": "#/components/schemas/SimpleSkuDiscountUnit"
              }
            ]
          }
        },
        "required": [
          "effect",
          "unit_type"
        ]
      },
      "DiscountPercentVouchersEffectTypes": {
        "title": "Discount Percent Vouchers Effect Types",
        "enum": [
          "APPLY_TO_ORDER",
          "APPLY_TO_ITEMS"
        ],
        "type": "string"
      },
      "DiscountFixedVouchersEffectTypes": {
        "title": "Discount Fixed Vouchers Effect Types",
        "enum": [
          "APPLY_TO_ORDER",
          "APPLY_TO_ITEMS"
        ],
        "type": "string"
      },
      "EarningRuleProportionalOrderAmount": {
        "title": "Order Amount",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "PROPORTIONAL",
            "enum": [
              "PROPORTIONAL"
            ],
            "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio."
          },
          "calculation_type": {
            "type": "string",
            "default": "ORDER_AMOUNT",
            "enum": [
              "ORDER_AMOUNT"
            ],
            "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)"
          },
          "order": {
            "type": "object",
            "required": [
              "amount"
            ],
            "properties": {
              "amount": {
                "type": "object",
                "required": [
                  "every",
                  "points"
                ],
                "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.",
                "properties": {
                  "every": {
                    "type": "integer",
                    "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000."
                  },
                  "points": {
                    "type": "integer",
                    "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card."
                  },
                  "points_formula": {
                    "type": "string",
                    "description": "Formula used to dynamically calculate the rewarded points."
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "calculation_type",
          "order"
        ]
      },
      "EarningRuleProportionalOrderTotalAmount": {
        "title": "Order Total Amount",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "PROPORTIONAL",
            "enum": [
              "PROPORTIONAL"
            ],
            "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio."
          },
          "calculation_type": {
            "type": "string",
            "default": "ORDER_TOTAL_AMOUNT",
            "enum": [
              "ORDER_TOTAL_AMOUNT"
            ],
            "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)"
          },
          "order": {
            "type": "object",
            "required": [
              "total_amount"
            ],
            "properties": {
              "total_amount": {
                "type": "object",
                "required": [
                  "every",
                  "points"
                ],
                "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.",
                "properties": {
                  "every": {
                    "type": "integer",
                    "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000."
                  },
                  "points": {
                    "type": "integer",
                    "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card."
                  },
                  "points_formula": {
                    "type": "string",
                    "description": "Formula used to dynamically calculate the rewarded points."
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "calculation_type",
          "order"
        ]
      },
      "EarningRuleProportionalOrderMetadata": {
        "title": "Order Metadata",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "default": "PROPORTIONAL",
            "enum": [
              "PROPORTIONAL"
            ],
            "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio."
          },
          "calculation_type": {
            "type": "string",
            "default": "ORDER_METADATA",
            "enum": [
              "ORDER_METADATA"
            ],
            "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object)"
          },
          "order": {
            "type": "object",
            "required": [
              "metadata"
            ],
            "description": "Defines the formula for calculating points proportionally.",
            "properties": {
              "metadata": {
                "type": "object",
                "required": [
                  "every",
                  "points",
                  "property"
                ],
                "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.",
                "properties": {
                  "every": {
                    "type": "integer",
                    "description": "For how many increments of the order metadata property to grant points for."
                  },
                  "points": {
                    "type": "integer",
                    "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card."
                  },
                  "points_formula": {
                    "type": "string",
                    "description": "Formula used to dynamically calculate the rewarded points."
                  },
                  "property": {
                    "type": "string",
                    "description": "Order metadata property."
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "calculation_type",
          "order"
        ]
      },
      "AnyOne": {
        "title": "Any",
        "type": "array",
        "items": {
          "oneOf": [
            {
              "title": "string",
              "type": "string"
            },
            {
              "title": "string - date",
              "type": "string",
              "format": "date"
            },
            {
              "title": "string - date-time",
              "type": "string",
              "format": "date-time"
            },
            {
              "title": "number",
              "type": "number"
            },
            {
              "title": "object",
              "type": "object"
            }
          ]
        },
        "maxItems": 1
      },
      "Any": {
        "title": "Any",
        "type": "array",
        "items": {
          "oneOf": [
            {
              "title": "string",
              "type": "string"
            },
            {
              "title": "string - date",
              "type": "string",
              "format": "date"
            },
            {
              "title": "string - date-time",
              "type": "string",
              "format": "date-time"
            },
            {
              "title": "number",
              "type": "number"
            },
            {
              "title": "object",
              "type": "object"
            }
          ]
        }
      },
      "AnyString": {
        "title": "Any String",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "AnyNumber": {
        "title": "Any Number",
        "type": "array",
        "items": {
          "type": "number",
          "minimum": 0
        },
        "maxItems": 1
      },
      "AnyDateDateTime": {
        "title": "Any Date and Date-Time",
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "string",
              "title": "Date",
              "format": "date"
            },
            {
              "type": "string",
              "title": "Date-time",
              "format": "date-time"
            }
          ]
        },
        "maxItems": 1
      },
      "WebhookValidationRuleRules02": {
        "title": "Validation Rule Rules",
        "type": "object",
        "description": "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.",
        "properties": {
          "logic": {
            "type": "string",
            "example": "(1 and 2) and (3)",
            "description": "Defines the logic between the rules."
          }
        },
        "additionalProperties": {
          "type": "object",
          "description": "Contains the name of the validation rule.",
          "properties": {
            "name": {
              "type": "string",
              "description": "Voucherify's specific rule name.  The list of available names is provided below.  \n\n|**Type**|**Name** |\n---- | -----------|\n|**Customer** | customer.segment<br>customer.metadata* |\n|**Order** |order.amount<br>order.initial_amount<br>order.items.count<br>order.items.price_any<br>order.items.price_each<br>order.items.metadata_any (deprecated)<br>order.items.metadata_each (deprecated)<br>order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted<br>campaign.orders.amount<br>campaign.redemptions.count<br>campaign.redemptions.count.daily<br>campaign.redemptions.count.monthly<br>campaign.redemptions.customers_count<br>campaign.redemptions.customers_count.daily<br>campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount<br>redemption.count.daily<br>redemption.count.monthly<br>redemption.count.per_customer<br>redemption.count.per_customer.daily<br>redemption.count.per_customer.monthly<br>redemption.api_key<br>redemption.count.per_api_key<br>redemption.user.login<br>redemption.count.per_user<br>redemption.metadata<br>redemption.reward.pay_with_points.points_used |\n| **Product** | product.id (deprecated)<br>product.price (deprecated)<br>product.quantity (deprecated)<br>product.discount_applicable (deprecated)<br>product.metadata (deprecated)*<br>product.metadata.aggregated_quantity (deprecated)<br>product.metadata.aggregated_amount (deprecated)<br>product.metadata.discount_applicable (deprecated)<br>product.metadata.match_all (deprecated) |\n| **SKU** | sku.id (deprecated)<br>sku.price (deprecated)<br>sku.quantity (deprecated)<br>sku.discount_applicable (deprecated) |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every<br>order.items.any<br>order.items.none<br>order.items.cheapest<br>order.items.most_expensive | order.items.quantity<br>order.items.aggregated_quantity<br>order.items.price<br>order.items.aggregated_amount<br>order.items.metadata* |  \n\n\n\n*Requires the `property` field to be defined."
            },
            "property": {
              "type": [
                "string",
                "null"
              ],
              "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n customer_metadata<br>custom_event_metadata<br>order_items_metadata<br>order_metadata<br>product_metadata<br>redemption_metadata"
            },
            "conditions": {
              "$ref": "#/components/schemas/ValidationRuleConditions"
            },
            "rules": {
              "$ref": "#/components/schemas/WebhookValidationRuleRules03"
            },
            "error": {
              "type": "object",
              "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.",
              "properties": {
                "message": {
                  "type": "string",
                  "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule."
                }
              }
            }
          }
        }
      },
      "WebhookValidationRuleRules03": {
        "title": "Validation Rule Rules",
        "type": "object",
        "description": "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.",
        "properties": {
          "logic": {
            "type": "string",
            "example": "(1 and 2) and (3)",
            "description": "Defines the logic between the rules."
          }
        },
        "additionalProperties": {
          "type": "object",
          "description": "Contains the name of the validation rule.",
          "properties": {
            "name": {
              "type": "string",
              "description": "Voucherify's specific rule name.  The list of available names is provided below.  \n\n|**Type**|**Name** |\n---- | -----------|\n|**Customer** | customer.segment<br>customer.metadata* |\n|**Order** |order.amount<br>order.initial_amount<br>order.items.count<br>order.items.price_any<br>order.items.price_each<br>order.items.metadata_any (deprecated)<br>order.items.metadata_each (deprecated)<br>order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted<br>campaign.orders.amount<br>campaign.redemptions.count<br>campaign.redemptions.count.daily<br>campaign.redemptions.count.monthly<br>campaign.redemptions.customers_count<br>campaign.redemptions.customers_count.daily<br>campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount<br>redemption.count.daily<br>redemption.count.monthly<br>redemption.count.per_customer<br>redemption.count.per_customer.daily<br>redemption.count.per_customer.monthly<br>redemption.api_key<br>redemption.count.per_api_key<br>redemption.user.login<br>redemption.count.per_user<br>redemption.metadata<br>redemption.reward.pay_with_points.points_used |\n| **Product** | product.id (deprecated)<br>product.price (deprecated)<br>product.quantity (deprecated)<br>product.discount_applicable (deprecated)<br>product.metadata (deprecated)*<br>product.metadata.aggregated_quantity (deprecated)<br>product.metadata.aggregated_amount (deprecated)<br>product.metadata.discount_applicable (deprecated)<br>product.metadata.match_all (deprecated) |\n| **SKU** | sku.id (deprecated)<br>sku.price (deprecated)<br>sku.quantity (deprecated)<br>sku.discount_applicable (deprecated) |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every<br>order.items.any<br>order.items.none<br>order.items.cheapest<br>order.items.most_expensive | order.items.quantity<br>order.items.aggregated_quantity<br>order.items.price<br>order.items.aggregated_amount<br>order.items.metadata* |  \n\n\n\n*Requires the `property` field to be defined."
            },
            "property": {
              "type": [
                "string",
                "null"
              ],
              "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n customer_metadata<br>custom_event_metadata<br>order_items_metadata<br>order_metadata<br>product_metadata<br>redemption_metadata"
            },
            "conditions": {
              "$ref": "#/components/schemas/ValidationRuleConditions"
            },
            "rules": {
              "type": "object",
              "description": "Another set of validation rules. If you need to create complex rules with more nested rules, use the validation rule builder in the dashboard."
            },
            "error": {
              "type": "object",
              "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.",
              "properties": {
                "message": {
                  "type": "string",
                  "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule."
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "EVENTS.BUS_VAL_RULE.CREATED": {
      "post": {
        "operationId": "events-bus_val_rule-created",
        "summary": "Created",
        "tags": [
          "Events bus_val_rule"
        ],
        "responses": {
          "200": {
            "description": "Webhook accepted"
          },
          "202": {
            "description": "Webhook accepted"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventBusValRuleCreatedData"
              },
              "examples": {
                "business_validation_rule.created": {
                  "value": {
                    "rule": {
                      "id": "val_rfuNf5qDB9xg",
                      "name": "Business Validation Rule – 2/15/2024",
                      "type": "expression",
                      "rules": {
                        "1": {
                          "name": "customer.segment",
                          "error": {
                            "message": "Incorrect segment"
                          },
                          "rules": {},
                          "conditions": {
                            "$is": [
                              "seg_n3vVcU5t0m3rs4rEPr3C1oU5"
                            ]
                          }
                        },
                        "2": {
                          "name": "order.initial_amount",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              9900
                            ]
                          }
                        },
                        "3": {
                          "name": "order.items.count",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              3
                            ]
                          }
                        },
                        "4": {
                          "name": "order.items.price_each",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              500
                            ]
                          }
                        },
                        "logic": " 1 AND 2 AND (  3 AND 4 )"
                      },
                      "object": "validation_rules",
                      "created_at": "2024-02-15T11:04:01.856Z",
                      "context_type": "campaign.promotion",
                      "applicable_to": {
                        "excluded": [],
                        "included": [],
                        "included_all": false
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "EVENTS.BUS_VAL_RULE.UPDATED": {
      "post": {
        "operationId": "events-bus_val_rule-updated",
        "summary": "Updated",
        "tags": [
          "Events bus_val_rule"
        ],
        "responses": {
          "200": {
            "description": "Webhook accepted"
          },
          "202": {
            "description": "Webhook accepted"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventBusValRuleUpdatedData"
              },
              "examples": {
                "business_validation_rule.updated": {
                  "value": {
                    "rule": {
                      "id": "val_WmgZXBqwCZrv",
                      "name": "Business Validation Rule – 2/9/2024",
                      "type": "expression",
                      "rules": {
                        "1": {
                          "name": "order.initial_amount",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              9900
                            ]
                          }
                        },
                        "logic": " 1"
                      },
                      "object": "validation_rules",
                      "created_at": "2024-02-09T10:15:49.306Z",
                      "updated_at": "2024-02-09T10:16:47.426Z",
                      "context_type": "campaign.discount_coupons.discount.percent.apply_to_items",
                      "applicable_to": {
                        "excluded": [
                          {
                            "id": "prod_0df14b7e7d8975079d",
                            "effect": "APPLY_TO_EVERY",
                            "object": "product",
                            "strict": false
                          },
                          {
                            "id": "pc_vmP8CPV6dC2X4a4ouI2bAJAP",
                            "effect": "APPLY_TO_EVERY",
                            "object": "products_collection",
                            "strict": false
                          }
                        ],
                        "included": [
                          {
                            "id": "prod_0de0c540ad917bb410",
                            "effect": "APPLY_TO_EVERY",
                            "object": "product",
                            "strict": false,
                            "amount_limit": 500,
                            "quantity_limit": 2,
                            "aggregated_amount_limit": 10000,
                            "aggregated_quantity_limit": 4
                          },
                          {
                            "id": "pc_Pz9rI3FroSYacwobgNT5uiNN",
                            "effect": "APPLY_TO_EVERY",
                            "object": "products_collection",
                            "strict": false,
                            "amount_limit": 5000,
                            "quantity_limit": 3,
                            "aggregated_amount_limit": 50000,
                            "aggregated_quantity_limit": 10
                          }
                        ],
                        "included_all": false
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "EVENTS.BUS_VAL_RULE.ASSIGNMENT.CREATED": {
      "post": {
        "operationId": "events-bus_val_rule-assignment-created",
        "summary": "Assignment created",
        "tags": [
          "Events bus_val_rule"
        ],
        "responses": {
          "200": {
            "description": "Webhook accepted"
          },
          "202": {
            "description": "Webhook accepted"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventBusValRuleAssignmentCreatedData"
              },
              "examples": {
                "business_validation_rule.assignment.created": {
                  "value": {
                    "rule": {
                      "id": "val_WmgZXBqwCZrv",
                      "name": "Business Validation Rule – 2/9/2024",
                      "type": "expression",
                      "rules": {
                        "1": {
                          "name": "order.initial_amount",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              9900
                            ]
                          }
                        },
                        "logic": " 1"
                      },
                      "object": "validation_rules",
                      "created_at": "2024-02-09T10:15:49.306Z",
                      "updated_at": "2024-02-09T10:16:47.426Z",
                      "context_type": "campaign.discount_coupons.discount.percent.apply_to_items",
                      "applicable_to": {
                        "excluded": [
                          {
                            "id": "prod_0df14b7e7d8975079d",
                            "effect": "APPLY_TO_EVERY",
                            "object": "product",
                            "strict": false
                          },
                          {
                            "id": "pc_vmP8CPV6dC2X4a4ouI2bAJAP",
                            "effect": "APPLY_TO_EVERY",
                            "object": "products_collection",
                            "strict": false
                          }
                        ],
                        "included": [
                          {
                            "id": "prod_0de0c540ad917bb410",
                            "effect": "APPLY_TO_EVERY",
                            "object": "product",
                            "strict": false,
                            "amount_limit": 500,
                            "quantity_limit": 2,
                            "aggregated_amount_limit": 10000,
                            "aggregated_quantity_limit": 4
                          },
                          {
                            "id": "pc_Pz9rI3FroSYacwobgNT5uiNN",
                            "effect": "APPLY_TO_EVERY",
                            "object": "products_collection",
                            "strict": false,
                            "amount_limit": 5000,
                            "quantity_limit": 3,
                            "aggregated_amount_limit": 50000,
                            "aggregated_quantity_limit": 10
                          }
                        ],
                        "included_all": false
                      }
                    },
                    "voucher": {
                      "id": "v_sgi3vqxJZ4rg1WHS1iyyTVskoRqoMpUp",
                      "code": "Test-applicable-1",
                      "type": "DISCOUNT_VOUCHER",
                      "active": true,
                      "object": "voucher",
                      "campaign": "Test-campaign-applicable-to",
                      "discount": {
                        "type": "PERCENT",
                        "effect": "APPLY_TO_ITEMS",
                        "percent_off": 5,
                        "amount_limit": 15000,
                        "aggregated_amount_limit": 30000
                      },
                      "metadata": {},
                      "created_at": "2024-02-09T10:16:04.749Z",
                      "redemption": {
                        "quantity": null,
                        "redeemed_quantity": 0
                      },
                      "campaign_id": "camp_18NCNUkQIaXnqbHqhtQnt355",
                      "category_id": null,
                      "is_referral_code": false
                    },
                    "campaign": {
                      "id": "camp_18NCNUkQIaXnqbHqhtQnt355",
                      "object": "campaign"
                    },
                    "assignment": {
                      "id": "asgm_6wuh8m2Ic1aT3NHD",
                      "object": "validation_rules_assignment",
                      "rule_id": "val_WmgZXBqwCZrv",
                      "created_at": "2024-02-09T10:16:47.835Z",
                      "related_object_id": "v_sgi3vqxJZ4rg1WHS1iyyTVskoRqoMpUp",
                      "related_object_type": "voucher"
                    },
                    "distribution": null,
                    "earning_rule": null,
                    "promotion_tier": null
                  }
                }
              }
            }
          }
        }
      }
    },
    "EVENTS.BUS_VAL_RULE.ASSIGNMENT.DELETED": {
      "post": {
        "operationId": "events-bus_val_rule-assignment-deleted",
        "summary": "Assignment deleted",
        "tags": [
          "Events bus_val_rule"
        ],
        "responses": {
          "200": {
            "description": "Webhook accepted"
          },
          "202": {
            "description": "Webhook accepted"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventBusValRuleAssignmentDeletedData"
              },
              "examples": {
                "business_validation_rule.assignment.deleted": {
                  "value": {
                    "rule": {
                      "id": "val_w59dYLHbkcn5",
                      "name": "Initial amount more than 99",
                      "type": "expression",
                      "error": {
                        "message": "The initial amount is too low"
                      },
                      "rules": {
                        "1": {
                          "name": "order.initial_amount",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              9900
                            ]
                          }
                        },
                        "logic": " 1"
                      },
                      "object": "validation_rules",
                      "created_at": "2024-02-12T10:19:09.557Z",
                      "context_type": "global",
                      "applicable_to": {
                        "excluded": [],
                        "included": [],
                        "included_all": false
                      }
                    },
                    "campaign": {
                      "id": "camp_AQZ1GLRlbGaC2dETd31VbJQ9",
                      "object": "campaign"
                    },
                    "assignment": {
                      "id": "asgm_zlMpWI5mPVG6x3dg",
                      "object": "validation_rules_assignment",
                      "rule_id": "val_w59dYLHbkcn5",
                      "created_at": "2024-02-15T12:46:57.959Z",
                      "updated_at": "2024-02-15T14:02:47.889Z",
                      "related_object_id": "ern_FQxftbKUq9E93k00Z3qkC0sX",
                      "related_object_type": "earning_rule"
                    },
                    "distribution": null,
                    "earning_rule": {
                      "id": "ern_FQxftbKUq9E93k00Z3qkC0sX",
                      "active": true,
                      "metadata": {},
                      "parameters": {
                        "event": "order.paid",
                        "banner": "Order-paid",
                        "loyalty": {
                          "type": "PROPORTIONAL",
                          "order": {
                            "total_amount": {
                              "every": 500,
                              "points": 10
                            }
                          },
                          "calculation_type": "ORDER_TOTAL_AMOUNT"
                        }
                      },
                      "campaign_id": "camp_AQZ1GLRlbGaC2dETd31VbJQ9",
                      "automation_id": "auto_sRc6onPl70seyfrGOXhwDxYE",
                      "validation_rule_id": null
                    },
                    "promotion_tier": null
                  }
                }
              }
            }
          }
        }
      }
    },
    "EVENTS.BUS_VAL_RULE.DELETED": {
      "post": {
        "operationId": "events-bus_val_rule-deleted",
        "summary": "Deleted",
        "tags": [
          "Events bus_val_rule"
        ],
        "responses": {
          "200": {
            "description": "Webhook accepted"
          },
          "202": {
            "description": "Webhook accepted"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventBusValRuleDeletedData"
              },
              "examples": {
                "business_validation_rule.deleted": {
                  "value": {
                    "rule": {
                      "id": "val_rfuNf5qDB9xg",
                      "name": "Business Validation Rule – 2/15/2024",
                      "type": "expression",
                      "rules": {
                        "1": {
                          "name": "customer.segment",
                          "error": {
                            "message": "Incorrect segment"
                          },
                          "rules": {},
                          "conditions": {
                            "$is": [
                              "seg_n3vVcU5t0m3rs4rEPr3C1oU5"
                            ]
                          }
                        },
                        "2": {
                          "name": "order.initial_amount",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              9900
                            ]
                          }
                        },
                        "3": {
                          "name": "order.items.count",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              3
                            ]
                          }
                        },
                        "4": {
                          "name": "order.items.price_each",
                          "rules": {},
                          "conditions": {
                            "$more_than": [
                              500
                            ]
                          }
                        },
                        "logic": " 1 AND 2 AND (  3 AND 4 )"
                      },
                      "object": "validation_rules",
                      "created_at": "2024-02-15T11:04:01.856Z",
                      "updated_at": "2024-02-15T11:06:04.849Z",
                      "context_type": "campaign.promotion",
                      "applicable_to": {
                        "excluded": [],
                        "included": [],
                        "included_all": false
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}