Line-item discounts are only supported by the line calculation method. For more information about this method, see the Calculation Method section.
Parameters
Headers
Name
Required
Type
Description
Authorization
Required
string
The Bearer token required to get access to the API.
Body
Name
Required
Type
Description
type
Required
string
Specifies the type of the resource. The type of resource for promotions is, promotion.
name
Required
string
Specifies a name for the promotion.
description
Required
string
Specifies a description for the promotion.
enabled
Required
boolean
Specifies whether the promotion is enabled. The options are true or false, and the default setting is false.
automatic
Required
boolean
Specifies whether the promotion is applied automatically to the cart or a code is required to apply the promotion. The default setting is false. When this value is set to true, a code is autogenerated. If this value is set to false, you must create the code manually. For more information about creating codes, see the Create Promotion Codes section.
promotion_type
Required
string
Specifies the type of the promotion. Use x_for_amount for creating X for amount discount promotions.
max_applications_per_cart
Optional
integer
Specifies the maximum number of application of a promotion per cart.
min_cart_value
Optional
array
Specifies an array of currency-value objects, min_cart_value[].currency and min_cart_value[].amount, that provide the minimum cart value required for the promotion to apply. You can add one or several value specifications in different currencies.
Specifies the promotion value, currency, and the products to be applied for the promotion.
start
Required
string
Specifies the start date and time of the promotion or the start date of the promotion. You can provide a specific time in the HH:MM format. For example, "start": "2000-01-01 12:00". If no time is specified, the default start and end time is set to 00:00.
end
Required
string
Specifies the end date and time of the promotion or the end date of the promotion.
The schema object
Name
Required
Type
Description
schema.x
Required
integer
Specifies the required quantity value of the targeted SKU. For example, for a promotion 2 for 100 for a SKU, the X is the quantity of 2 and 100 is the price amount for the qualified SKU.
schema.currencies[].amount
Required
integer
Specifies the amount of the qualified SKU for the promotion. For example, for a promotion 2 for 100 for a SKU, 100 is the amount of the qualified SKU with quantity of 2.
schema.currencies[].currency
Required
string
Specifies a three-letter currency code. For example, USD.
schema.targets
Required
array [string]
Specifies the product SKUs or unique identifiers of the products included in the promotion. You need to define schema.targets, schema.target_nodes or schema.target_attributes, or all three of them to qualify for this promotion.
schema.target_nodes
Optional
array [string]
Specifies the unique identifiers of the nodes to be applied for the promotion in addition to the product SKUs applied in schema.targets.
schema.exclude.targets
Optional
array [string]
Specifies the product SKUs to be excluded from the promotion.
schema.exclude.nodes
Optional
array [string]
Specifies the unique identifiers of the nodes to be excluded from the promotion.
schema.target_catalogs
Optional
array [string]
Specifies the unique identifiers of the catalogs to be applied for this promotion. If you do not set this parameter, promotion will be applied to all catalogs.
schema.target_attributes[].template
Optional
string
Specifies the name of the template slug to be included in a promotion.
schema.target_attributes[].field
Optional
string
Specifies the unique slug identifier for the field to be included in a promotion.
schema.target_attributes[].type
Optional
string
Specifies the type of the field, such as string, integer, boolean, float, or date.
schema.target_attributes[].value
Optional
Depending on the type of the field, value can be string, integer, boolean, float, or date.
Specifies the value of the field that was specified in the attributes.type. For example, you can specify any color in the value if you indicate color in the attributes.field.
schema.exclude.attributes[].template
Optional
string
Specifies the name of the template slug to be excluded from a promotion.
schema.exclude.attributes[].field
Optional
string
Specifies the unique slug identifier for the field to be excluded from a promotion.
schema.exclude.attributes[].type
Optional
string
Specifies the type of the field, such as string, integer, boolean, float, or date .
schema.exclude.attributes[].value
Optional
Depending on the type of the field, value can be string, integer, boolean, float, or date.
Specifies the value of the field that was specified in the attributes.type. For example, you can specify any color in the value if you indicate color in the attributes.field.