Import generic (standalone) vouchers and gift cards into the repository.
📘 Important notes
- Start and expiration dates need to be provided in compliance with the ISO 8601 norms. 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:
For gift cards, you can also import the following field:
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.
🚧 Standalone Vouchers and Campaigns
In version v20241004, generic (standalone) vouchers created through the Voucherify dashboard 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
campaignandcampaign_idarenull.
The access token received from the authorization server in the OAuth 2.0 flow.
The request body is an array of objects. Each object contains details about a specific voucher.
Object model for gift card object being imported.
Value representing the imported code.
Contains current gift card balance information.
Stores the quantity of redemptions that can be applied to the voucher.
A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.
true indicates an active voucherfalse indicates an inactive voucherThe metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.
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:
"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:
"2053-12-28T12:49:16.272Z"
Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.
Integer array corresponding to the particular days of the week in which the voucher is valid.
0 Sunday1 Monday2 Tuesday3 Wednesday4 Thursday5 Friday6 Saturday0, 1, 2, 3, 4, 5, 6 An optional field to keep any extra textual information about the code such as a code description and details.
Defines the type of the voucher.
GIFT_VOUCHER 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.
Response body schema for POST v1/vouchers/import.
The ID of the scheduled asynchronous action.
"aa_0a875d56c805df6601"