Skip to main content

Create Price List

Creates a new price list. You can add product prices in the same request, or add them later with Add Product to Price List.

HTTP Request​

  • URL: /priceList/create
  • Method: POST
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_PRICELIST

Request Body​

Send the details of the new price list.

FieldTypeRequiredDescription
nameStringYesName of the price list.
statusBooleanNoWhether the price list is active. Default is true.
productsArrayNoProduct prices to add. See below.

Product Object​

FieldTypeRequiredDescription
productStringYesID of the product. Each product can appear only once.
priceNumberNoPrice of the product in this price list.
discountNumberNoDiscount percentage off the product's regular price. Used when price is not sent.
tierPriceArrayNoQuantity-based prices for the product. See below.
variantsArrayNoVariant prices. See below.

Variant Object​

FieldTypeRequiredDescription
variantIdStringYesID of a variant of the product.
priceNumberNoPrice of the variant in this price list.
discountNumberNoDiscount percentage off the variant's regular price. Used when price is not sent.
tierPriceArrayNoQuantity-based prices for the variant. See below.

Tier Price Object​

FieldTypeRequiredDescription
quantityNumberNoMinimum quantity for this tier.
priceNumberNoUnit price at this tier.
discountNumberNoDiscount percentage at this tier. Used when price is not sent.
tierPricingTypeStringNofixed, percentage or discount. Default is fixed.

cURL Example​

curl --location '<BASE_URL>/priceList/create' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Wholesale Tier A",
"status": true,
"products": [
{
"product": "663a0cbe516313e5bc94aa8c",
"price": 58.5,
"tierPrice": [
{ "quantity": 10, "price": 55, "tierPricingType": "fixed" }
]
},
{
"product": "66b4a01249e6ce3d41c428fa",
"variants": [
{
"variantId": "66d5a286fcb786834cebb167",
"discount": 10,
"tierPrice": [{ "quantity": 5, "discount": 5 }]
}
]
}
]
}'

Response​

  • 200 OK: The price list was created successfully.
  • 400 Bad Request: The access token is missing or invalid, the request body is empty or not valid, or a product or variant was not found.

Sample JSON Response​

{
"success": true,
"message": "PriceList created Successfully",
"data": {
"_id": "6710c2e5a1b2c3d4e5f60718",
"name": "Wholesale Tier A",
"status": true,
"createdAt": "2024-10-17T08:15:01.102Z",
"updatedAt": "2024-10-17T08:15:01.102Z",
"products": [
{
"_id": "6710c2e5a1b2c3d4e5f6071a",
"priceList": "6710c2e5a1b2c3d4e5f60718",
"product": "663a0cbe516313e5bc94aa8c",
"variants": [],
"discount": 0,
"price": 58.5,
"tierPrice": [
{
"_id": "6710c2e5a1b2c3d4e5f6071b",
"quantity": 10,
"discount": 0,
"price": 55,
"tierPricingType": "fixed"
}
],
"createdAt": "2024-10-17T08:15:01.140Z",
"updatedAt": "2024-10-17T08:15:01.140Z",
"id": "6710c2e5a1b2c3d4e5f6071a"
},
{
"_id": "6710c2e5a1b2c3d4e5f6071c",
"priceList": "6710c2e5a1b2c3d4e5f60718",
"product": "66b4a01249e6ce3d41c428fa",
"variants": [
{
"_id": "6710c2e5a1b2c3d4e5f6071d",
"variantId": "66d5a286fcb786834cebb167",
"discount": 10,
"price": 112.5,
"tierPrice": [
{
"_id": "6710c2e5a1b2c3d4e5f6071e",
"quantity": 5,
"discount": 5,
"price": 106.88,
"tierPricingType": "percentage"
}
]
}
],
"discount": 0,
"price": 0,
"tierPrice": [],
"createdAt": "2024-10-17T08:15:01.140Z",
"updatedAt": "2024-10-17T08:15:01.140Z",
"id": "6710c2e5a1b2c3d4e5f6071c"
}
],
"id": "6710c2e5a1b2c3d4e5f60718"
}
}

Response Details​

FieldTypeDescription
successBooleanWhether the request succeeded.
messageStringResult message.
dataObjectThe new price list with its product prices. See Get Price List.

Notes​

  • If you send price, it is used as is. If you send only discount, the price is calculated from the regular price of the product or variant.
  • For variant tier prices, a tier with price is saved as fixed and a tier with only discount is saved as percentage. The missing value is calculated from the variant's price in this list.
  • Calculated prices are rounded to two decimal places.