Skip to main content

Create Price List

The POST endpoint creates a new price list with specified details.

Endpoint

  • URL: /priceList/create
  • Method: POST

Authentication

  • Header: accessToken
  • Type: Bearer Token
  • Value: <ACCESS-TOKEN>

Request Headers

HeaderTypeDescription
Content-TypestringMust be application/json.
accessTokenstringAccess token for authentication. (required)

Request Body

The request body should include the details of the price list to create. Below are the fields required:

FieldTypeDescription
namestringThe name of the price list.
statusbooleanThe status of the price list (e.g., true).
productsarrayList of products and their details in the price list.

Products Array:

Each item in the products array can include the following fields:

FieldTypeDescription
productstringThe unique identifier of the product.
variantsarrayList of variant objects for the product.
discountnumberDiscount applied to the product.
pricenumberBase price of the product.
tierPricearrayList of tier pricing objects for the product.

Variant Object:

FieldTypeDescription
variantIdstringThe unique identifier of the product variant.
discountnumberDiscount applied to the variant.
pricenumberPrice of the variant.
tierPricearrayList of tier pricing objects for the variant.

Tier Price Object:

FieldTypeDescription
quantitynumberMinimum quantity for tier pricing.
discountnumberDiscount applied to this tier.
pricenumberPrice at this tier.
tierPricingTypestringType of tier pricing (e.g., "discount", "fixed").

Sample Request Body

{
"name": "test price list update",
"status": true,
"products": [
{
"product": "66b4a01249e6ce3d41c428fa",
"variants": [
{
"variantId": "66d5a286fcb786834cebb167",
"discount": 10,
"price": 1120,
"tierPrice": [
{
"quantity": 4,
"discount": 4,
"price": 1150,
"tierPricingType": "discount"
}
]
},
{
"variantId": "66d5a286fcb786834cebb168",
"discount": 10,
"price": 1130,
"tierPrice": [
{
"quantity": 4,
"discount": 4,
"price": 1152,
"tierPricingType": "discount"
},
{
"quantity": 14,
"discount": 8,
"price": 1100,
"tierPricingType": "fixed"
}
]
}
],
"discount": 0,
"price": 1100,
"tierPrice": [
{
"quantity": 10,
"discount": 8,
"price": 1050,
"tierPricingType": "fixed"
}
]
}
]
}

Response

  • Status Code: 200 OK

Sample Response Body

{
"success": true,
"message": "Price list created successfully",
"data": {
// Details of the created price list, e.g., ID, name, etc.
}
}

Success Response Fields

FieldTypeDescription
successbooleanIndicates the success status of the request, typically true for a successful operation.
messagestringA message conveying the outcome of the operation, e.g., "Price list created successfully".
dataobjectContains details of the newly created price list, defined in See Price list Data

Error Responses

Status CodeDescription
400Bad Request: Invalid input data.
401Unauthorized: Access token is invalid or missing.
500Internal Server Error: An error occurred on the server.

Notes

  • Ensure your request body is formatted according to the specified structure.
  • Provide a valid and active access token in the request header to authenticate your request.