Authentication v1
- Identity APIs
- User
- Address
- Auth
User Self Service APIs
- Introduction
- User Self Service APIs
- Authentication APIs
Experiences v2 (XM v2)
- XM
- Pages
- Global Components
- Menu
Experiences v1 (XM v1)
- XM
- Pages
- Global Components
- Menu
Product Catalog
- Product Catalog
- Category
- Product
- Attributes
- Bulk Import
Orders v2 (OMS v2)
- Order Management System
- Order
- Order Attribute
- Developer Guide
- Order Return
- Payment Status
- Package Tracking
- Cross Border
- Order Cancellation
- Appeasement
- Allocation
- Configuration
- Fraud Configuration
- Target Configuration
- Location
- Location Attribute
- Inventory Network
- Inventory
- Inventory Counter
- Inventory Bulk Operation
- Inventory Attribute
- Inventory Upload Log
- Shipment
- Shipping Method
- Webhook
- Notification
- Export
- Invoice
- Fraud
- Backorder Preorder Reservation
- List
Orders v1 (OMS v1)
- Order Management System
- Cart
- Bill To
- Ship To
- Wishlist
- Cart Decoupled
- Warehouse
- Inventory
- Attributes
- List
- Tax/Address Validate
- Shipping
- Payments
- Order
Offers v2
- Offers
- Developer Guide
- Promotion
- Price Kind
- Dynamic Pricing Engine
- Segment
- Coupon
- Coupon Codes
- Product
- Price List
- Attributes
- Item
- Price Guard
- Global Exclusion
- Upload Price CSV
- Pricing
- Redemption
- Exports
Offers v1
- Offers
- Login API
- Promotions
- Pricing
Subscriptions (SMT API)
- Subscriptions API
- Cancellation Reasons
- Subscription Discounts
- Subscriptions
- Subscribers
- Orders
Loyalty (Member)
- Member APIs
- Inquire
- Discounts
- Redeem
- Earn
- Members
Dropship
- Dropship API
- Shipments
- Products
- Invoices
- Connections
- Inventory
- Developer Guide
- Returns
- Orders
Cart API
- Cart
- Order Draft
- Attribute
- Adjustments
- Shipping
- Cart
Checkout API
- Checkout
- Checkout
Customer
- Core Concepts
- Customer Service
- Organization
- User Party
- Organization Group Addresses
- User Internal Party
- Organization Contracts
- Party
- Party Contracts
- Contracts
- User
- Search
- User Trait
- Organization Users
- Address
- User Address
- Trait
- Party Address
- Party Trait
- Organization Group Users
- Internal Party
- Contract Pricelist
- Internal Parties Party
- Account
- Party Account
- Organization Addresses
- Organization Groups
- Individual Addresses
- Users Organization
- Individual
Evaluate promotions
Evaluates a cart’s promotions, discount coupons and implicit promotions, either by specified itemId or by SKU (based on the customer specific configuration set in the backend)
curl --request POST \
--url https://live.copilot.fabric.inc/v1/promo/evaluate-promotions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-site-context: <x-site-context>' \
--data '{
"traceId": "394823457",
"isLoggedIn": true,
"userId": "5e2cfb9b45570b000864c4b5",
"promoCodes": [
"SUPERCOUPON1",
"FIRSTPURCHASE10"
],
"shipping": [
{
"shippingMethodId": 123,
"shippingPrice": 20
}
],
"items": [
{
"lineItemId": 1,
"priceList": 100275,
"sku": 1111111,
"itemId": 1111111,
"quantity": 5,
"group": [
"5e2cfb9b45570b000863c4b5"
],
"hierarchy": [
[
"clothingId1",
"footwear",
"sandalsId1"
],
[
"nike",
"sandalsId2"
],
[
"clothingId2",
"beach"
]
],
"productAttributes": {
"color": [
"red",
"green"
],
"brand": "Nike",
"size": "10"
},
"priceParams": {
"options": {
"length": "2",
"width": "15",
"blindMotor": true
}
},
"price": {
"sale": 10,
"base": 123
},
"channel": [
12,
15
],
"shippingMethodId": 123,
"shippingPrice": 20
}
],
"date": "2019-08-24T14:15:22Z",
"userProfile": {
"Customer Type": [
"Wholesale"
]
}
}'
[
{
"items": [
{
"lineItemId": 1,
"sku": 1111111,
"itemId": 1111111,
"priceList": 100275,
"group": [
"5e2cfb9b45570b000863c4b5",
"clothingId1",
"footwear"
],
"quantity": 5,
"price": {
"currency": "USD",
"base": 10,
"kind": "BASE",
"totalPrice": 50,
"finalPrice": 50,
"sale": 50
},
"priceAttributes": {
"cost": 9,
"floor": 10,
"clearance": 10
},
"discount": [
{
"quantity": 5,
"amount": 10,
"unit": "%OFF",
"value": 10,
"promoId": "6197ec46e836ff000952c668",
"promoCode": "SUPERCOUPON20",
"promoTitle": "20% off",
"type": "COUPON",
"application": 1,
"isStackable": true,
"isAlwaysApplied": false,
"level": 1,
"stackingType": "STACKABLE",
"proratedAmount": 10,
"proratedQuantity": 1
}
],
"attributes": {
"color": "red",
"brand": "Nike",
"size": "10"
},
"shippingPrice": 20,
"shippingMethodId": 123,
"shippingDiscount": 5
}
],
"errors": [
"Parameter does not exist"
],
"shipping": [
{
"shippingMethodId": 456,
"shippingPrice": 5,
"shippingDiscount": 5
}
],
"appliedDiscounts": [
{
"promoId": "6197ec46e836ff000952c668",
"promoCode": "SUPERCOUPON20",
"promoTitle": "20% off",
"type": "COUPON",
"amount": 10
}
],
"suggestedProducts": [
{
"promotionId": "6197ec46e836ff000952c668",
"promotionTitle": "Buy Shoes, get socks for free",
"itemId": 234343,
"sku": "SHOE1234",
"eligiblePriceLists": [
1000
],
"quantity": 2,
"free": true,
"discountType": "%OFF",
"amount": 100
}
],
"notAppliedCoupons": [
{
"promoCode": "SUPERCOUPON",
"promoId": "624b5aa2a8fd12000965dfdc",
"message": "Invalid coupon"
}
],
"promotionMessages": [
{
"promoId": "61df12345678900009b7091c",
"title": "Buy 2 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP"
],
"locales": [
"en-CA"
],
"type": "DISCOUNT",
"threshold": 2
}
],
"success": true
}
]
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Headers
The x-site-context
header is a JSON object that contains information about the source you wish to pull from. The mandatory account
is the 24 character identifier found in Copilot. The channel
(Sales channel ID), stage
(environment name), and date
attributes can be used to further narrow the scope of your data source.
Body
Prices conditions
List of item information objects
Price list ID or name
Quantity of the item ordered
Item sequence number
SKU of the item. Either SKU or ItemId is mandatory. If both provided, SKU overrides itemId.
ID of the item. Either SKU or ItemId is mandatory. If both provided, SKU overrides itemId.
List of Group IDs. Groups the promotions belongs to. When a group of promotions is subject to non-stackable, it will be compared to other promotion groups and the highest discount providing group will be applied as promotion.
Item hierarchy to evaluate promotions
Price parameters for calculating price
List of channel IDs from where the request is coming
Shipping Method ID to check if promotion is applicable to the shipping of the item. You can use this field if you want to add shipping cost for individual items. If you want to add shipping cost for the entire cart, use shipping
array field.
Shipping cost for the individual item. You can use this field if you want to add shipping cost for individual items. If you want to add shipping cost for the entire cart, use shipping
array field.
Trace ID, used to trace logs
true: user logged in<br /> false: user is not logged in
User ID
A list of coupon codes that are applicable only for coupons. For coupons, the response includes promo codes associated with the coupon. For promotions, the response includes an empty array.
Shipping cost for the entire cart. You can use this shipping
array if you want to add shipping cost for the entire cart.<br /> If you want to add shipping cost for individual items, you can provide details for each item using items.shippingMethodId
and items.shippingPrice
fields.
Date for which the promotions to be evaluated
Response
Sequence number of the item
Item SKU
Item ID
Price list ID or name, depending on configuration
Group or category the promotion belongs to. When a group of promotions is subject to non-stackable, it will be compared to other promotion groups and the highest discount providing group will be applied as promotion.
Number of items
Currency code
Base price. It is the minimum fixed price of the item
Price kind name
Total price after all the discounts
Final Price of the item, does not include discounts
Price at which the item is offered for sale
Number of items
Discount amount
Unit of discount measurement
Discount value
Promotion ID
Coupon code
Promotion title
Promotion type
It is used specifically for BuyGet type that applies when you Buy something and Get discount of some amount or percentage or free items. This field indicates how many times this BuyGet promotion is applied.
A flag indicating whether the promotion can be stacked. Set it to true
if multiple promotions can be applied together and false
if the promotions cannot be combined.
A flag indicating whether the promotion is always applied. Set it to true
if the promotion is always applied, even on non-stackable promotions and false
to apply promotions based on configured conditions.
The promotion execution order. Promotion types are assigned default execution orders. Initial evaluation begins with level 1 promotions. The result of level 1 is used as the base price for level 2. Similarly, the result of level 2 becomes the base price for level 3, and so on.
Defines the rules for how a promotion can be combined with other promotions. This field determines whether a specific promotion can be applied in conjunction with other active promotions during a transaction or if it must be used exclusively. Possible values: - STACKABLE
: This promotion can be combined with other stackable promotions, allowing multiple
discounts to be applied together. The order in which stackable promotions are applied
is determined by the level
field, with promotions having a higher priority (lower numeric value)
being applied before those with a lower priority.
EXCLUSIVE
: This promotion cannot be combined with any other promotions. Thelevel
field is used to determine which exclusive promotion will be evaluated and applied first. Once an exclusive promotion is applied, no other promotions can be used in the same transaction.TYPE_EXCLUSIVE
: This promotion cannot be combined with other promotions of the same type. Thelevel
field is used to determine which promotion within the same type will be evaluated and applied first.UNIVERSAL
: This promotion can be combined with any other promotions without restrictions. Universal promotions will be evaluated last.
STACKABLE
, EXCLUSIVE
, TYPE_EXCLUSIVE
, UNIVERSAL
The BuyGet promotions distribute the discount across specified parameters. For example, when buying A results in a discount on B, the discount amount on B is prorated across both A and B. The distributed amount is reflected in proratedAmount
, while the quantity is captured in proratedQuantity
.
The proratedQuantity
is used in conjunction with proratedAmount
to determine the discount portion allocated to the respective units of BuyGet promotions. This is applicable in partial return scenarios.
Shipping price
Shipping method ID used to check if promotion is applicable to the shipping method
Shipping discount if any
Promotion ID
Promotion title
Free Item's ID
Free SKU
Price list IDs promotion applies to. If empty, promotion applies to all price lists.
Number of free items promotion gives
true when a free item is provided as a promotion
Type of discount
%OFF
, AMOUNT_OFF
, FIXED_PRICE
Amount for discount
The promotion message that is displayed to the customer.
Promotion ID
The title of the promotion message, summarizing the offer or discount type.
A promotional message providing details about the offer, including eligibility, duration, and conditions.
The web pages where the message is displayed, whether the product display page (PDP), product list page (PLP), the customer's cart, or the checkout page.
PDP
, PLP
, Cart
, Checkout
The geographic regions where the promotion message is displayed, determined by the user's IP address. Locales define language and country-specific settings for promotions.
Specifies the promotion message type.
DISCOUNT
: The discount has been applied.PROXIMITY
: The product or cart is close to meeting discount conditions.POTENTIAL_DISCOUNT
: The product could qualify for a discount but has not yet.
DISCOUNT
, PROXIMITY
, POTENTIAL_DISCOUNT
Indicates a quantity or amount that is close to meeting the discount requirement. If the user reaches this value, a promotion message is displayed. This field is only valid for PROXIMITY messages.
Indicates if promotion is successfully evaluated
Was this page helpful?
curl --request POST \
--url https://live.copilot.fabric.inc/v1/promo/evaluate-promotions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-site-context: <x-site-context>' \
--data '{
"traceId": "394823457",
"isLoggedIn": true,
"userId": "5e2cfb9b45570b000864c4b5",
"promoCodes": [
"SUPERCOUPON1",
"FIRSTPURCHASE10"
],
"shipping": [
{
"shippingMethodId": 123,
"shippingPrice": 20
}
],
"items": [
{
"lineItemId": 1,
"priceList": 100275,
"sku": 1111111,
"itemId": 1111111,
"quantity": 5,
"group": [
"5e2cfb9b45570b000863c4b5"
],
"hierarchy": [
[
"clothingId1",
"footwear",
"sandalsId1"
],
[
"nike",
"sandalsId2"
],
[
"clothingId2",
"beach"
]
],
"productAttributes": {
"color": [
"red",
"green"
],
"brand": "Nike",
"size": "10"
},
"priceParams": {
"options": {
"length": "2",
"width": "15",
"blindMotor": true
}
},
"price": {
"sale": 10,
"base": 123
},
"channel": [
12,
15
],
"shippingMethodId": 123,
"shippingPrice": 20
}
],
"date": "2019-08-24T14:15:22Z",
"userProfile": {
"Customer Type": [
"Wholesale"
]
}
}'
[
{
"items": [
{
"lineItemId": 1,
"sku": 1111111,
"itemId": 1111111,
"priceList": 100275,
"group": [
"5e2cfb9b45570b000863c4b5",
"clothingId1",
"footwear"
],
"quantity": 5,
"price": {
"currency": "USD",
"base": 10,
"kind": "BASE",
"totalPrice": 50,
"finalPrice": 50,
"sale": 50
},
"priceAttributes": {
"cost": 9,
"floor": 10,
"clearance": 10
},
"discount": [
{
"quantity": 5,
"amount": 10,
"unit": "%OFF",
"value": 10,
"promoId": "6197ec46e836ff000952c668",
"promoCode": "SUPERCOUPON20",
"promoTitle": "20% off",
"type": "COUPON",
"application": 1,
"isStackable": true,
"isAlwaysApplied": false,
"level": 1,
"stackingType": "STACKABLE",
"proratedAmount": 10,
"proratedQuantity": 1
}
],
"attributes": {
"color": "red",
"brand": "Nike",
"size": "10"
},
"shippingPrice": 20,
"shippingMethodId": 123,
"shippingDiscount": 5
}
],
"errors": [
"Parameter does not exist"
],
"shipping": [
{
"shippingMethodId": 456,
"shippingPrice": 5,
"shippingDiscount": 5
}
],
"appliedDiscounts": [
{
"promoId": "6197ec46e836ff000952c668",
"promoCode": "SUPERCOUPON20",
"promoTitle": "20% off",
"type": "COUPON",
"amount": 10
}
],
"suggestedProducts": [
{
"promotionId": "6197ec46e836ff000952c668",
"promotionTitle": "Buy Shoes, get socks for free",
"itemId": 234343,
"sku": "SHOE1234",
"eligiblePriceLists": [
1000
],
"quantity": 2,
"free": true,
"discountType": "%OFF",
"amount": 100
}
],
"notAppliedCoupons": [
{
"promoCode": "SUPERCOUPON",
"promoId": "624b5aa2a8fd12000965dfdc",
"message": "Invalid coupon"
}
],
"promotionMessages": [
{
"promoId": "61df12345678900009b7091c",
"title": "Buy 2 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP"
],
"locales": [
"en-CA"
],
"type": "DISCOUNT",
"threshold": 2
}
],
"success": true
}
]