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
}
]
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
}
]
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
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.
"{\"date\": \"2023-01-01T00:00:00.000Z\", \"channel\": 12, \"account\": \"1234abcd5678efgh9ijklmno\",\"stage\":\"production\"}"
Prices conditions
Successfully evaluated the promotions
The response is of type object[]
.
Was this page helpful?