Import generic (standalone) vouchers into the repository using a CSV file.
The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object.
You can find an example CSV file here.
curl -X **POST** \
https://api.voucherify.io/v1/vouchers/importCSV \
-F file=@/path/to/vouchers.csv \
-F webhooks_enable=true\
-H "X-App-Id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
-H "X-App-Token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
๐ Standard voucher fields mapping
- Go to the import vouchers endpoint to see all standard CSV fields description (body params section).
- Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name
- Start and expiration dates need to be provided in compliance with the ISO 8601 standard. For example, 2020-03-11T09:00:00.000Z.
YYYY-MM-DDYYYY-MM-DDTHHYYYY-MM-DDTHH:mmYYYY-MM-DDTHH:mm:ssYYYY-MM-DDTHH:mm:ssZYYYY-MM-DDTHH:mm:ssZYYYY-MM-DDTHH:mm:ss.SSSZ- 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.
- You can, however, upload the same codes to update them.
๐ Categories
In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint.
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.
You can pass the webhooks_enable=true parameter to trigger a webhook sendout for created or updated vouchers. Configure the respective webhooks in Project settings. For updated webhooks, a webhook is sent even if the voucher hasnโt been changed in the CSV file.
๐ง Generic (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 file path is stored in the form file header.
Request body schema for POST v1/vouchers/importCSV.
Request body schema for importing data using a CSV file.
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/importCSV.
Response to requests that are processed asynchronously.
The ID of the scheduled asynchronous action.
"aa_0a875d56c805df6601"