Skip to main content
POST
/
price-engine
/
actions
/
evaluate-products-by-id
Calculate prices for products by IDs
curl --request POST \
  --url https://api.fabric.inc/v3/price-engine/actions/evaluate-products-by-id \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
  --data '{
  "priceListId": 100275,
  "itemIds": [
    111111,
    222222
  ],
  "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"
      ],
      "quantity": 500,
      "itemId": 12345
    }
  ],
  "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",
            "itemIds": [
              10021,
              10022,
              10023
            ],
            "eligiblePriceLists": [
              10000
            ],
            "isFree": false,
            "discountType": "PERCENTAGE_OFF",
            "amount": 50,
            "quantity": 1
          }
        ],
        "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"
          }
        ],
        "additionalAttributes": [
          {}
        ]
      },
      "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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-fabric-tenant-id
string
required

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.

Required string length: 24
x-fabric-date
string

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.

Example:

"2022-09-06T14:07:17.000Z"

x-fabric-request-id
string

A unique request ID.

Example:

"263e731c-45c8-11ed-b878-0242ac120002"

x-fabric-channel-id
string

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.

Example:

"12"

Body

application/json

A sample request to evaluate the prices of products by item IDs.

priceListId
integer
required

The price list ID associated with the item generated using the create price list endpoint.

Example:

100275

itemIds
integer[]
required

A list of 50 or fewer item IDs to retrieve prices.

Required array length: 1 - 50 elements

The product ID.

Example:
[111111, 222222]
customer
object

Customer details

priceParameters
object[]

The parameters for price calculation.

isAudit
boolean

A flag indicating whether the audit details should be included in the response. Set to true to include the audit details along with the price calculation details and set to false to exclude the audit details in the response.

Example:

true

locale
string

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.

Example:

"en-US"

Response

OK

Sample response including successful retrievals and potential errors.

errors
object[]

An array containing error codes and corresponding messages.

data
object[]
I