curl --request POST \
--url https://{cluster}.voucherify.io/v1/vouchers/import \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
[
{
"code": "PROMO-CODE30OFF-NO-EFFECT",
"category": "new customer acquisition",
"type": "DISCOUNT_VOUCHER",
"active": true,
"discount": {
"amount_off": 3000,
"type": "AMOUNT"
},
"start_date": "2020-12-01T23:00:00Z",
"expiration_date": "2023-12-19T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code1"
},
{
"code": "PROMO-CODE30-PERCENT-NO-EFFECT",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"percent_off": 30,
"type": "PERCENT"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "GIFT-CARD-100",
"type": "GIFT_VOUCHER",
"active": true,
"category": "new customer acquisition",
"gift": {
"amount": 10000
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 5
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-GIFT-code2"
},
{
"code": "PROMO-CODE1-PERCENT-EFFECT-ORDER",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"percent_off": 30,
"type": "PERCENT",
"effect": "APPLY_TO_ORDER"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE2-PERCENT-EFFECT-ITEM",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"percent_off": 30,
"type": "PERCENT",
"effect": "APPLY_TO_ITEMS"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-PERCENT-NO-EFFECT-REDEEMED-QUANTITY-ATTRIBUTE-DOESNT-GET-PASSED",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"percent_off": 30,
"type": "PERCENT"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1,
"redeemed_quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-AMOUNT-EFFECT-ITEMS-PROPORTIONALLY",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"amount_off": 30,
"type": "AMOUNT",
"effect": "APPLY_TO_ITEMS_PROPORTIONALLY"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-FIXED-EFFECT-ORDER",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"fixed_amount": 30,
"type": "FIXED",
"effect": "APPLY_TO_ORDER"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-UNIT-SINGLE-ITEM-EFFECT-MISSING",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"unit_off": 1,
"unit_type": "prod_0a9f9aeddb019a42db",
"type": "UNIT",
"effect": "ADD_MISSING_ITEMS"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE2-UNIT-MULTIPLE-ITEMS",
"type": "DISCOUNT_VOUCHER",
"active": true,
"discount": {
"type": "UNIT",
"effect": "ADD_MANY_ITEMS",
"units": [
{
"unit_off": 1,
"unit_type": "prod_0a9f9aeddb019a42db",
"effect": "ADD_MISSING_ITEMS"
},
{
"unit_off": 1,
"unit_type": "prod_0a9f9aeddb019a42db",
"effect": "ADD_NEW_ITEMS"
}
]
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-SHIPPING",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"type": "UNIT",
"unit_off": 1,
"unit_type": "prod_5h1pp1ng",
"effect": "ADD_MISSING_ITEMS"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
}
]
'{
"async_action_id": "aa_0aac93c6af84485df3"
}Import Vouchers
Import generic (standalone) vouchers and gift cards into the repository. You can upload up to 100,000 codes to a campaign, as a campaign can have up to 100,000 codes by default. Also, the request can include up to 10 MB of data.
- Start and expiration dates need to be provided in compliance with the ISO 8601 standard. For example, 2020-03-11T09:00:00.000Z.
- Custom code attributes (not supported by-default) need to be added as code metadata.
- You cannot import the same codes to a single Voucherify Project.
Any parameters not provided in the payload will be left blank or null.
For both standalone discount vouchers and gift cards, you can import the following fields:
- code
- category
- active
- type
- start_date
- expiration_date
- redemption.quantity
- additional_info
- metadata
For gift cards, you can also import the following field:
- gift.amount
For discount vouchers, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type requires the type to be defined in the import.
| Discount Type | Required fields |
|---|---|
| Amount | amount_off, effect |
| Percent | percent_off, effect |
| Fixed | fixed_amount, effect |
| Unit - One item | unit_off, unit_type, effect |
| Unit - Multiple items | unit_off, unit_type, effect |
| Shipping | unit_off, unit_type, effect |
Fields other than the ones listed above won’t be imported. Even if provided, they will be silently skipped.
This API request starts a process that affects Voucherify data in bulk.
In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window.
The result will return the async ID. You can verify the status of your request via this API request.
Generic (standalone) vouchers created through the Voucherify dashboard always create a campaign for that voucher. However, vouchers imported through the dashboard in the Vouchers section or through the API 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/import \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
[
{
"code": "PROMO-CODE30OFF-NO-EFFECT",
"category": "new customer acquisition",
"type": "DISCOUNT_VOUCHER",
"active": true,
"discount": {
"amount_off": 3000,
"type": "AMOUNT"
},
"start_date": "2020-12-01T23:00:00Z",
"expiration_date": "2023-12-19T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code1"
},
{
"code": "PROMO-CODE30-PERCENT-NO-EFFECT",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"percent_off": 30,
"type": "PERCENT"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "GIFT-CARD-100",
"type": "GIFT_VOUCHER",
"active": true,
"category": "new customer acquisition",
"gift": {
"amount": 10000
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 5
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-GIFT-code2"
},
{
"code": "PROMO-CODE1-PERCENT-EFFECT-ORDER",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"percent_off": 30,
"type": "PERCENT",
"effect": "APPLY_TO_ORDER"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE2-PERCENT-EFFECT-ITEM",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"percent_off": 30,
"type": "PERCENT",
"effect": "APPLY_TO_ITEMS"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-PERCENT-NO-EFFECT-REDEEMED-QUANTITY-ATTRIBUTE-DOESNT-GET-PASSED",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"percent_off": 30,
"type": "PERCENT"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1,
"redeemed_quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-AMOUNT-EFFECT-ITEMS-PROPORTIONALLY",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"amount_off": 30,
"type": "AMOUNT",
"effect": "APPLY_TO_ITEMS_PROPORTIONALLY"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-FIXED-EFFECT-ORDER",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"fixed_amount": 30,
"type": "FIXED",
"effect": "APPLY_TO_ORDER"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-UNIT-SINGLE-ITEM-EFFECT-MISSING",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"unit_off": 1,
"unit_type": "prod_0a9f9aeddb019a42db",
"type": "UNIT",
"effect": "ADD_MISSING_ITEMS"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE2-UNIT-MULTIPLE-ITEMS",
"type": "DISCOUNT_VOUCHER",
"active": true,
"discount": {
"type": "UNIT",
"effect": "ADD_MANY_ITEMS",
"units": [
{
"unit_off": 1,
"unit_type": "prod_0a9f9aeddb019a42db",
"effect": "ADD_MISSING_ITEMS"
},
{
"unit_off": 1,
"unit_type": "prod_0a9f9aeddb019a42db",
"effect": "ADD_NEW_ITEMS"
}
]
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
},
{
"code": "PROMO-CODE1-SHIPPING",
"type": "DISCOUNT_VOUCHER",
"active": false,
"discount": {
"type": "UNIT",
"unit_off": 1,
"unit_type": "prod_5h1pp1ng",
"effect": "ADD_MISSING_ITEMS"
},
"start_date": "2020-12-10T23:00:00Z",
"expiration_date": "2023-12-31T23:00:00Z",
"redemption": {
"quantity": 1
},
"metadata": {
"unit": "EUR"
},
"additional_info": "secret-code2"
}
]
'{
"async_action_id": "aa_0aac93c6af84485df3"
}Authorizations
Scopes
Body
The request body is an array of objects. Each object contains details about a specific voucher.
- Voucher Import Gift
- Voucher Import Discount
Object model for gift card object being imported.
Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.
Activation timestamp presented in the ISO 8601 format. Voucher is inactive before this date. Start date defines when the code starts to be active. Allowed date formats are:
- YYYY-MM-DD
- YYYY-MM-DDTHH
- YYYY-MM-DDTHH:mm
- YYYY-MM-DDTHH:mm:ss
- YYYY-MM-DDTHH:mm:ssZ
- YYYY-MM-DDTHH:mm:ss.SSSZ
"2020-12-28T12:49:16.272Z"
Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is inactive after this date. Allowed date formats are:
- YYYY-MM-DD
- YYYY-MM-DDTHH
- YYYY-MM-DDTHH:mm
- YYYY-MM-DDTHH:mm:ss
- YYYY-MM-DDTHH:mm:ssZ
- YYYY-MM-DDTHH:mm:ss.SSSZ
"2053-12-28T12:49:16.272Z"
Response
Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the async_action_id from the response and pass it using the Get Async Action endpoint.

