Campaign Object

Data model description

AttributesDescriptionExample
id

Unique campaign ID, assigned by Voucherify.

camp_f7fBbQxUuTN7dI7tGOo5XMDA

name

Campaign name.

description

An optional field to keep any extra textual information about the campaign such as a campaign description and details.

campaign_type

Type of campaign.

Available values: LOYALTY_PROGRAM, GIFT_VOUCHERS, DISCOUNT_COUPONS, PROMOTION, REFERRAL_PROGRAM, LUCKY_DRAW
type

Defines whether the campaign can be updated with new vouchers after campaign creation.

  • AUTO_UPDATE: the campaign is dynamic, i.e. vouchers will generate based on set criteria
  • STATIC: vouchers need to be manually published
Available values: AUTO_UPDATE, STATIC
voucherAny of:

Discount Voucher

AttributesDescriptionExample
type

Type of voucher.

discount

Defines the voucher discount type and details.

One of:

Amount

AttributesDescriptionExample
type

Applies an amount discount.

amount_off

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. In case of the amount being calculated by the formula, i.e. the amount_off_formula parameter is present in the amount 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 amount off.

100

amount_off_formula

Formula used to calculate the discount.

effect

Defines how the discount is applied to the customer's order

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS, APPLY_TO_ITEMS_PROPORTIONALLY, APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, APPLY_TO_ITEMS_BY_QUANTITY

Percentage

AttributesDescriptionExample
type

Applies a percentage discount.

amount_limit

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.

percent_off

Percent taken off the subtotal amount. In case of the percent being calculated by the formula, i.e. the percent_off_formula parameter is present in the percent 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 percent off.

percent_off_formula

Formula used to calculate the discount.

effect

Defines how the discount is applied to the customer's order.

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS

Fixed

AttributesDescriptionExample
type

Sets a fixed total on cart or item(s) and then calculates the discount to apply.

fixed_amount

Set a fixed valued for an order total or price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. In case of the fixed amount being calculated by the formula, i.e. the fixed_amount_formula parameter is present in the fixed amount 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 value.

1000

fixed_amount_formula

Formula used to calculate the discounted price of an item or a new order total.

effect
EffectDefinition
APPLY_TO_ORDERSets the order total amount to the value of the fixed amount. The discount value is calculated dynamically during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. For example, if the fixed amount is set to equal $10 and the order amount equals $25, then the calculated discount will be $15.
APPLY_TO_ITEMSSets a new price on items. The total discount amount is dynamically calculated during the redemption and it's a difference between the initial item price and the fixed amount. During the redemption, prices for items will change only if the new price is lower than the original price. If the new product price you set is different from the product price in a collection, then the new product price will be passed during the redemption. If a prodct is in more than one collection, the price is always changed to the lowest price. The new price for products with several SKUs will force the price change for SKUs if their original price is higher than the new price.
Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS

Unit, single item

AttributesDescriptionExample
type

Applies a full value discount to item(s).

unit_off

Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the unit_off_formula parameter is present in the unit 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 unit value.

1

unit_off_formula

Formula used to calculate the number of units.

unit_type

The product deemed as free, chosen from the product inventory (e.g. time, items).

prod_f1r5Tpr0DuC7

effect

Defines how the unit is added to the customer's order.

Available values: ADD_NEW_ITEMS, ADD_MISSING_ITEMS

Unit, multiple items

AttributesDescriptionExample
type

Applies a full value discount to item(s).

effect

Defines the effect for adding multiple item types.

units

Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.

Array of:
AttributesDescriptionExample
unit_off

Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the unit_off_formula parameter is present in the unit 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 unit value.

1

unit_off_formula

Formula used to calculate the number of units.

unit_type

The product deemed as free, chosen from the product inventory (e.g. time, items).

prod_f1r5Tpr0DuC7

effect

Defines how the unit is added to the customer's order.

Available values: ADD_NEW_ITEMS, ADD_MISSING_ITEMS

Shipping

AttributesDescriptionExample
type

Applies a full value discount to item(s).

unit_off

Subtracts 1 shipping item from the subtotal.

unit_type

The shipping product deemed as free.

effect

Defines how the unit is added to the customer's order.

redemption

Defines the redemption limits on vouchers.

AttributesDescriptionExample
quantity

How many times a voucher can be redeemed. A null value means unlimited.

code_config

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescriptionExample
length

Number of characters in a generated code (excluding prefix and postfix).

charset

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix

A text appended before the code.

postfix

A text appended after the code.

pattern

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

is_referral_code

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

Gift Card

AttributesDescriptionExample
type

Type of voucher.

gift

Defines the gift card details.

AttributesDescriptionExample
amount

Initial gift card income to be applied to the gift card at voucher generation. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

effect

Defines how the credits are applied to the customer's order.

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS
redemption

Defines the redemption limits on vouchers.

AttributesDescriptionExample
quantity

How many times a voucher can be redeemed. A null value means unlimited.

code_config

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescriptionExample
length

Number of characters in a generated code (excluding prefix and postfix).

charset

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix

A text appended before the code.

postfix

A text appended after the code.

pattern

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

is_referral_code

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

Loyalty Card

AttributesDescriptionExample
type

Type of voucher.

loyalty_card

Defines the loyalty card details.

AttributesDescriptionExample
points

Initial loyalty card income in points to be applied to the loyalty card at voucher generation.

expiration_rules

Defines point expiration rules.

AttributesDescriptionExample
period_type

The expiration period.

Available values: MONTH
period_value

How many periods should pass before the expiration occurs.

rounding_type

Round up expiration till the end of the given period type.

Available values: END_OF_MONTH, END_OF_QUARTER, END_OF_HALF_YEAR, END_OF_YEAR, PARTICULAR_MONTH
redemption

Defines the redemption limits on vouchers.

AttributesDescriptionExample
quantity

How many times a voucher can be redeemed. A null value means unlimited.

code_config

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescriptionExample
length

Number of characters in a generated code (excluding prefix and postfix).

charset

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix

A text appended before the code.

postfix

A text appended after the code.

pattern

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

is_referral_code

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

auto_join

Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.

join_once

If this value is set to true, customers will be able to join the campaign only once.

use_voucher_metadata_schema

Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.

validity_timeframe

Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.

AttributesDescriptionExample
interval

Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an interval of P2D will be active every other day.

duration

Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a duration of P1D will be valid for a duration of one day.

validity_day_of_week

Integer array corresponding to the particular days of the week in which the campaign is valid.

  • 0 Sunday
  • 1 Monday
  • 2 Tuesday
  • 3 Wednesday
  • 4 Thursday
  • 5 Friday
  • 6 Saturday
activity_duration_after_publishing

Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a duration of P24D will be valid for a duration of 24 days.

vouchers_count

Total number of unique vouchers in campaign.

start_date

Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is inactive before this date.

2022-09-20T00:00:00.000Z

expiration_date

Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is inactive after this date.

2022-09-30T00:00:00.000Z

active

A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the start_date and expiration_date.

  • true indicates an active campaign
  • false indicates an inactive campaign
metadata

The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.

created_at

Timestamp representing the date and time when the campaign was created in ISO 8601 format.

2021-12-01T08:00:50.038Z

updated_at

Timestamp representing the date and time when the voucher was updated in ISO 8601 format.

2022-09-20T09:18:19.623Z

category

Unique category name.

creation_status

Indicates the status of the campaign creation.

Available values: DONE, IN_PROGRESS, FAILED, DRAFT, MODIFYING
vouchers_generation_status

Indicates the status of the campaign's vouchers.

Available values: DONE, IN_PROGRESS, FAILED, DRAFT
protected

Indicates whether the resource can be deleted.

category_id

Unique category ID that this campaign belongs to.

cat_0b688929a2476386a7

categories
object

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

referral_program

Defines the referee reward and the way a referral is triggered. Context: REFERRAL_PROGRAM.

AttributesDescriptionExample
conversion_event_type

How a referral is triggered.

Available values: redemption, custom_event
custom_event

Contains details about the custom event.

AttributesDescriptionExample
id

Unique custom event ID.

ms_fi47Dcu5T0m3v3nT5ch3ma

name

Custom event name.

referee_reward

Defines the referee reward.

AttributesDescriptionExample
related_object_parent

Details of the resource from which the reward originates.

AttributesDescriptionExample
id

Unique ID of the reward source.

name

Name of the reward source.

object

Type of resource represented by the source of the reward.

type

Type of reward.

Available values: LOYALTY_CARD, GIFT_VOUCHER
amount

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.

promotion
loyalty_tiers_expiration

Defines the expiration mechanism for loyalty tiers.

Any of:

Balance

AttributesDescriptionExample
qualification_type

Tier qualification.

BALANCE: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier.

Available values: BALANCE
start_date

Defines the conditions for the start date of the tier.

AttributesDescriptionExample
type

What triggers the tier to be valid for a customer.
IMMEDIATE: After reaching the minimum required points.

Available values: IMMEDIATE
expiration_date

Defines the conditions for the expiration date of a tier.

Any of:

Balance Drop

AttributesDescriptionExample
type

What triggers the tier to expire for a customer.
BALANCE_DROP: Tier expires when the points balance drops below the required range of the tier.

Available values: BALANCE_DROP

Custom

AttributesDescriptionExample
type

What triggers the tier to expire for a customer.
CUSTOM: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.

Available values: CUSTOM
extend

Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months.

rounding

Defines the rounding mechanism for tier expiration.

Any of:

Calendar Periods

AttributesDescriptionExample
type

Period to which the expiration will be rounded to.

  • MONTH: The expiration date will be rounded to the end of the month.
  • QUARTER: The expiration date will be rounded to the end of the quarter.
  • HALF_YEAR: The expiration date will be rounded to the half year.
  • YEAR: The expiration date will be rounded to the end of the year.
Available values: MONTH, QUARTER, HALF_YEAR, YEAR
strategy

Which portion of the given period should the rounding be applied to.

Available values: END

Specific Month

AttributesDescriptionExample
type

This mechanism describes a custom rounding for the expiration date.

Available values: CUSTOM
strategy

Which portion of the given period should the rounding be applied to.

Available values: END
unit

Defines the type of unit of time in which the rounding period is counted.

Available values: MONTH
value

Value for the unit of time that the rounding applies to. Units for this parameter are defined by the rounding.unit parameter.

  • 0: January
  • 1: February
  • 2: March
  • 3: April
  • 4: May
  • 5: June
  • 6: July
  • 7: August
  • 8: September
  • 9: October
  • 10: November
  • 11: December

Points in Period

AttributesDescriptionExample
qualification_type

Tier qualification.

POINTS_IN_PERIOD: A customer qualifies for the tier only if the sum of the accumulated points in a defined time interval reaches the tier threshold.

Available values: POINTS_IN_PERIOD
qualification_period

Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period.

PeriodDefinition
Calendar MonthPoints collected in one calendar month
January, February, March, etc.
Calendar QuarterPoints collected in the quarter
- January - March
- April - June
- July - September
- October - December
Calendar Half-yearPoints collected in the half-year
- January - June
- July - December
Calendar YearPoints collected in one calendar year
January - December
Available values: MONTH, QUARTER, HALF_YEAR, YEAR
start_date

Defines the conditions for the start date of the tier.

AttributesDescriptionExample
type

What triggers the tier to be valid for a customer.
IMMEDIATE: After reaching the minimum required points.
NEXT_PERIOD: When the next qualification period starts.

Available values: IMMEDIATE, NEXT_PERIOD
expiration_date

Defines the conditions for the expiration date of a tier.

AttributesDescriptionExample
type

What triggers the tier to expire for a customer.
END_OF_PERIOD: Expire tier at the end of the period.
END_OF_NEXT_PERIOD: Expire tier at the end of the next period.

Available values: END_OF_PERIOD, END_OF_NEXT_PERIOD
extend

Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of P3M will be valid for an additional duration of 3 months and a tier with a duration of P1D will be valid for an additional duration of 1 day.

Language
URL
Click Try It! to start a request and see the response here!