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.
| Field | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Name of the price list. |
status | Boolean | No | Whether the price list is active. Default is true. |
products | Array | No | Product prices to add. See below. |
Product Object
| Field | Type | Required | Description |
|---|---|---|---|
product | String | Yes | ID of the product. Each product can appear only once. |
price | Number | No | Price of the product in this price list. |
discount | Number | No | Discount percentage off the product's regular price. Used when price is not sent. |
tierPrice | Array | No | Quantity-based prices for the product. See below. |
variants | Array | No | Variant prices. See below. |
Variant Object
| Field | Type | Required | Description |
|---|---|---|---|
variantId | String | Yes | ID of a variant of the product. |
price | Number | No | Price of the variant in this price list. |
discount | Number | No | Discount percentage off the variant's regular price. Used when price is not sent. |
tierPrice | Array | No | Quantity-based prices for the variant. See below. |
Tier Price Object
| Field | Type | Required | Description |
|---|---|---|---|
quantity | Number | No | Minimum quantity for this tier. |
price | Number | No | Unit price at this tier. |
discount | Number | No | Discount percentage at this tier. Used when price is not sent. |
tierPricingType | String | No | fixed, 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
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the request succeeded. |
message | String | Result message. |
data | Object | The new price list with its product prices. See Get Price List. |
Notes
- If you send
price, it is used as is. If you send onlydiscount, the price is calculated from the regular price of the product or variant. - For variant tier prices, a tier with
priceis saved asfixedand a tier with onlydiscountis saved aspercentage. The missing value is calculated from the variant's price in this list. - Calculated prices are rounded to two decimal places.