The campaign object

Data model description

A campaign is used to group vouchers or promotion tiers of a specific type. Amongst others, the campaign type describes the discount you want to offer your customers and its validity timeframe. In case of voucher campaign, once you create a new campaign, Voucherify will generate a given number of codes. We put together a tutorial on how to create one.

Attributes

Description

Example

id
string

object
string

Type of the object represented by JSON. Value is campaign.

type
string

Campaign's type.

Voucherify offers two types:

  • STATIC - can't be changed after it's created - system will not generate new vouchers to this campaign.
  • AUTO-UPDATE - choosing the auto update option will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method).

STATIC (default)
or
AUTO_UPDATE

name
string

start_date
string, ISO 8601 date format

When the campaign begins. Before this date vouchers are inactive.

2016-11-16T14:14:31Z

expiration_date
string, ISO 8601 date format

When the campaign ends. After this date vouchers are inactive.

2020-11-16T14:14:31Z

voucher
object

A description of the vouchers collected in campaign. It contains whole voucher definition which is being used to generate unique codes along with the campaign creation. The same parameters are being used when you add new codes after campaign creation date.

"voucher": {
  "code_config": {
    "length": 8,
    "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
    "prefix": null,
    "postfix": null,
    "pattern": "TC6-PROMO-#######"
  },
  "type": "DISCOUNT_VOUCHER",
  "discount": {
    "type": "PERCENT",
    "percent_off": 10
  },
  "start_date": "2016-09-26T00:00:00Z",
  "expiration_date": "2020-12-26T00:00:00Z",
  "redemption": {
    "quantity": 1
  }
}

validation_rules_assignments
object

List of The validation rule assignment object

vouchers_count
integer

The size of the list of vouchers generated for campaign.

vouchers_generation_status
string

Status describing codes generation progress. Possible values: IN_PROGRESS, DONE, ERROR

metadata
object

A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.

"metadata": {
    "test": true,
    "locale": "pl-en"
}

description
string

A field to keep any extra textual information.

active
boolean

A flag that allows to disable a campaign even though it's within its activity period.

{
  "name": "TC6 - test campaign - 11",
  "object": "campaign",
  "type": "AUTO_UPDATE",
  "description": "test",
  "active": true,
  "metadata": {
    "test": true
  },
  "voucher": {
    "code_config": {
      "length": 8,
      "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
      "prefix": null,
      "postfix": null,
      "pattern": "TC6-PROMO-#######"
    },
    "type": "DISCOUNT_VOUCHER",
    "discount": {
      "type": "PERCENT",
      "percent_off": 10
    },
    "start_date": "2016-09-26T00:00:00Z",
    "expiration_date": "2020-12-26T00:00:00Z",
    "redemption": {
      "quantity": 1
    }
  }
}