Create Publication
This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.
A voucher is suitable for publication when it's active and hasn't been published yet.
🚧 Clearly define the source of the voucher
You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code.
🚧 Publish multiple vouchers In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish.
📘 Auto-update campaign
In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an auto-update campaign.
Query parameters
Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer.
Request body
Example request
{
"campaign": {
"name": "camp_dphuwqH7BOVkgh4JmpDtS32l"
}
}Response
Returns a publication object if a valid identifier was provided.
Example response
{
"id": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp",
"created_at": "2022-09-23T09:57:00.434Z",
"customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4",
"customer": {
"summary": {
"orders": {
"last_order_date": "2022-08-30T11:51:08.029Z"
}
},
"referrals": {
"campaigns": [
{
"campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal",
"referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi",
"related_object_id": "r_0b9d4cc4aa164dd073",
"date": "2022-08-30T10:19:39.196Z"
}
]
},
"created_at": "2022-08-30T06:32:07.380Z",
"updated_at": "2022-08-31T06:32:07.380Z"
},
"vouchers_id": [
"v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA"
],
"voucher": {
"id": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV",
"code": "WVPblOYX",
"campaign": "Gift Card Campaign",
"campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV",
"category_id": "cat_0bb343dee3cdb5ec0c",
"gift": {
"amount": 10000,
"balance": 500
},
"loyalty_card": {
"points": 7000,
"balance": 6970,
"next_expiration_date": "2023-05-30"
},
"start_date": "2021-12-01T00:00:00.000Z",
"expiration_date": "2021-12-31T00:00:00.000Z",
"validity_timeframe": {
"duration": "PT1H",
"interval": "P2D"
},
"validity_hours": {
"daily": [
{
"start_time": "12:00",
"expiration_time": "14:00"
}
]
},
"assets": {
"qr": {
"id": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==",
"url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D"
},
"barcode": {
"id": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==",
"url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D"
}
},
"created_at": "2021-12-22T10:13:06.487Z",
"updated_at": "2021-12-22T10:14:45.316Z",
"holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4",
"referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
"publish": {
"url": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10"
},
"redemption": {
"redeemed_quantity": 1,
"redeemed_points": 100000,
"url": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10"
},
"categories": [
{
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z"
}
],
"validation_rules_assignments": {
"data": [
{
"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"
]
}
]
}
}
}