Add Voucher with Specific Code to Campaign
curl --request POST \
--url https://{cluster}.voucherify.io/v1/campaigns/{campaignId}/vouchers/{code} \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"category_id": "cat_0bb81a481615a37b5e",
"start_date": "2022-09-24T00:00:00Z",
"expiration_date": "2022-09-25T23:59:59Z",
"active": false,
"redemption": {
"quantity": null
},
"additional_info": "Voucher added using API",
"metadata": {
"Season": "Fall"
}
}
'{
"id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg",
"code": "Code3",
"campaign": "Add Voucher to Campaign",
"campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B",
"category": null,
"category_id": "cat_0bb81a481615a37b5e",
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "PERCENT",
"amount_limit": 2000,
"percent_off": 30,
"effect": "APPLY_TO_ORDER"
},
"gift": null,
"loyalty_card": null,
"start_date": "2022-09-24T00:00:00.000Z",
"expiration_date": "2022-09-25T23:59:59.000Z",
"validity_timeframe": null,
"validity_day_of_week": [
1,
2,
3,
4,
5
],
"active": true,
"additional_info": "Voucher added using API",
"metadata": {
"Season": "Fall"
},
"assets": {
"qr": {
"id": "U2FsdGVkX1+p2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6+1N81zXuY6/pnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg==",
"url": "{{internalVoucherifyURL}}"
},
"barcode": {
"id": "U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5/u9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY+sOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW+NCQg6Ts8clYWWP5lrGyV/fzoA==",
"url": "{{internalVoucherifyURL}}"
}
},
"is_referral_code": false,
"created_at": "2022-09-21T07:14:28.217Z",
"updated_at": null,
"validation_rules_assignments": {
"object": "list",
"data_ref": "data",
"data": [],
"total": 0
},
"redemption": {
"quantity": null,
"redeemed_quantity": 0,
"object": "list",
"url": "/v1/vouchers/Code3/redemptions?page=1&limit=10"
},
"publish": {
"object": "list",
"count": 0,
"url": "/v1/vouchers/Code3/publications?page=1&limit=10"
},
"object": "voucher"
}{
"code": 409,
"key": "duplicate_found",
"message": "Duplicated resource found",
"details": "Duplicated voucher exists with id Code1",
"request_id": "v-0bb974be99d22504cd",
"resource_id": "Code1",
"resource_type": "voucher"
}Add Voucher with Specific Code to Campaign
This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign.
POST
/
v1
/
campaigns
/
{campaignId}
/
vouchers
/
{code}
Add Voucher with Specific Code to Campaign
curl --request POST \
--url https://{cluster}.voucherify.io/v1/campaigns/{campaignId}/vouchers/{code} \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"category_id": "cat_0bb81a481615a37b5e",
"start_date": "2022-09-24T00:00:00Z",
"expiration_date": "2022-09-25T23:59:59Z",
"active": false,
"redemption": {
"quantity": null
},
"additional_info": "Voucher added using API",
"metadata": {
"Season": "Fall"
}
}
'{
"id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg",
"code": "Code3",
"campaign": "Add Voucher to Campaign",
"campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B",
"category": null,
"category_id": "cat_0bb81a481615a37b5e",
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "PERCENT",
"amount_limit": 2000,
"percent_off": 30,
"effect": "APPLY_TO_ORDER"
},
"gift": null,
"loyalty_card": null,
"start_date": "2022-09-24T00:00:00.000Z",
"expiration_date": "2022-09-25T23:59:59.000Z",
"validity_timeframe": null,
"validity_day_of_week": [
1,
2,
3,
4,
5
],
"active": true,
"additional_info": "Voucher added using API",
"metadata": {
"Season": "Fall"
},
"assets": {
"qr": {
"id": "U2FsdGVkX1+p2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6+1N81zXuY6/pnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg==",
"url": "{{internalVoucherifyURL}}"
},
"barcode": {
"id": "U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5/u9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY+sOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW+NCQg6Ts8clYWWP5lrGyV/fzoA==",
"url": "{{internalVoucherifyURL}}"
}
},
"is_referral_code": false,
"created_at": "2022-09-21T07:14:28.217Z",
"updated_at": null,
"validation_rules_assignments": {
"object": "list",
"data_ref": "data",
"data": [],
"total": 0
},
"redemption": {
"quantity": null,
"redeemed_quantity": 0,
"object": "list",
"url": "/v1/vouchers/Code3/redemptions?page=1&limit=10"
},
"publish": {
"object": "list",
"count": 0,
"url": "/v1/vouchers/Code3/publications?page=1&limit=10"
},
"object": "voucher"
}{
"code": 409,
"key": "duplicate_found",
"message": "Duplicated resource found",
"details": "Duplicated voucher exists with id Code1",
"request_id": "v-0bb974be99d22504cd",
"resource_id": "Code1",
"resource_type": "voucher"
}Authorizations
X-App-Id & X-App-TokenX-Voucherify-OAuth
Scopes
Path Parameters
Body
application/json
Specify the voucher parameters that you would like to overwrite.
Request body schema for POST v1/campaigns/{campaignId}/vouchers/{code}.
Response
Returns a voucher object if the call succeeded.
Response body schema for POST v1/campaigns/{campaignId}/vouchers/{code} and POST v1/campaigns/{campaignId}/vouchers.

