This endpoint allows you to create a new cart promotion. Cart promotions can be configured with different conditions, actions, and restrictions.You can define conditions based on cart subtotal, item counts, specific products, and tender types.
Example request
curl --location 'https://{host}/api_gateway/v1/promotions' \
--header 'Content-Type: application/json' \
--header 'X-CAP-API-AUTH-ORG-ID: 100232' \
--header 'user-agent: pyapps_auto_Promotion_Engine_Eucrm_Smoke' \
--header 'Authorization: Basic bmFtYW5fZG9jOmEzYjRjYjgyMzA3MWJ5OGM5ZmM2YjZlY2I2MmEy' \
--header 'Cookie: _cfuvid=3BEQBk3KhWSvCBbkc_9JT9WZCItAErcD.ufdR6Nid9E-1757644679910-0.0.1.1-604800000' \
--data '{
"name": "Goldpromotionsi",
"orgId": 100027,
"priority": 0,
"active": true,
"messageLabel": "test!!",
"type": "CODE",
"condition": {
"type": "CART",
"cartCondition": {
"kpi": "SUBTOTAL",
"operator": "EQUALS",
"value": 250.0
}
},
"action": {
"type": "CART_BASED",
"cartBasedAction": {
"type": "ABSOLUTE",
"value": 25.0
}
},
"createdBy": 70707,
"createdOn": 0,
"lastUpdatedBy": 70707,
"startDate": "1757388651000",
"endDate": "1757475051000",
"campaignId": 39077,
"mode": "DISCOUNT",
"promotionRestrictions": {
"Code": [
{
"kpi": "REDEMPTION",
"limit": 1
}
]
},
"isStackable": false
}'
Prerequisites
- Authentication: Basic or OAuth authentication.
- Default access group
Rate limit
- Demo and Testing Clusters: 1,000 requests per minute per API key
- Other Organizations: The rate limit is brand-specific.
To modify the limit, create a ticket with the Capillary Product support team.
Body parameters
Field | Type | Required | Description |
---|---|---|---|
name | String | Yes | Indicates a unique name of the promotion.Character limit : 1-50. |
priority | Integer | Yes | Specifies the order in which promotions are applied. Lower numbers have higher priority.
By default, the priority value is The order of application will be: Promotion A(priority 0) Promotion A (priority 1) Promotion C (priority 2) Note: If |
active | Boolean | Yes | Indicates if the promotion is active. Supported values are |
messageLabel | String | Yes | Specifies a label for the promotion message. There is no character limit set for labels. Example: |
type | Enum | Yes | Specifies the type of promotion. Supported values are: |
.condition | Object | Yes | Specifies the rules that determine how the promotion applies. Conditions can be based on factors such as cart subtotal or on the type of items in the cart. |
..type | Enum | Yes | Specifies the type of condition used to evaluate a promotion. Supported values are: |
..cartCondition | Object | Conditional | Defines rules that apply to the entire shopping cart. This object is required when |
....kpi | Enum | Yes | Specifies the metric used to evaluate the cart condition. Supported values are: |
....operator | Enum | Yes | Specifies the comparison operator used for the cart condition. Supported values: |
....value | Number | Yes | Specifies the number to compare against for the cart condition. The value can be an integer or a decimal. Examples |
action | Object | Yes | Specifies what happens when the promotion is applied. The action defines the scope of the discount or reward. Example If |
..type | Enum | Yes | Specifies the scope of the action when the promotion is applied. Supported values: |
..cartBasedAction | Object | Conditional | Defines the action that applies to the entire shopping cart. Use this when |
....type | Enum | Yes | Specifies the type of cart-based action. Supported values: |
....value | Number | Yes | Specifies the value for the cart-based action. This can be an integer or a decimal, depending on the action type. For ABSOLUTE, the value is a currency amount. Example: |
startDate | Long | Yes | Specifies the date and time when the promotion becomes active. The value is expressed as a Unix epoch timestamp in milliseconds (UTC). Example |
endDate | Long | Yes | Specifies the end date and time when the promotion was created. The value is expressed as a Unix epoch timestamp in milliseconds (UTC). Example |
campaignId | Long | Yes | Specifies the unique identifier of the campaign that the promotion is linked to. Example If a promotion belongs to the “Holiday Sale 2025” campaign with ID |
mode | Enum | Yes | Specifies how the promotion is applied. Supported values: |
.promotionRestrictions | Object | Optional | Defines the limitations applied to the promotion, if any. Restrictions are grouped by level, which specifies where the restriction applies. Supported levels include: |
..Code | Array of Objects | Optional | Specifies restrictions that apply to promotion codes. This is an array of objects, where each object defines a key performance indicator (KPI) and its limit. |
....kpi | Enum | Yes | Specifies the metric used to apply the restriction. Supported values: |
....limit | Number | Yes | Specifies the maximum allowed value for the restriction. Must be a positive integer. Examples |
isStackable | Boolean | Yes | Indicates whether this promotion can be used together with other promotions. Supported values: |
Example response
{
"data": {
"id": "68c01c8aaa0d7a770cbaec76",
"name": "CODd_Promotion_Test_17573886",
"orgId": 100737,
"priority": 0,
"active": true,
"messageLabel": "test!!",
"type": "CODE",
"condition": {
"type": "CART",
"cartCondition": {
"kpi": "SUBTOTAL",
"operator": "EQUALS",
"value": "250.000000"
}
},
"action": {
"type": "CART_BASED",
"cartBasedAction": {
"type": "ABSOLUTE",
"value": "25.000000"
}
},
"createdBy": 75152721,
"createdOn": 1757420682387,
"lastUpdatedBy": 75152721,
"lastUpdatedOn": 1757420682387,
"startDate": 1757388651000,
"endDate": 1757475051000,
"campaignId": 39077,
"promotionRestrictions": {
"Code": [
{
"kpi": "REDEMPTION",
"limit": "1.000000"
}
]
},
"earnLimitedToSpecificAudience": false,
"mode": "DISCOUNT",
"maxIssuancePerCustomer": 1,
"isStackable": false
}
}
Response parameters
Field | Type | Description |
---|---|---|
data | Object | The main container object for the promotion details. |
..id | String | Indicates the unique identifier assigned to the promotion by the system. |
..name | String | The name of the promotion. |
..orgId | Long | Indicates the organization ID this promotion is associated with. |
..priority | Integer | The priority of the promotion. A higher number indicates higher priority. Defaults to 0 if not explicitly set during creation. |
..active | Boolean | Indicates if the promotion is active. |
..messageLabel | String | Indicates the label for the promotion message. |
..type | String | The type of promotion. Possible values: POS, CODE, CUSTOMER, EARNING, REWARD. |
..condition | Object | Defines the conditions under which the promotion applies. |
....type | String | Indicates the type of condition. Possible values: CART, PRODUCT, COMBO_PRODUCT, TENDER. |
....cartCondition | Object | Specifies conditions related to the shopping cart. Present if data.condition.type is CART. |
......kpi | String | The Key Performance Indicator for the cart condition. Possible values: SUBTOTAL, TOTAL_QUANTITY, TOTAL_ITEMS, NONE. |
......operator | String | The operator to use for the cart condition comparison. Possible values: EQUALS, GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, NONE. |
......value | String (BigDecimal) | The value to compare against for the cart condition. Returned as a string with fixed decimal places, representing a BigDecimal. |
..action | Object | Defines the action taken when the promotion applies. |
....type | String | The type of action. Possible values: FIXED_PRICE, CART_BASED, PRODUCT_BASED, FREE_PRODUCT, TENDER, PER_UNIT. |
....cartBasedAction | Object | Specifies actions related to the shopping cart. Present if data.action.type is CART_BASED. |
......type | String | The type of cart-based action. Possible values: ABSOLUTE, PERCENTAGE. |
......value | String (BigDecimal) | Indicates the value for the cart-based action, returned as a string with fixed decimal places, representing a BigDecimal. |
..createdBy | Long | Indicates the unique identifier of the user who created the promotion. |
..createdOn | Long | Indicates the date and time when the promotion was created in Unix epoch milliseconds. |
..lastUpdatedBy | Long | Indicates the unique identifier of the user who last updated the promotion. |
..lastUpdatedOn | Long | Indicates the date and time when the promotion was last updated in Unix epoch milliseconds. |
..startDate | Long | Indicates the start date of the promotion in Unix epoch milliseconds. |
..endDate | Long | Indicates the end date of the promotion in Unix epoch milliseconds. |
..promotionRestrictions | Object | Indicates the restrictions applied to the promotion. |
....Code | Array of Objects | Indicates the restrictions specific to promotion codes. |
......kpi | String | Indicates the Key Performance Indicator for the restriction. Possible values: REDEMPTION, TRANSACTION, DISCOUNT. |
......limit | String (BigDecimal) | Indicates the limit for the specified KPI, returned as a string with fixed decimal places, representing a BigDecimal. |
..earnLimitedToSpecificAudience | Boolean | Indicates if earning is limited to a specific audience. |
..mode | String | Indicates the mode of the promotion. Possible values: DISCOUNT, PAYMENT_VOUCHER. |
..maxIssuancePerCustomer | Integer | Indicates the maximum number of times this promotion can be issued to a single customer. |
..isStackable | Boolean | Indicates if this promotion can be combined with other promotions. Defaults to false if not provided. |
Use Case
Requirement : The brand wants to setup a promotion "Free shipping on orders above $500" with conditions that if the cart subtotal is greater than $500, provide free shipping.
Example Request
{
"name": "FreeShipping500",
"orgId": 10001,
"priority": 1,
"active": true,
"messageLabel": "Free Shipping on $500+",
"type": "CODE",
"condition": {
"type": "CART",
"cartCondition": {
"kpi": "SUBTOTAL",
"operator": "GREATER_THAN",
"value": 500.0
}
},
"action": {
"type": "CART_BASED",
"cartBasedAction": {
"type": "ABSOLUTE",
"value": 20.0
}
},
"createdBy": 70707,
"createdOn": 0,
"lastUpdatedBy": 70707,
"startDate": "1757388651000",
"endDate": "1757475051000",
"campaignId": 39077,
"mode": "DISCOUNT",
"promotionRestrictions": {
"Code": [
{
"kpi": "REDEMPTION",
"limit": 1
}
]
},
"isStackable": false
}
Example response
{
"data": {
"id": "68c3e98baa0d7a770cbb0952",
"name": "FreeShipping500",
"orgId": 100737,
"priority": 1,
"active": true,
"messageLabel": "Free Shipping on $500+",
"type": "CODE",
"condition": {
"type": "CART",
"cartCondition": {
"kpi": "SUBTOTAL",
"operator": "GREATER_THAN",
"value": "500.000000"
}
},
"action": {
"type": "CART_BASED",
"cartBasedAction": {
"type": "ABSOLUTE",
"value": "20.000000"
}
},
"createdBy": 75152721,
"createdOn": 1757669771918,
"lastUpdatedBy": 75152721,
"lastUpdatedOn": 1757669771918,
"startDate": 1757388651000,
"endDate": 1757475051000,
"campaignId": 39077,
"promotionRestrictions": {
"Code": [
{
"kpi": "REDEMPTION",
"limit": "1.000000"
}
]
},
"earnLimitedToSpecificAudience": false,
"mode": "DISCOUNT",
"maxIssuancePerCustomer": 1,
"isStackable": false
}
}
Error codes
Code | Description |
---|---|
400 | Invalid request. Check required parameters. |
400 | Enum value is invalid. Check type , kpi , operator fields for valid values. |
401 | Unauthorized. Check your authentication credentials. |
500 | Internal server error. Retry the request after a short delay. |