curl --request POST \
--url https://{cluster}.voucherify.io/v1/vouchers/{code} \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"category": "New Customers",
"type": "DISCOUNT_VOUCHER",
"discount": {
"percent_off": 10,
"type": "PERCENT",
"effect": "APPLY_TO_ORDER"
},
"start_date": "2022-01-01T00:00:00Z",
"expiration_date": "2022-12-31T23:59:59Z",
"validity_timeframe": {
"duration": "PT1H",
"interval": "P2D"
},
"validity_day_of_week": [
1,
2,
3,
4,
5
],
"active": false,
"additional_info": "This voucher will remain inactive until enabled.",
"redemption": {
"quantity": 10
},
"metadata": {
"test": true,
"locale": "de-en"
},
"validation_rules": [
"val_4j7DCRm2IS59"
]
}
'{
"id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc",
"code": "welcome",
"campaign": null,
"campaign_id": null,
"category": "New Customers",
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "PERCENT",
"percent_off": 10,
"effect": "APPLY_TO_ORDER"
},
"gift": null,
"loyalty_card": null,
"start_date": "2022-01-01T00:00:00.000Z",
"expiration_date": "2022-12-31T23:59:59.000Z",
"validity_timeframe": {
"interval": "P2D",
"duration": "PT1H"
},
"validity_day_of_week": [
1,
2,
3,
4,
5
],
"active": false,
"additional_info": "This voucher will remain inactive until enabled.",
"metadata": {
"test": true,
"locale": "de-en"
},
"assets": {
"qr": {
"id": "U2FsdGVkX1+by33CNzWu6xXjCrLKRr1+H9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC+4/hCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA==",
"url": "{{internalVoucherifyURL}}"
},
"barcode": {
"id": "U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz/ZTnXUFeHeehtK4L6RTvNgVeSR+McTZR4DYNLEGydZ+Fo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO/OEAjvVoiEuaHA==",
"url": "{{internalVoucherifyURL}}"
}
},
"is_referral_code": false,
"created_at": "2022-02-17T09:05:34.668Z",
"updated_at": null,
"validation_rules_assignments": {
"object": "list",
"data_ref": "data",
"data": [
{
"id": "asgm_74F7QZoYbUoljwQO",
"rule_id": "val_4j7DCRm2IS59",
"related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc",
"related_object_type": "voucher",
"created_at": "2022-02-17T09:05:34.642Z",
"object": "validation_rules_assignment"
}
],
"total": 1
},
"redemption": {
"quantity": 10,
"redeemed_quantity": 0,
"object": "list",
"url": "/v1/vouchers/welcome/redemptions?page=1&limit=10"
},
"publish": {
"object": "list",
"count": 0,
"url": "/v1/vouchers/welcome/publications?page=1&limit=10"
},
"object": "voucher"
}Create Voucher
Create a generic (standalone) voucher or a voucher in a campaign. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a legacy LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters.
When you create a new voucher, you can specify a type to create it.
If no campaign name or campaign_id is provided, the new voucher will be a generic (standalone) one. However, if an ID or name of a campaign with the type set to STANDALONE is provided, the voucher will be added to this campaign. For a loyalty card, a campaign name or ID is required.
Generic (standalone) vouchers created through the Voucherify dashboard always create a campaign for that voucher. However, vouchers created through The vouchers created with POST Create voucher and POST Generate random code endpoints do not have a campaign attached, so the values for campaign and campaign_id are null.
To create a generic (standalone) voucher with a "type": "STANDALONE", use the POST Create campaign endpoint.
curl --request POST \
--url https://{cluster}.voucherify.io/v1/vouchers/{code} \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"category": "New Customers",
"type": "DISCOUNT_VOUCHER",
"discount": {
"percent_off": 10,
"type": "PERCENT",
"effect": "APPLY_TO_ORDER"
},
"start_date": "2022-01-01T00:00:00Z",
"expiration_date": "2022-12-31T23:59:59Z",
"validity_timeframe": {
"duration": "PT1H",
"interval": "P2D"
},
"validity_day_of_week": [
1,
2,
3,
4,
5
],
"active": false,
"additional_info": "This voucher will remain inactive until enabled.",
"redemption": {
"quantity": 10
},
"metadata": {
"test": true,
"locale": "de-en"
},
"validation_rules": [
"val_4j7DCRm2IS59"
]
}
'{
"id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc",
"code": "welcome",
"campaign": null,
"campaign_id": null,
"category": "New Customers",
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "PERCENT",
"percent_off": 10,
"effect": "APPLY_TO_ORDER"
},
"gift": null,
"loyalty_card": null,
"start_date": "2022-01-01T00:00:00.000Z",
"expiration_date": "2022-12-31T23:59:59.000Z",
"validity_timeframe": {
"interval": "P2D",
"duration": "PT1H"
},
"validity_day_of_week": [
1,
2,
3,
4,
5
],
"active": false,
"additional_info": "This voucher will remain inactive until enabled.",
"metadata": {
"test": true,
"locale": "de-en"
},
"assets": {
"qr": {
"id": "U2FsdGVkX1+by33CNzWu6xXjCrLKRr1+H9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC+4/hCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA==",
"url": "{{internalVoucherifyURL}}"
},
"barcode": {
"id": "U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz/ZTnXUFeHeehtK4L6RTvNgVeSR+McTZR4DYNLEGydZ+Fo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO/OEAjvVoiEuaHA==",
"url": "{{internalVoucherifyURL}}"
}
},
"is_referral_code": false,
"created_at": "2022-02-17T09:05:34.668Z",
"updated_at": null,
"validation_rules_assignments": {
"object": "list",
"data_ref": "data",
"data": [
{
"id": "asgm_74F7QZoYbUoljwQO",
"rule_id": "val_4j7DCRm2IS59",
"related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc",
"related_object_type": "voucher",
"created_at": "2022-02-17T09:05:34.642Z",
"object": "validation_rules_assignment"
}
],
"total": 1
},
"redemption": {
"quantity": 10,
"redeemed_quantity": 0,
"object": "list",
"url": "/v1/vouchers/welcome/redemptions?page=1&limit=10"
},
"publish": {
"object": "list",
"count": 0,
"url": "/v1/vouchers/welcome/publications?page=1&limit=10"
},
"object": "voucher"
}Authorizations
Scopes
Body
Specify the details of the voucher that you would like to create.
- Create loyalty card
- Create gift card
- Create voucher in a discount campaign
Request body schema for POST v1/vouchers/{code}.
The name of the category that this voucher belongs to. Useful when listing vouchers with the List Vouchers endpoint.
Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the List Vouchers endpoint.
"cat_0b6152ce12414820dc"
Response
Returns a voucher object if the call succeeded.
Response body schema for POST v1/vouchers and /vouchers/{code}

