-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathpromotions.v3.yml
More file actions
2226 lines (2190 loc) · 80.3 KB
/
promotions.v3.yml
File metadata and controls
2226 lines (2190 loc) · 80.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: '3.0.3'
info:
title: Promotions API
version: '1.0'
description: |
A *promotion* is composed of a condition that a customer can satisfy, such as increasing their cart value above a certain amount or adding an item to their cart.
After the customer satisfies the condition, an action takes place, such as a free item being added to the cart or a discount applying itself to the order total.
To learn more about promotions, consult the [Promotions Overview](/docs/store-operations/promotions).
termsOfService: 'https://www.bigcommerce.com/terms'
contact:
name: BigCommerce
url: 'https://www.bigcommerce.com'
email: support@bigcommerce.com
servers:
- url: 'https://api.bigcommerce.com/stores/{store_hash}/v3'
variables:
store_hash:
default: store_hash
description: Permanent ID of the BigCommerce store.
description: BigCommerce API Gateway
security:
- X-Auth-Token: []
tags:
- name: Promotions (Bulk)
- name: Promotions (Single)
- name: Coupon Codes (Bulk)
- name: Coupon Codes (Single)
paths:
'/promotions':
parameters:
- $ref: '#/components/parameters/Accept'
get:
tags:
- Promotions (Bulk)
summary: Get All Promotions
description: |-
Returns a list of *promotions*.
The response includes the display name and other details about each promotion, and lists the promotions ordered by ID by default.
**Note:**
The default rate limit for this endpoint is 40 concurrent requests.
operationId: getPromotions
parameters:
- $ref: '#/components/parameters/IdQuery'
- $ref: '#/components/parameters/NameQuery'
- $ref: '#/components/parameters/CodeQuery'
- $ref: '#/components/parameters/CurrencyCodeQuery'
- $ref: '#/components/parameters/RedemptionTypeQuery'
- $ref: '#/components/parameters/StatusQuery'
- $ref: '#/components/parameters/PageQuery'
- $ref: '#/components/parameters/LimitQuery'
- $ref: '#/components/parameters/SortQuery'
- $ref: '#/components/parameters/DirectionQuery'
- $ref: '#/components/parameters/ChannelQuery'
- $ref: '#/components/parameters/Query'
responses:
'200':
$ref: '#/components/responses/PromotionsCollectionResponse'
'422':
description: Failure due to an invalid query parameter.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
tags:
- Promotions (Single)
summary: Create Promotion
description: |-
Creates a *promotion*.
To learn more about how to create a *promotion*, read the [Promotions Overview](/docs/store-operations/promotions).
For examples grouped by use case, see the [promotions examples](/docs/store-operations/promotions/examples/brand).
**Note:**
The default rate limit for this endpoint is 40 concurrent requests.
operationId: createPromotion
parameters:
- $ref: '#/components/parameters/ContentType'
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/DraftCouponPromotion'
- $ref: '#/components/schemas/DraftAutomaticPromotion'
responses:
'201':
$ref: '#/components/responses/PromotionsResponse'
'400':
description: The request payload was invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse400'
'403':
description: The request payload was invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse403'
'422':
description: The request payload was invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
tags:
- Promotions (Bulk)
summary: Delete Multiple Promotions
description: |-
Deletes multiple promotions. Currently, batches are limited to 50 promotions.
**Notes**
* "id:in" query param is required to delete promotions. If this parameter is not provided, or provided with the wrong data format, a 422 error code is returned.
* You cannot delete promotions that still have coupon codes attached.
* The default rate limit for this endpoint is 40 concurrent requests.
operationId: deletePromotions
parameters:
- $ref: '#/components/parameters/IdInQuery'
responses:
'204':
description: A 204 response.
content: {}
'422':
$ref: '#/components/responses/BulkDeleteResponse'
'/promotions/{id}':
parameters:
- $ref: '#/components/parameters/Accept'
get:
tags:
- Promotions (Single)
summary: Get Promotion
description: |-
Returns a single *promotion*.
**Note:**
The default rate limit for this endpoint is 40 concurrent requests
operationId: getPromotion
parameters:
- $ref: '#/components/parameters/IdPath'
responses:
'200':
$ref: '#/components/responses/PromotionsResponse'
'404':
description: The requested resource was not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
put:
tags:
- Promotions (Single)
summary: Update Promotion
description: |-
Update a promotion.
**Note:**
The default rate limit for this request is 40 concurrent requests.
operationId: updatePromotion
parameters:
- $ref: '#/components/parameters/ContentType'
- $ref: '#/components/parameters/IdPath'
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/PatchCouponPromotion'
- $ref: '#/components/schemas/PatchAutomaticPromotion'
responses:
'200':
$ref: '#/components/responses/PromotionsResponse'
'404':
description: The requested resource could not be found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
tags:
- Promotions (Single)
summary: Delete Promotion
description: |-
Deletes a promotion.
**Note:**
The default rate limit for this endpoint is 40 concurrent requests.
operationId: deletePromotion
parameters:
- $ref: '#/components/parameters/IdPath'
responses:
'204':
description: The deletion was successful or the specified resource does not exist.
content: {}
'/promotions/{promotion_id}/codes':
parameters:
- $ref: '#/components/parameters/Accept'
get:
tags:
- Coupon Codes (Bulk)
summary: Get Coupon Codes
description: |-
Get codes for a particular promotion.
**Note:**
The default rate limit for this endpoint is 10 concurrent requests.
operationId: getPromotionCodes
parameters:
- $ref: '#/components/parameters/PromotionIdPath'
- $ref: '#/components/parameters/BeforeCursorQuery'
- $ref: '#/components/parameters/AfterCursorQuery'
- $ref: '#/components/parameters/DeprecatedPageQuery'
- $ref: '#/components/parameters/LimitQuery'
responses:
'200':
$ref: '#/components/responses/PromotionCodesCollectionResponse'
post:
tags:
- Coupon Codes (Single)
summary: Create A Coupon Code
description: |-
Create a new code for the promotion.
**Note:**
The default rate limit for this endpoint is 40 concurrent requests.
operationId: createPromotionCode
parameters:
- $ref: '#/components/parameters/ContentType'
- $ref: '#/components/parameters/PromotionIdPath'
requestBody:
content:
application/json:
schema:
required:
- code
type: object
properties:
code:
pattern: '[a-zA-Z0-9_\ -]'
type: string
description: 'A unique code that can be used to manually apply a discount. Only letters, numbers, white spaces, underscores, and hyphens are allowed.'
maxLength: 50
max_uses:
type: integer
description: The maximum number of times you can use this coupon code. The default value is 0, which represents unlimited uses. The parent promotion's `max_uses` field overrides the coupon code's `max_uses` field.
example: 10
max_uses_per_customer:
type: integer
description: The maximum number of times a specific customer can use this coupon code. The default value is 0, which represents unlimited uses.
example: 5
required: true
responses:
'201':
$ref: '#/components/responses/PromotionCodeResponse'
delete:
tags:
- Coupon Codes (Bulk)
summary: Delete Multiple Coupon Codes
description: |-
Deletes multiple coupon codes relating to the given promotion. Currently, batches are limited to 50 coupon codes.
**Notes**
* "id:in" query param is required to delete coupon codes. If not provided, or provided with the wrong data format, a 422 error code is returned.
* The default rate limit for this endpoint is 40 concurrent requests.
operationId: deleteCouponCodes
parameters:
- $ref: '#/components/parameters/IdInQuery'
- $ref: '#/components/parameters/PromotionIdPath'
responses:
'204':
description: A 204 response.
content: {}
'422':
$ref: '#/components/responses/BulkDeleteResponse'
'/promotions/{promotion_id}/codegen':
post:
tags:
- Coupon Codes (Bulk)
summary: Generate Multiple Coupon Codes
description: |-
Generate a batch of coupon codes for a particular bulk coupon promotion.
**Note:**
* batch_size (number of codes generated per request) is limited to 250. If batch_size is not an integer or larger than 250, it will return a 422 error code.
* The default rate limit for this endpoint is 10 concurrent requests.
operationId: generatePromotionCodesBatch
parameters:
- $ref: '#/components/parameters/ContentType'
- $ref: '#/components/parameters/Accept'
- $ref: '#/components/parameters/PromotionIdPath'
requestBody:
content:
application/json:
schema:
required:
- batch_size
type: object
properties:
batch_size:
type: integer
description: The number of coupon codes to generate in each batch. The maximum value is 250.
example: 5
minimum: 1
maximum: 250
max_uses:
type: integer
description: The maximum number of times each coupon code can be used. The default value is 1. The value 0 means unlimited usage.
example: 10
minimum: 0
maximum: 100000
max_uses_per_customer:
type: integer
description: The maximum number of times a specific customer can use each coupon code. The default value is 1. The value 0 means unlimited usage.
example: 5
minimum: 0
maximum: 100000
prefix:
pattern: '[A-Z0-9_-]'
type: string
description: The fixed text that will appear at the beginning of every generated coupon code. Only capital letters, numbers, underscores and hyphens are allowed.
example: PRE
maxLength: 20
suffix:
pattern: '[A-Z0-9_-]'
type: string
description: The fixed text that will appear at the end of every generated coupon code. Only capital letters, numbers, underscores and hyphens are allowed.
example: POST
maxLength: 20
delimiter:
pattern: '[_-]'
type: string
description: An optional single character (_ or -) that will be placed between the prefix and the randomly generated code, and again between the randomly generated code and the suffix. It will only be applied if a valid prefix or suffix is present.
example: _
maxLength: 1
exclude_characters:
type: array
items:
type: string
pattern: '[A-Z0-9]'
description: An optional array of single length string elements to exclude from the generated coupon codes. Only capital letters and numbers are allowed. The default value is an empty array [].
example: ["1", "2", "3", "4", "5", "A", "B", "C", "D", "E"]
maxLength: 26
code_length:
type: integer
description: The length of the random string to be generated for each coupon code. The value must be between 6 and 16. The default length is 16. The total length of each generated coupon code is calculated as `:` code_length + length of prefix with delimiter + length of suffix with delimiter. The maximum total length of a coupon code is 50.
example: 10
minimum: 6
maximum: 16
required: true
responses:
'201':
$ref: '#/components/responses/BulkCouponCodesResponse'
'400':
description: Invalid request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse400'
'403':
description: Forbidden.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse403'
'405':
description: Method not allowed. Bulk code generation is only supported for promotions with redemption_type of 'COUPON' and coupon_type of 'BULK'.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse405'
'422':
description: The request payload is invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'/promotions/{promotion_id}/codes/{code_id}':
parameters:
- $ref: '#/components/parameters/Accept'
delete:
tags:
- Coupon Codes (Single)
summary: Delete A Coupon Code
description: |-
Deletes a coupon code.
**Note:**
The default rate limit for this endpoint is 40 concurrent requests.
operationId: deleteCouponCode
parameters:
- $ref: '#/components/parameters/PromotionIdPath'
- $ref: '#/components/parameters/CodeIdPath'
responses:
'204':
description: The deletion was successful or the resource does not exist.
content: {}
components:
schemas:
CreatedFrom:
enum:
- react_ui
- legacy_ui
- api
description: Describes which client originally created the promotion
readOnly: true
PromotionBase:
title: PromotionBase
type: object
description: |-
**Promotion**
A *promotion* is composed of a condition that a customer can satisfy (such as increasing their cart value above a certain amount or adding an item to their cart) and an action will take place (such as a discount on the customer’s order total, or a free item being added to their cart).
properties:
id:
type: integer
description: An auto-generated unique identifier for the discount rule.
example: 1
readOnly: true
redemption_type:
type: string
description: A read-only field indicating the type of promotion. Promotions applied automatically have a value of `AUTOMATIC` whereas promotions requiring a coupon have a value of `COUPON`.
enum:
- AUTOMATIC
- COUPON
readOnly: true
name:
type: string
description: An internal name for this rule that the merchant can refer to.
example: Buy Product X Get Free Shipping
display_name:
type: string
description: Customer-facing name for this rule, that the merchant want to display to customers.
example: WOW!!! FREE SHIPPING for Product X
channels:
type: array
description: 'Channels that the promotion targets. Empty array [] means targeting all the channels. In POST request, if omitted, this field defaults to an empty array [] value.'
items:
$ref: '#/components/schemas/Channel'
customer:
$ref: '#/components/schemas/Customer'
rules:
type: array
description: An ordered list of rules to be executed until the first applicable one applies a discount successfully and the rest will be skipped.
items:
$ref: '#/components/schemas/Rule'
current_uses:
type: integer
description: A read-only count of the times this rule has been used by customers. A rule is considered to be used when a customer successfully checks out with a rule that has applied a discount to their cart.
readOnly: true
example: 2
max_uses:
type: integer
description: The maximum number of times this discount can be used by customers.
example: 10
status:
type: string
description: Controls whether or not a discount rule can be used by customers. `INVALID` is a read-only status into which enabled discount rules may transition when they become invalid.
enum:
- ENABLED
- DISABLED
- INVALID
start_date:
type: string
description: The date and time when this rule will become active.
example: '2005-12-30T01:02:03+00:00'
end_date:
type: string
description: 'The date and time when this rule will expire. If this property is left null, the promotion never expires.'
example: '2025-12-30T01:02:03+00:00'
stop:
type: boolean
description: 'Boolean value that specifies whether to stop evaluating promotions down the priority list when the promotion is applied successfully.'
example: false
can_be_used_with_other_promotions:
type: boolean
description: 'Boolean value that specifies whether this promotion can be used with other promotions. When set to false, only apply this promotion if there are no discounts applied already, and stop executing other promotions if this promotion applies successfully.'
example: false
default: true
currency_code:
type: string
description: The ISO-4217-based transactional currency code to which the promotion applies OR * for all currencies.
example: USD
notifications:
type: array
description: Notifications to display on the storefront based on the result of the evaluation for promotion eligibility.
items:
$ref: '#/components/schemas/Notification'
shipping_address:
$ref: '#/components/schemas/AddressMatcher'
schedule:
$ref: '#/components/schemas/AvailabilityByWeekDay'
PatchCouponPromotion:
title: Patch Coupon Promotion
description: 'A Partial **Coupon Promotion** that contains properties to patch.'
allOf:
- $ref: '#/components/schemas/PromotionBase'
- type: object
properties:
codes:
$ref: '#/components/schemas/CouponCode'
coupon_overrides_automatic_when_offering_higher_discounts:
type: boolean
example: false
default: false
description: |-
This field only has effect when `can_be_used_with_other_promotions` is `false`:
- When the property is set to `true`, the coupon will override the applied automatic promotions if it provides a greater discount.
- When the property is set to `fasle`, the coupon will not be applied if automatic promotions are already applied.
Trying to set the value of this field to `true` when `can_be_used_with_other_promotions` is `true` will yield a 422 error response.
coupon_type:
type: string
enum:
- SINGLE
- BULK
example: BULK
description: |-
The type of the coupon promotion, whether it will have single or multiple codes.
Must be the same as existing value because changing coupon type is not supported. The field is there just for the ease of drafting PUT payload.
DraftCouponPromotion:
title: Draft Coupon Promotion
description: 'A draft **Coupon Promotion** to be created. A shopper must manually apply a *coupon promotion* to their cart.'
allOf:
- $ref: '#/components/schemas/PromotionBase'
- type: object
properties:
codes:
$ref: '#/components/schemas/CouponCode'
coupon_overrides_automatic_when_offering_higher_discounts:
type: boolean
example: false
default: false
description: |-
This field only has effect when `can_be_used_with_other_promotions` is `false`:
- When the property is set to `true`, the coupon will override the applied automatic promotions if it provides a greater discount.
- When the property is set to `fasle`, the coupon will not be applied if automatic promotions are already applied.
Trying to set the value of this field when `can_be_used_with_other_promotions` is `true` will yield a 422 error response.
redemption_type:
type: string
description: The type of the promotion. Promotions applied automatically have a value of `AUTOMATIC` whereas promotions requiring a coupon have a value of `COUPON`.
enum:
- COUPON
coupon_type:
type: string
enum:
- SINGLE
- BULK
default: SINGLE
example: BULK
description: The type of the coupon promotion, whether it will have single or multiple codes, defaults to "SINGLE" if not provided.
required:
- redemption_type
- name
- rules
SavedCouponPromotion:
title: Saved Coupon Promotion
description: '**Coupon Promotion** A shopper must manually apply a *coupon promotion* to their cart.'
allOf:
- $ref: '#/components/schemas/PromotionBase'
- type: object
properties:
id:
type: integer
description: An auto-generated unique identifier for the discount rule.
example: 1
readOnly: true
created_from:
$ref: '#/components/schemas/CreatedFrom'
codes:
$ref: '#/components/schemas/CouponCode'
coupon_overrides_automatic_when_offering_higher_discounts:
type: boolean
example: false
default: false
description: |-
This field only has effect when the `redemption_type` is `COUPON` and `can_be_used_with_other_promotions` is `false`:
- When the property is set to `true`, the coupon will override the applied automatic promotions if it provides a greater discount.
- When the property is set to `fasle`, the coupon will not be applied if automatic promotions are already applied.
Trying to set the value of this field to `true` when the `redemption_type` is not `COUPON`, or when `can_be_used_with_other_promotions` is `true` will yield a 422 error response.
redemption_type:
type: string
description: The type of the promotion. Promotions applied automatically have a value of `AUTOMATIC` whereas promotions requiring a coupon have a value of `COUPON`.
enum:
- COUPON
multiple_codes:
type: object
properties:
has_multiple_codes:
type: boolean
example: false
default: false
coupon_type:
type: string
enum:
- SINGLE
- BULK
description: The type of the coupon promotion, whether it will have single or multiple codes.
example: BULK
required:
- id
- name
- channels
- created_from
- customer
- rules
- notifications
- stop
- currency_code
- redemption_type
- current_uses
- start_date
- status
- can_be_used_with_other_promotions
- coupon_overrides_automatic_when_offering_higher_discounts
- coupon_type
PatchAutomaticPromotion:
title: Patch Automatic Promotion
description: 'A Partial **Automatic Promotion** that contains properties to patch.'
allOf:
- $ref: '#/components/schemas/PromotionBase'
DraftAutomaticPromotion:
title: Draft Automatic Promotion
description: 'A draft **Automatic Promotion** to be created. The store applies *automatic promotions* to a shopper’s cart once the promotion criteria are satisfied. The shopper cannot manually apply an *automatic promotion*.'
allOf:
- $ref: '#/components/schemas/PromotionBase'
- type: object
properties:
redemption_type:
type: string
description: The type of the promotion. Promotions applied automatically have a value of `AUTOMATIC` whereas promotions requiring a coupon have a value of `COUPON`.
enum:
- AUTOMATIC
required:
- redemption_type
- name
- rules
SavedAutomaticPromotion:
title: Saved Automatic Promotion
description: The store applies *Automatic promotions* to a shopper’s cart once the promotion criteria are satisfied. The shopper cannot manually apply an *automatic promotion*.
allOf:
- $ref: '#/components/schemas/PromotionBase'
- type: object
properties:
redemption_type:
type: string
description: The type of the promotion. Promotions applied automatically have a value of `AUTOMATIC` whereas promotions requiring a coupon have a value of `COUPON`.
enum:
- AUTOMATIC
id:
type: integer
description: An auto-generated unique identifier for the discount rule.
example: 1
readOnly: true
created_from:
$ref: '#/components/schemas/CreatedFrom'
required:
- id
- name
- channels
- created_from
- customer
- rules
- notifications
- stop
- currency_code
- redemption_type
- current_uses
- start_date
- status
- can_be_used_with_other_promotions
Customer:
type: object
description: |-
Specifies the requirements which make the customer eligible for the promotion.
Note:
- Only "group_ids" or "excluded_group_ids" should be specified (have non-empty array data), but not both.
- group_id zero (0) signifies guest customers or registered customers who are not assigned to any groups.
properties:
group_ids:
type: array
description: 'A list of customer group IDs that the promotion targets. Only customers in those groups are eligible for this promotion. When unspecified, or set to an empty array, this requirement is not effective, and all customers who satisfy the other requirements (minimum_order_count, excluded_group_ids) are eligible for the promotion.'
example:
- 1
- 2
- 3
items:
type: integer
minimum_order_count:
type: integer
description: The minimum number of completed orders required of the customer.
excluded_group_ids:
type: array
description: 'A list of customer group IDs that the promotion will exclude. Only customers who are NOT in those groups are eligible for this promotion. When unspecified, or set to an empty array, this requirement will not have any effects, and all customers who satisfy the other requirements (group_ids, minimum_order_count) are eligible for the promotion.'
example:
- 1
- 2
- 3
items:
type: integer
example: 0
segments:
oneOf:
- $ref: '#/components/schemas/CustomerSegmentLimitation'
Rule:
title: Rule
type: object
description: |-
**Rule**
A Rule is the executable unit of the promotion. When a ruleʼs condition is met, the API applies the discount defined in the specified action.
properties:
action:
$ref: '#/components/schemas/Action'
apply_once:
type: boolean
description: 'Setting this property to false enables the rule to run repeatedly (for example: 1 free product X for every product Y you purchase)'
default: true
stop:
type: boolean
description: Boolean value that specifies whether to stop executing all the remaining rules down the priority list when the current rule is applied successfully.
condition:
$ref: '#/components/schemas/Condition'
required:
- action
Condition:
description: '**Condition**'
oneOf:
- $ref: '#/components/schemas/CartCondition'
- $ref: '#/components/schemas/AndCondition'
AndCondition:
title: AndCondition
type: object
description: |-
**AndCondition**
Evaluates to true when all children are evaluated to true.
properties:
and:
type: array
description: 'Array of [Conditions](/docs/rest-management/promotions).'
items:
$ref: '#/components/schemas/CartCondition'
CartCondition:
title: Cart Condition
type: object
description: |-
**Cart Condition**
Condition based on the content of the current cart.
properties:
cart:
type: object
properties:
items:
$ref: '#/components/schemas/ItemMatcher'
minimum_spend:
$ref: '#/components/schemas/Money'
minimum_quantity:
type: integer
description: 'Minimum required quantity of the item in the cart for the condition to match. This field is *mandatory* when `items` are specified, but has *no effect* if `items` are not specified.'
example: 1
ItemMatcher:
title: Item Matcher
description: |-
**ItemMatcher**
Lists which items to consider in the condition or action. If this is specified, you will need to also specify at least one of minimum_quantity or minimum_spend.
oneOf:
- $ref: '#/components/schemas/SimpleItemMatcher'
- $ref: '#/components/schemas/NotItemMatcher'
- $ref: '#/components/schemas/AndItemMatcher'
- $ref: '#/components/schemas/OrItemMatcher'
AndItemMatcher:
title: AndItemMatcher
type: object
description: |-
**AndItemMatcher**
Evaluates to true when all children are evaluated to true.
properties:
and:
type: array
description: 'Array of Item Matcher.'
items:
$ref: '#/components/schemas/ItemMatcher2'
OrItemMatcher:
title: OrItemMatcher
type: object
description: |-
**OrItemMatcher**
Evaluates to true when one of its children are evaluated to true.
properties:
or:
type: array
description: 'Array of Item Matcher.'
items:
$ref: '#/components/schemas/ItemMatcher2'
NotItemMatcher:
title: NotItemMatcher
type: object
description: |-
**NotItemMatcher**
Evaluates to true when the child is evaluated to false.
properties:
not:
$ref: '#/components/schemas/ItemMatcher2'
ItemMatcher2:
title: Item Matcher
description: |-
**ItemMatcher**
Lists which items to consider in the condition or action. If this is specified, you will need to also specify at least one of minimum_quantity or minimum_spend.
oneOf:
- $ref: '#/components/schemas/SimpleItemMatcher'
- $ref: '#/components/schemas/NotItemMatcher2'
- $ref: '#/components/schemas/AndItemMatcher2'
- $ref: '#/components/schemas/OrItemMatcher2'
AndItemMatcher2:
title: AndItemMatcher
type: object
description: |-
**AndItemMatcher**
Evaluates to true when all children are evaluated to true.
properties:
and:
type: array
description: 'Array of Item Matcher.'
items:
$ref: '#/components/schemas/ItemMatcher3'
OrItemMatcher2:
title: OrItemMatcher
type: object
description: |-
**OrItemMatcher**
Evaluates to true when one of its children are evaluated to true.
properties:
or:
type: array
description: 'Array of Item Matcher.'
items:
$ref: '#/components/schemas/ItemMatcher3'
NotItemMatcher2:
title: NotItemMatcher
type: object
description: |-
**NotItemMatcher**
Evaluates to true when the child is evaluated to false.
properties:
not:
$ref: '#/components/schemas/ItemMatcher3'
ItemMatcher3:
title: Item Matcher
description: |-
**ItemMatcher**
Lists which items to consider in the condition or action. If this is specified, you will need to also specify at least one of minimum_quantity or minimum_spend.
oneOf:
- $ref: '#/components/schemas/SimpleItemMatcher'
- $ref: '#/components/schemas/NotItemMatcher3'
- $ref: '#/components/schemas/AndItemMatcher3'
- $ref: '#/components/schemas/OrItemMatcher3'
AndItemMatcher3:
title: AndItemMatcher
type: object
description: |-
**AndItemMatcher**
Evaluates to true when all children are evaluated to true.
properties:
and:
type: array
description: 'Array of Item Matcher.'
items:
$ref: '#/components/schemas/SimpleItemMatcher'
OrItemMatcher3:
title: OrItemMatcher
type: object
description: |-
**OrItemMatcher**
Evaluates to true when one of its children are evaluated to true.
properties:
or:
type: array
description: 'Array of Item Matcher.'
items:
$ref: '#/components/schemas/SimpleItemMatcher'
NotItemMatcher3:
title: NotItemMatcher
type: object
description: |-
**NotItemMatcher**
Evaluates to true when the child is evaluated to false.
properties:
not:
$ref: '#/components/schemas/SimpleItemMatcher'
SimpleItemMatcher:
title: Simple Item Matcher
description: '**Simple Item Matcher**'
oneOf:
- $ref: '#/components/schemas/BrandsItemMatcher'
- $ref: '#/components/schemas/CategoriesItemMatcher'
- $ref: '#/components/schemas/ProductsItemMatcher'
- $ref: '#/components/schemas/VariantsItemMatcher'
- $ref: '#/components/schemas/ProductOptionsItemMatcher'
- $ref: '#/components/schemas/ProductCustomFieldMatcher'
BrandsItemMatcher:
title: Brands Item Matcher
type: object
properties:
brands:
type: array
description: List of brand IDs.
example:
- 1
- 2
- 3
items:
type: integer
description: |-
**BrandsItemMatcher**
Brands to which the items should belong.
CategoriesItemMatcher:
title: Categories Item Matcher
type: object
properties:
categories:
type: array
description: List of category IDs.
example:
- 1
- 2
- 3
items:
type: integer
description: |-
**CategoriesItemMatcher**
Categories to which the items should belong.
ProductsItemMatcher:
title: Products Item Matcher
type: object
properties:
products:
type: array
description: List of product IDs.
example:
- 1
- 2
- 3
items:
type: integer
description: |-
**Products Item Matcher**
Specific products which items should be from.
VariantsItemMatcher:
title: Variants Item Matcher
type: object
properties:
variants:
type: array
description: List of variant IDs.
example:
- 1
- 2
- 3
items:
type: integer
description: |-
**Variants Item Matcher**
Product variants which items should be from.
CartValueAction:
title: Cart Value Action
type: object
properties:
cart_value:
required:
- discount
type: object
properties:
discount:
$ref: '#/components/schemas/Discount'
description: |-
**Cart Value Action**
Applies discount on the entire cart.
GiftItemAction:
type: object
properties:
gift_item:
required:
- quantity
type: object
properties:
quantity:
type: integer
description: Quantity of gift item to give.
product_id:
type: integer
description: Product ID of the gift item.
variant_id:
type: integer