Release Notes
- January 2025
- October 2024
- July 2024
- November 2023
- Feedback and Contact
Calculate prices for products by SKUs
Use this endpoint to calculate prices for one or more products in a specific price list by product SKUs. If you prefer to use item IDs to calculate product prices, use the calculate prices for products by item IDs endpoint.
itemId
is used as the default identifier for a product. If you want to set SKUs as product identifiers and use this endpoint, you must contact fabric support at support@fabric.inc.curl --request POST \
--url https://api.fabric.inc/v3/price-engine/actions/evaluate-products-by-sku \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
--data '{
"priceListId": 100275,
"skus": [
"1000019501",
"1000019502"
],
"customer": {
"id": "5e2cfb9b45570b000864c4b5",
"segments": [
{
"name": "category",
"value": [
"GOLD",
"YELLOW"
]
},
{
"name": "ageGroup",
"value": [
"elderly"
]
}
]
},
"priceParameters": [
{
"additionalProperties": [
{
"id": "length",
"value": 10
},
{
"id": "width",
"value": 20
}
],
"selectedAddOns": [
"blind_motor"
],
"sku": "1000019501",
"quantity": 500
}
],
"isAudit": true,
"locale": "en-US"
}'
{
"errors": [],
"data": [
{
"priceListId": 100275,
"itemId": 11111111,
"currency": "USD",
"channelId": "12",
"offer": {
"price": {
"sale": 1000.15,
"cost": 900.15,
"base": 2000.15,
"unitPriceWithoutDiscounts": 2000.15,
"lineTotalWithoutDiscounts": 2000.15,
"lineTotalWithDiscounts": 2000.15,
"type": "BASE"
},
"discounts": [
{
"amount": 100.15,
"quantity": 1,
"application": 1,
"promotion": {
"id": "6197ec46e836ff000952d668",
"value": 2000.15,
"groupId": "61a6354d0d70e30009415f16",
"level": 1,
"isStackable": true,
"isAlwaysApplied": true,
"name": "20% OFF",
"type": "Coupon",
"discountType": "AMOUNT_OFF",
"stackingType": "STACKABLE",
"promotionMessages": [
{
"promoId": "6197ec46e836ff000952c666",
"title": "Get 50% off socks when buying shoes!",
"message": "Buy any pair of shoes and get 50% off a pair of socks.",
"locales": [
"en-US",
"en-GB"
],
"pages": [
"PDP",
"CART"
],
"type": "DISCOUNT"
}
]
}
}
],
"suggestedProducts": [
{
"promotionId": "6197ec46e836ff000952c668",
"promotionName": "Buy Shoes, get socks 50% off",
"skus": [
"SOCK1",
"SOCK2",
"SOCKN"
],
"eligiblePriceLists": [
10000
],
"isFree": false,
"discountType": "PERCENTAGE_OFF",
"amount": 50,
"quantity": 1
}
],
"additionalAttributes": [
{}
],
"promotionMessages": [
{
"promoId": "6197ec46e836ff000952c667",
"threshold": 3,
"message": "Add another pair of shoes to get free socks!",
"locales": [
"en-US",
"en-GB"
],
"type": "PROXIMITY"
},
{
"promoId": "6197ec46e836ff000952c668",
"title": "Get free socks!",
"message": "Buy two pairs of shoes and get a pair of socks for free!",
"locales": [
"en-US",
"en-GB"
],
"pages": [
"PDP",
"CART"
],
"type": "POTENTIAL_DISCOUNT"
}
]
},
"audit": {
"userId": "62f5e25ca090100009c6e0f0",
"priceMethodType": "SurfaceArea_Square_Increment",
"quantity": 50,
"priceParameters": {
"additionalProperties": [
{
"id": "length",
"value": 10
},
{
"id": "width",
"value": 20
}
]
},
"appliedAddons": [
{
"name": "blind-motor",
"value": 100
}
]
}
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Headers
A header used by fabric to identify the tenant making the request. You must include tenant id in the authentication header for an API request to access any of fabric’s endpoints. You can retrieve the tenant id , which is also called account id, from Copilot. This header is required.
24
The Date and time, in ISO 8601 format, for which the evaluation should be done. The prices and promotions that are active on this date will be considered for evaluation.
"2022-09-06T14:07:17.000Z"
A unique request ID.
"263e731c-45c8-11ed-b878-0242ac120002"
x-fabric-channel-id identifies the sales channel where the API request is being made; primarily for multichannel use cases. The channel ids are 12 corresponding to US and 13 corresponding to Canada. The default channel id is 12. This field is required.
"12"
Body
Evaluate prices for products based on their individual SKUs.
Price list ID of the item.
100275
List of product SKUs for which prices are to be retrieved. You can specify up to 50 SKUs.
Product SKU
["1000019501", "1000019502"]
Customer details
Unique identifier for the customer
"5e2cfb9b45570b000864c4b5"
A list of segments the customer belongs to.
[
{
"name": "category",
"value": ["GOLD", "YELLOW"]
},
{ "name": "ageGroup", "value": ["elderly"] }
]
The parameters used to calculate the price.
The additional parameters for calculating the price.
List of add-ons selected for the product.
Add-on name
["blind_motor"]
Product SKU
"1000019501"
Number of products ordered. This value is required for the range-based pricing method.
500
Specifies whether an audit's required. The options are:
true
: Response includes an audit object mentioning how the price is calculated.false
: Response doesn't include an audit object.
true
The language code, which is a combination of language in ISO 639 format and country in ISO 3166 format. The default value is en-US.
"en-US"
Response
Sample response including successful retrievals and potential errors.
An array containing error codes and corresponding messages.
The validation errors related to the price.
Calculated price details
The price list ID of the item.
100275
Product SKU
"SKU1234"
Discounts or special offers applied to the price.
The calculated price details for line items.
Sale price of the product.
1000.15
Cost of goods sold, from either producing or purchasing from other vendors.
900.15
The base price of a single item before any discounts.
2000.15
Price of a single item without discount. This price is either the base
or sale
price. The type used is noted in the type
property.
2000.15
Total price of all items without calculating discounts. This is the unitPriceWithoutDiscounts
multiplied by the quantity.
5000.15
Total price of all items after all discounts. This is the unitPriceWithoutDiscounts multiplied by the quantity, less the promotion discounts.
5000.15
Price type
"BASE"
Currency string value
"USD"
{
"sale": 1000.15,
"cost": 900.15,
"base": 2000.15,
"unitPriceWithoutDiscounts": 2000.15,
"lineTotalWithoutDiscounts": 2000.15,
"lineTotalWithDiscounts": 2000.15,
"type": "BASE"
}
A list of discounts applied to the price.
Promotion discount
The actual amount of the discounts applied to the price. For example, entering 100.15 for a product with a base price of 2000.15 results in a discounted price of 1900.
100.15
The number of items eligible for the promotional discount.
5
The number of times the BuyGet promotion can be used, indicating how many times you can use the promotions, such as get a certain amount or percentage off, or get free items when making a purchase.
1
Promotion object
A 24-character system-generated coupon ID generated using the create coupon endpoint.
"6197ec46e836ff000952c667"
The discount applied to the price. This can be specified as a percentage or a fixed amount.
2000.15
ID of the group or category this product belongs to
"61a6354d0d70e30009415f16"
The order in which the current promotion is executed.
1
Specifies whether the promotion is stackable. You can set one of the following: - true
: This promotion can be combined with other stackable promotions, allowing multiple discounts to be applied together. - false
: The promotion isn't stackable. You can't combine this promotion with other promotions.
true
Specifies whether the promotion is applied regardless of the exclusive promotions on the same item. You can set one of the following values: - true
: Promotion is applied regardless of the exclusive promotions on the same item. - false
: Promotion isn't applied on the item.
true
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 can't 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 can't 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
"STACKABLE"
Promotion name
"20% off"
Promotion type
"COUPON"
Discount type
PERCENTAGE_OFF
, AMOUNT_OFF
, FIXED_PRICE
"PERCENTAGE_OFF"
The promotion message that is displayed to the customer.
Message description for the promotion
{
"id": "6197ec46e836ff000952c668",
"value": 2000.15,
"groupId": "61a6354d0d70e30009415f16",
"level": 1,
"isStackable": true,
"isAlwaysApplied": true,
"name": "20% OFF",
"type": "Coupon",
"discountType": "AMOUNT_OFF",
"stackingType": "STACKABLE",
"promotionMessages": [
{
"promoId": "6197ec46e836ff000952c666",
"title": "Get 50% off socks when buying shoes!",
"message": "Buy any pair of shoes and get 50% off a pair of socks.",
"locales": ["en-US", "en-GB"],
"pages": ["PDP", "CART"],
"type": "DISCOUNT"
}
]
}
The suggested products.
A list of suggested products.
A placeholder for additional price attributes, in name-values pairs.
The promotion message that is displayed to the customer.
Message description for the promotion
Message name
"Buy 2 get 1 free"
Message description
"Offer valid at participating stores through September 5, 2023."
The types of web pages where the message is displayed.
Page type
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.
Locale
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
"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.
2
A 24-character system-generated coupon ID generated using the create coupon endpoint.
"61df12345678900009b7091c"
Details involved in calculating the price.
The auto populated ID of the user who created the price.
"62f5e25ca090100009c6e0f0"
The method used to calculate the price.
"SurfaceArea_Square_Increment"
The quantity of items for which the price is calculated.
50
The additional parameters for calculating the price.
The additional properties for calculating the price.
[
{ "id": "length", "value": 10 },
{ "id": "width", "value": 20 }
]
List of additional components used in the price calculation
Was this page helpful?
curl --request POST \
--url https://api.fabric.inc/v3/price-engine/actions/evaluate-products-by-sku \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
--data '{
"priceListId": 100275,
"skus": [
"1000019501",
"1000019502"
],
"customer": {
"id": "5e2cfb9b45570b000864c4b5",
"segments": [
{
"name": "category",
"value": [
"GOLD",
"YELLOW"
]
},
{
"name": "ageGroup",
"value": [
"elderly"
]
}
]
},
"priceParameters": [
{
"additionalProperties": [
{
"id": "length",
"value": 10
},
{
"id": "width",
"value": 20
}
],
"selectedAddOns": [
"blind_motor"
],
"sku": "1000019501",
"quantity": 500
}
],
"isAudit": true,
"locale": "en-US"
}'
{
"errors": [],
"data": [
{
"priceListId": 100275,
"itemId": 11111111,
"currency": "USD",
"channelId": "12",
"offer": {
"price": {
"sale": 1000.15,
"cost": 900.15,
"base": 2000.15,
"unitPriceWithoutDiscounts": 2000.15,
"lineTotalWithoutDiscounts": 2000.15,
"lineTotalWithDiscounts": 2000.15,
"type": "BASE"
},
"discounts": [
{
"amount": 100.15,
"quantity": 1,
"application": 1,
"promotion": {
"id": "6197ec46e836ff000952d668",
"value": 2000.15,
"groupId": "61a6354d0d70e30009415f16",
"level": 1,
"isStackable": true,
"isAlwaysApplied": true,
"name": "20% OFF",
"type": "Coupon",
"discountType": "AMOUNT_OFF",
"stackingType": "STACKABLE",
"promotionMessages": [
{
"promoId": "6197ec46e836ff000952c666",
"title": "Get 50% off socks when buying shoes!",
"message": "Buy any pair of shoes and get 50% off a pair of socks.",
"locales": [
"en-US",
"en-GB"
],
"pages": [
"PDP",
"CART"
],
"type": "DISCOUNT"
}
]
}
}
],
"suggestedProducts": [
{
"promotionId": "6197ec46e836ff000952c668",
"promotionName": "Buy Shoes, get socks 50% off",
"skus": [
"SOCK1",
"SOCK2",
"SOCKN"
],
"eligiblePriceLists": [
10000
],
"isFree": false,
"discountType": "PERCENTAGE_OFF",
"amount": 50,
"quantity": 1
}
],
"additionalAttributes": [
{}
],
"promotionMessages": [
{
"promoId": "6197ec46e836ff000952c667",
"threshold": 3,
"message": "Add another pair of shoes to get free socks!",
"locales": [
"en-US",
"en-GB"
],
"type": "PROXIMITY"
},
{
"promoId": "6197ec46e836ff000952c668",
"title": "Get free socks!",
"message": "Buy two pairs of shoes and get a pair of socks for free!",
"locales": [
"en-US",
"en-GB"
],
"pages": [
"PDP",
"CART"
],
"type": "POTENTIAL_DISCOUNT"
}
]
},
"audit": {
"userId": "62f5e25ca090100009c6e0f0",
"priceMethodType": "SurfaceArea_Square_Increment",
"quantity": 50,
"priceParameters": {
"additionalProperties": [
{
"id": "length",
"value": 10
},
{
"id": "width",
"value": 20
}
]
},
"appliedAddons": [
{
"name": "blind-motor",
"value": 100
}
]
}
}
]
}