> For the complete documentation index, see [llms.txt](https://docs.limio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.limio.com/guides/feature-implementation-guides/guide-how-to-sell-subscription-gift-codes-in-limio-commerce/how-to-generate-gift-codes-in-bulk.md).

# Generate Gift Codes in Bulk

There are certain scenarios in which you may want to generate a lot of gift codes and purchasing individually isn't ideal.

We have a way for you to import a file with pre-generated gift codes to facilitate that task.

## To get started

* First you'll need to generate a CSV file with the list of gift codes and other attributes defined below
  * Check if there are maximum character and regular expression restrictions defined in your redemption flow before generating the codes
* Request access from Limio to access the CSV ingestion bucket

## Prepping the file

1. **Check the file size to upload**\
   For reliability and performance we recommend that a file has *no more than 5,000 records*. Bigger files can cause data loss.
2. **Check the file structure**\
   Make sure the headers match as these are case sensitive. NB: the table below describes which fields are mandatory
3. **Name the file correctly**\
   Files to be uploaded for the general migration process need to have the following prefix: `Limio_gift_code_`.

## Processing the file

* Upload the file into the right CSV bucket (ie: SHARD.csv-ingestion.limio.com)
  * You can get this information from your Limio contact.
* Limio splits the file into batches of 1,000 and if your original file had 5,000 records for example, you'll see multiple files in the bucket being processed.
* Once the process is finished they'll be moved to the *processed* folder.

## Checking the outcome

* You can check progress by going into your Subscriptions page in the Limio Commerce app (<https://yourdomain.prod.limio.com/objects/subscriptions/limio>) which will show the orders that have been processed.
* Once the files have finished processing you'll see events for the associated events in the *Events* section in the Limio Commerce app.
  * Any errors will also appear in the *Events* section.

### CSV file structure

| string           | yes | Subscription unique identifier - can be the source (legacy) value. It will also be used as Order Number to prevent duplicates if importing again same record. **IMPORTANT**: it needs to be the subscriptionNumber field exported to **Zuora** since is going to work as link for the integration |
| ---------------- | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string           | yes | **Zuora** account id, used to link to an existing customer uploaded (it could be in Limio or uploaded via other migration file)                                                                                                                                                                   |
| string           | yes | It’s the code that the redeemer will use to get the subscription                                                                                                                                                                                                                                  |
| string           | yes | Defines the path of the Limio offer to be mapped into the subscription. Example: “/offers/digital/annual”                                                                                                                                                                                         |
| string (int)     |     | The original quantity for the gift code. If not specified 1 is assumed                                                                                                                                                                                                                            |
| string (int)     |     | The already used quantity for the gift code. If not specified 0 is assumed                                                                                                                                                                                                                        |
| string (isodate) |     | Expiry date for the gift code/voucher, format: YYYYMMDD. If not specified there will be no expiry                                                                                                                                                                                                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.limio.com/guides/feature-implementation-guides/guide-how-to-sell-subscription-gift-codes-in-limio-commerce/how-to-generate-gift-codes-in-bulk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
