Skip to main content
POST
/
v1
/
templates
/
campaigns
/
{campaignTemplateId}
/
tier-setup
Add Promotion Tier From Template
curl --request POST \
  --url https://{cluster}.voucherify.io/v1/templates/campaigns/{campaignTemplateId}/tier-setup \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '{
  "campaign_id": "<string>",
  "name": "<string>",
  "banner": "<string>",
  "metadata": {},
  "hierarchy": 123,
  "active": true,
  "start_date": "2022-09-23T00:00:00.000Z",
  "expiration_date": "2022-09-26T00:00:00.000Z",
  "validity_timeframe": {
    "duration": "PT1H",
    "interval": "P2D"
  },
  "validity_day_of_week": [
    0
  ],
  "validity_hours": {
    "daily": [
      {
        "start_time": "12:00",
        "days_of_week": [
          0
        ],
        "expiration_time": "14:00"
      }
    ]
  },
  "category": "cat_0c9da30e7116ba6bba",
  "category_id": "cat_0c9da30e7116ba6bba"
}'
{
  "created_resources": [
    {
      "id": "val_Z2QPKZhfIlW1",
      "object": "validation_rules"
    }
  ],
  "promotion_tier": {
    "id": "promo_FHRjE8g5Cu2C1C5voqjijl5I",
    "created_at": "2024-10-07T14:40:20.125Z",
    "name": "metadata-test-template-02",
    "banner": null,
    "action": {
      "discount": {
        "type": "AMOUNT",
        "amount_off": 300,
        "aggregated_amount_limit": 900,
        "units": null,
        "effect": "APPLY_TO_ITEMS"
      }
    },
    "metadata": {},
    "hierarchy": 9,
    "campaign": {
      "id": "camp_1oOwcEGaNELf8G5sVN77z0ou",
      "start_date": null,
      "expiration_date": null,
      "active": true,
      "object": "campaign",
      "name": "Promotion request test",
      "created_at": "2024-07-26T11:00:51.278Z",
      "campaign_type": "PROMOTION",
      "category_id": "cat_0d75bdfe4c9030a732",
      "categories": []
    },
    "campaign_id": "camp_1oOwcEGaNELf8G5sVN77z0ou",
    "summary": {
      "redemptions": {
        "total_redeemed": 0
      },
      "orders": {
        "total_amount": 0,
        "total_discount_amount": 0
      }
    },
    "active": true,
    "validity_day_of_week": null,
    "category_id": null,
    "categories": [],
    "object": "promotion_tier",
    "validation_rules_assignments": [
      {
        "id": "asgm_n1ILxyVhKjyACbVL",
        "rule_id": "val_Z2QPKZhfIlW1",
        "related_object_id": "promo_FHRjE8g5Cu2C1C5voqjijl5I",
        "related_object_type": "promotion_tier",
        "created_at": "2024-10-07T14:40:20.125Z",
        "object": "validation_rules_assignment"
      }
    ]
  },
  "object": "promotion_tier_setup"
}

Authorizations

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

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

Path Parameters

campaignTemplateId
string
required

Pass the campaign template ID that was assigned by Voucherify.

Example:

"camp_tpl_zLtn2H9fgcG3NwO7t4PAfHcq"

Body

application/json

Only name and campaign_id are required. The rest of the fields will overwrite the template configuration.

Request body schema for POST /v1/templates/campaigns/{campaignTemplateId}/tier-setup.

campaign_id
string
required

Unique campaign identifier, assigned by Voucherify. Defines the promotion campaign to which the promotion tier will be added.

name
string
required

Name of the promotion tier.

banner
string

Text to be displayed to your customers on your website.

metadata
object

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

hierarchy
integer

The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.

active
boolean

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

  • true indicates an active promotion tier
  • false indicates an inactive promotion tier
start_date
string<date-time>

Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is inactive before this date.

Example:

"2022-09-23T00:00:00.000Z"

expiration_date
string<date-time>

Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is inactive after this date.

Example:

"2022-09-26T00:00:00.000Z"

validity_timeframe
object

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.

validity_day_of_week
enum<integer>[]

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

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

Determines the hours of validity, e.g. to create a happy hours scenario.

category
string

Assign a new or update the promotion tier's category using name.

Example:

"cat_0c9da30e7116ba6bba"

category_id
string

Assign a new or update the promotion tier's category using id

Example:

"cat_0c9da30e7116ba6bba"

Response

Returns the details about the added promotion tier and about the resources that have been created out of the template and added to the project.

Response body schema for POST /v1/templates/campaigns/{campaignTemplateId}/tier-setup.

created_resources
object[]
required

Contains a list of resources that have been added to the project when the promotion tier has been created out of the template.

object
enum<string>
required

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

Available options:
promotion_tier_setup
promotion_tier
object

Details of the added promotion tier. This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone.

I