Skip to content

Commit 281881b

Browse files
committed
docs(promotions): PROMO-933 add bulk coupon code generation
add bulk coupon code generation
1 parent 9a5d198 commit 281881b

File tree

1 file changed

+113
-4
lines changed

1 file changed

+113
-4
lines changed

reference/promotions.v3.yml

Lines changed: 113 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ paths:
8888
responses:
8989
'201':
9090
$ref: '#/components/responses/PromotionsResponse'
91-
'400':
91+
'400':
9292
description: The request payload was invalid.
9393
content:
9494
application/json:
9595
schema:
9696
$ref: '#/components/schemas/ErrorResponse400'
97-
'403':
97+
'403':
9898
description: The request payload was invalid.
9999
content:
100100
application/json:
@@ -195,6 +195,74 @@ paths:
195195
'204':
196196
description: The deletion was successful or the specified resource does not exist.
197197
content: {}
198+
199+
'/promotions/{promotion_id}/codegen':
200+
post:
201+
tags:
202+
- Coupon Codes (Bulk)
203+
summary: Generate Bulk Coupon Codes
204+
description: |-
205+
Generate a batch of coupon codes for a particular bulk coupon promotion.
206+
207+
**Note:**
208+
* batch_size is limited to 250 codes per request for first version. If batch_size is not an integer or larger than 250, it will return a 400 error code.
209+
* The default rate limit for this endpoint is 40 concurrent requests.
210+
operationId: generatePromotionCodesBatch
211+
parameters:
212+
- $ref: '#/components/parameters/ContentType'
213+
- $ref: '#/components/parameters/Accept'
214+
- $ref: '#/components/parameters/PromotionIdPath'
215+
requestBody:
216+
content:
217+
application/json:
218+
schema:
219+
required:
220+
- batch_size
221+
type: object
222+
properties:
223+
prefix:
224+
type: string
225+
description: A prefix to add to the generated codes.
226+
example: 'PROMO'
227+
suffix:
228+
type: string
229+
description: A suffix to add to the generated codes.
230+
example: '2025'
231+
batch_size:
232+
type: integer
233+
description: The number of coupon codes to generate in each batch. The maximum value is 250.
234+
example: 5
235+
max_uses:
236+
type: integer
237+
description: The maximum number of times each coupon code can be used. The default value is 0, which represents unlimited uses.
238+
example: 10
239+
max_uses_per_customer:
240+
type: integer
241+
description: The maximum number of times a specific customer can use each coupon code. The default value is 0, which represents unlimited uses.
242+
example: 5
243+
required: true
244+
responses:
245+
'200':
246+
$ref: '#/components/responses/BulkCouponCodesResponse'
247+
'400':
248+
description: The request payload was invalid.
249+
content:
250+
application/json:
251+
schema:
252+
$ref: '#/components/schemas/ErrorResponse400'
253+
'403':
254+
description: The request payload was invalid.
255+
content:
256+
application/json:
257+
schema:
258+
$ref: '#/components/schemas/ErrorResponse403'
259+
'422':
260+
description: The request payload was invalid.
261+
content:
262+
application/json:
263+
schema:
264+
$ref: '#/components/schemas/ErrorResponse'
265+
198266
'/promotions/{promotion_id}/codes':
199267
parameters:
200268
- $ref: '#/components/parameters/Accept'
@@ -993,14 +1061,12 @@ components:
9931061
properties:
9941062
previous:
9951063
type: string
996-
9971064
description: >
9981065
Link to the previous page returned in the response.
9991066
This property is omitted when the result set is empty or on the first page.
10001067
example: '?limit=5&before=eyJpZCI6IjIzNzU1NyJ9'
10011068
next:
10021069
type: string
1003-
10041070
description: >
10051071
Link to the next page returned in the response.
10061072
This property is omitted when the result set is empty.
@@ -1178,6 +1244,24 @@ components:
11781244
example: '2019-01-20T22:00:00.000Z'
11791245
required:
11801246
- code
1247+
1248+
BulkCouponCode:
1249+
type: object
1250+
properties:
1251+
code:
1252+
type: string
1253+
pattern: '[a-zA-Z0-9_\ -]'
1254+
description: A unique code that can be used to manually apply a discount. Only letters, numbers, white spaces, underscores and hyphens are allowed.
1255+
example: TEST-COUPON-CODE
1256+
maxLength: 50
1257+
minLength: 12
1258+
1259+
BulkCouponCodes:
1260+
type: array
1261+
description: An array of unique coupon codes generated by bulk.
1262+
items:
1263+
$ref: '#/components/schemas/BulkCouponCode'
1264+
11811265
BulkActionResponseMeta:
11821266
title: Bulk Action Response Meta
11831267
type: object
@@ -1499,6 +1583,31 @@ components:
14991583
total: 5
15001584
success: 3
15011585
failed: 2
1586+
1587+
BulkCouponCodesResponse:
1588+
description: ''
1589+
content:
1590+
application/json:
1591+
schema:
1592+
type: object
1593+
properties:
1594+
data:
1595+
$ref: '#/components/schemas/BulkCouponCodes'
1596+
meta:
1597+
type: object
1598+
properties: {}
1599+
description: 'Empty meta object, which may be used at a later time.'
1600+
examples:
1601+
example-1:
1602+
value:
1603+
data:
1604+
- code: "PROMO-abc123-2025"
1605+
- code: "PROMO-def456-2025"
1606+
- code: "PROMO-ghi789-2025"
1607+
- code: "PROMO-jkl012-2025"
1608+
- code: "PROMO-mno345-2025"
1609+
meta: {}
1610+
15021611
PromotionCodeResponse:
15031612
description: ''
15041613
content:

0 commit comments

Comments
 (0)