Skip to main content

Importing existing coupons

If you are replacing an existing coupon or voucher system with Talon.One, you can transfer coupon codes from the old system to Talon.One. This ensures the legacy codes continue to work.

Let's use the coupon import endpoint from the Management API to create coupons programmatically.

Collecting the existing coupon codes

Your legacy coupon system probably offers an API, a CSV export functionality, or a way to dump coupons directly from the database. Export them in any format available.

Creating a campaign

Before creating coupons in Talon.One, create one or more campaigns that define coupon validation conditions and coupon effects. Typically, we recommend using one campaign for each kind of validation you want to support for your coupons.


If you have the following coupon activation conditions:

  • Coupons are valid for orders with a total value greater than $50.
  • Coupons are valid for customers in a certain location,

Then create 2 campaigns.

Once the campaign is created, make a note of its ID for later use in the API calls. Its ID appear in the URL when you open it the Campaign Manager.

Generating a CSV file to import coupons

Once you've collected the raw coupon data from your legacy system and you know the ID of the campaign you want to import the codes into, transform your raw data into a CSV file with all the necessary data.


To import data in several campaigns, use 1 file per campaign.

Use the following sample to create your coupon import CSV file. The sample contains all possible columns. Only the value column is required. See the column description in the Import coupons via CSV file endpoint documentation.

COUP1,2018-07-01T04:00:00Z,2018-05-01T04:00:00Z,cust123,1,"{""Category"": ""10_off"", ""Month"": ""May""}"
COUP_2,2018-07-01T04:00:00Z,2018-05-01T04:00:00Z,cust456,1,"{""Category"": ""10_off"", ""Month"": ""May""}"
PROMO,2018-07-01T04:00:00Z,2018-05-01T04:00:00Z,cust000,0,"{""Category"": ""20_off"", ""Month"": ""May""}"

Using the importCoupon endpoint

  1. Create a new session token to use the Management API.
  2. Send a request to the Import coupons via CSV file endpoint, with your generated CSV file as the payload. Assuming you have your CSV file saved in the same folder:
curl<yourAppid>/campaigns/<yourCampaignId>/import_coupons \
-H "authorization: Bearer $YOUR_SESSION_TOKEN" \
-F "file=@/path/to/yourfile.csv"

More complex scenarios can require you to use multiple campaigns or even varying attributes on individual coupons.

Marking coupon codes as redeemed

If some imported coupons are already redeemed, use the update customer session endpoint:

  1. Create an anonymous, closed customer session.
  2. Add the coupon code(s) to mark as redeemed.
  3. Send the request.


"customerSession": {
"profileId": "",
"state": "closed",
"couponCodes": ["xmas20", "xmas19", "xmas18"],