What is the best way to generate big batch of discount codes every day?

I want to generate discount codes in our shop every day, on average 24,000 codes every day.

I see there’s a discount code creation job endpoint https://shopify.dev/docs/api/admin-rest/2024-01/resources/discountcode#post-price-rules-price-rule-id-batch but it only allows for 100 codes per job and only allows for 1 job simultaneously. I was thinking to generate the codes in these 100 code batches, but the job requires polling to check that the codes are successfully created. I’m afraid this will eat in to our API limits.

What’s the best way to generate 24k codes every day in an efficient manner without crossing the API rate limiting thresholds?

Hi Tamang4,

Are the discounts all for the same value/ have the same rules? If so, it would likely be easier/ more efficient to use the discountRedeemCodeBulkAdd mutation instead? This allows you to asynchronously add multiple discount redeem codes in bulk that are associated with a single discount ID. Would recommend seeing if this suits your use case.