curl --request POST \
--url https://{cluster}.voucherify.io/v1/templates/campaigns/{campaignTemplateId}/campaign-setup \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"name": "Campaign-out-of-template",
"description": "Created out of a template",
"auto_join": true,
"join_once": true
}
'{
"created_resources": [
{
"id": "val_3LBFw25WTmAK",
"object": "validation_rules"
}
],
"campaign": {
"id": "camp_txDwyDPeLvBEq490bfV2nLwo",
"name": "Campaign-out-of-template",
"campaign_type": "DISCOUNT_COUPONS",
"type": "AUTO_UPDATE",
"is_referral_code": false,
"voucher": {
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
"amount_off": 2500,
"aggregated_amount_limit": 25000,
"units": null,
"effect": "APPLY_TO_ITEMS"
},
"gift": null,
"loyalty_card": null,
"redemption": {
"quantity": 4,
"redeemed_quantity": 0
},
"code_config": {
"pattern": "##",
"length": 2,
"charset": "xD",
"prefix": "U-",
"postfix": "-WOT"
}
},
"auto_join": true,
"join_once": true,
"use_voucher_metadata_schema": true,
"description": "Winter 2024-25",
"start_date": null,
"expiration_date": null,
"validity_timeframe": null,
"validity_hours": null,
"validity_day_of_week": null,
"activity_duration_after_publishing": null,
"vouchers_count_invalid": null,
"vouchers_count": 0,
"active": true,
"metadata": null,
"created_at": "2024-09-26T17:14:56.226Z",
"updated_at": null,
"category": null,
"creation_status": "DONE",
"protected": false,
"validation_rules_assignments": {
"data": [
{
"id": "asgm_BLgJYmo64rnAK5eB",
"rule_id": "val_3LBFw25WTmAK",
"related_object_id": "camp_txDwyDPeLvBEq490bfV2nLwo",
"related_object_type": "campaign",
"created_at": "2024-09-26T17:14:56.226Z",
"object": "validation_rules_assignment"
}
],
"total": 1
},
"object": "campaign",
"deleted": false,
"deleted_at": null,
"category_id": null,
"voucher_type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
"amount_off": 2500,
"aggregated_amount_limit": 25000,
"units": null,
"effect": "APPLY_TO_ITEMS"
},
"gift": null,
"loyalty_card": null,
"voucher_code_config": {
"pattern": "##",
"length": 2,
"charset": "xD",
"prefix": "Your-",
"postfix": "-Voucher"
},
"default_voucher_redemption": {
"quantity": 4
}
},
"object": "campaign_setup"
}{
"code": 404,
"key": "not_found",
"message": "Resource not found",
"details": "Cannot find campaign_template with id camp_tpl_zLtn2H9fgcG3NwO7t4PAfHc",
"request_id": "v-0f6d3efe61099b2824",
"resource_id": "camp_tpl_zLtn2H9fgcG3NwO7t4PAfHc",
"resource_type": "campaign_template"
}{
"code": 409,
"key": "duplicate_found",
"message": "Duplicated resource found",
"details": "Duplicated campaign exists with name CampaignFromTemplate-01",
"request_id": "v-0f754b9c091c095e33",
"resource_id": "CampaignFromTemplate-01",
"resource_type": "campaign"
}Create Campaign From Template
Creates a campaign out of a campaign template.
To create a campaign, you need to provide the name in the request, while other fields are optional. If no other fields are sent, the configuration from the template will be used.
You can send new values of the fields listed below to replace the settings saved in the template. However, you cannot assign an existing validation rule or create a new one in the request. If the template has a validation rule, a new validation rule is always created for the campaign. When the campaign has been created, then you can:
You can create a campaign template out of a promotion tier. Promotion tiers are converted to a discount campaign with the DISCOUNT_COUPON type. You can use this template to create:
Read the Campaign Templates documentation to learn more about this feature.
curl --request POST \
--url https://{cluster}.voucherify.io/v1/templates/campaigns/{campaignTemplateId}/campaign-setup \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"name": "Campaign-out-of-template",
"description": "Created out of a template",
"auto_join": true,
"join_once": true
}
'{
"created_resources": [
{
"id": "val_3LBFw25WTmAK",
"object": "validation_rules"
}
],
"campaign": {
"id": "camp_txDwyDPeLvBEq490bfV2nLwo",
"name": "Campaign-out-of-template",
"campaign_type": "DISCOUNT_COUPONS",
"type": "AUTO_UPDATE",
"is_referral_code": false,
"voucher": {
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
"amount_off": 2500,
"aggregated_amount_limit": 25000,
"units": null,
"effect": "APPLY_TO_ITEMS"
},
"gift": null,
"loyalty_card": null,
"redemption": {
"quantity": 4,
"redeemed_quantity": 0
},
"code_config": {
"pattern": "##",
"length": 2,
"charset": "xD",
"prefix": "U-",
"postfix": "-WOT"
}
},
"auto_join": true,
"join_once": true,
"use_voucher_metadata_schema": true,
"description": "Winter 2024-25",
"start_date": null,
"expiration_date": null,
"validity_timeframe": null,
"validity_hours": null,
"validity_day_of_week": null,
"activity_duration_after_publishing": null,
"vouchers_count_invalid": null,
"vouchers_count": 0,
"active": true,
"metadata": null,
"created_at": "2024-09-26T17:14:56.226Z",
"updated_at": null,
"category": null,
"creation_status": "DONE",
"protected": false,
"validation_rules_assignments": {
"data": [
{
"id": "asgm_BLgJYmo64rnAK5eB",
"rule_id": "val_3LBFw25WTmAK",
"related_object_id": "camp_txDwyDPeLvBEq490bfV2nLwo",
"related_object_type": "campaign",
"created_at": "2024-09-26T17:14:56.226Z",
"object": "validation_rules_assignment"
}
],
"total": 1
},
"object": "campaign",
"deleted": false,
"deleted_at": null,
"category_id": null,
"voucher_type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
"amount_off": 2500,
"aggregated_amount_limit": 25000,
"units": null,
"effect": "APPLY_TO_ITEMS"
},
"gift": null,
"loyalty_card": null,
"voucher_code_config": {
"pattern": "##",
"length": 2,
"charset": "xD",
"prefix": "Your-",
"postfix": "-Voucher"
},
"default_voucher_redemption": {
"quantity": 4
}
},
"object": "campaign_setup"
}{
"code": 404,
"key": "not_found",
"message": "Resource not found",
"details": "Cannot find campaign_template with id camp_tpl_zLtn2H9fgcG3NwO7t4PAfHc",
"request_id": "v-0f6d3efe61099b2824",
"resource_id": "camp_tpl_zLtn2H9fgcG3NwO7t4PAfHc",
"resource_type": "campaign_template"
}{
"code": 409,
"key": "duplicate_found",
"message": "Duplicated resource found",
"details": "Duplicated campaign exists with name CampaignFromTemplate-01",
"request_id": "v-0f754b9c091c095e33",
"resource_id": "CampaignFromTemplate-01",
"resource_type": "campaign"
}Authorizations
Scopes
Path Parameters
Body
Only name is required. The rest of the fields will overwrite the template configuration.
Request body schema for POST /v1/templates/campaigns/{campaignTemplateId}/campaign-setup.
Defines whether the campaign can be updated with new vouchers after campaign creation or if the campaign consists of generic (standalone) vouchers.
AUTO_UPDATE: the campaign is dynamic, i.e. vouchers will generate based on set criteriaSTATIC: vouchers need to be manually publishedSTANDALONE: the campaign is a generic (standalone) one with a single voucher for public use (only for discount and gift card campaigns)
AUTO_UPDATE, STATIC, STANDALONE Assigns or unassigns an area or store to the campaign.
NOTE: this object can be sent if the Areas and Stores enterprise feature is enabled. Contact Voucherify Sales to learn more.
Show child attributes
Show child attributes
Response
Returns the details about the created campaign 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}/campaign-setup.

