Skip to main content

Create Quote

This POST API allows you to create a new quote for a specific company, including details about products, quantities, and requested prices.

Endpoint Details

  • URL: /quote/create
  • Method: POST
  • Authentication: Bearer Token (required)

Authentication

You must provide a valid accessToken in the request headers to authenticate and access this endpoint.

Authentication Headers

HeaderTypeDescription
Content-TypestringMust be set to application/json.
accessTokenstringA valid access token is required.

Request Body

The request body should be in JSON format and must contain the following details to create a quote:

FieldTypeDescription
titlestringThe title of the quote.
companystringThe unique identifier of the company associated with the quote.
customerstringThe unique identifier of the customer for whom the quote is created.
statusstringThe status of the quote (e.g., "pending", "approved", "rejected").
productsarrayArray of objects detailing the products, including quantities and requested prices.
commentstringAdditional comments or notes for the quote.

Product Object (products[])

Each object in the products array should follow this structure:

FieldTypeDescription
productstringUnique identifier for the product.
variantstringUnique identifier for the product variant (optional).
quantitynumberQuantity of the product or variant requested in the quote.
requestedPricestringThe price requested for the product or variant in the quote.

Sample Request Body

{
"title": "Summer Order Quote",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"status": "pending",
"products": [
{
"product": "65b88ef5045a7d009e79974b",
"quantity": 1,
"requestedPrice": "2107"
},
{
"product": "66b4a01249e6ce3d41c428fa",
"variant": "66d5a286fcb786834cebb16a",
"quantity": 2,
"requestedPrice": "2107"
}
],
"comment": "Please expedite the processing of this quote."
}

Response

Success Response

Status CodeDescription
200 OKThe request was successful, and the new quote was created.

Success Response Body Structure

FieldTypeDescription
successbooleanIndicates if the request was successful.
messagestringMessage indicating the result of the operation.
dataobjectContains the details of the newly created quote.

Sample Response Body

{
"success": true,
"message": "Quote created Successfully",
"data": {
"id": "7323abc1648b4f3a8dfd7e23",
"title": "Summer Order Quote",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"status": "pending",
"products": [
{
"product": "65b88ef5045a7d009e79974b",
"quantity": 1,
"requestedPrice": "2107"
},
{
"product": "66b4a01249e6ce3d41c428fa",
"variant": "66d5a286fcb786834cebb16a",
"quantity": 2,
"requestedPrice": "2107"
}
],
"comment": "Please expedite the processing of this quote.",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
}

Error Responses

Status CodeDescription
400 Bad RequestInvalid request format or missing data.
401 UnauthorizedInvalid or missing access token.
403 ForbiddenAccess denied.
500 Internal Server ErrorServer encountered an error.

Notes

  • Ensure that the provided company and customer IDs are accurate and correspond to existing entities.
  • Include all required fields in the request body to avoid validation errors.
  • A valid access token is required for authentication to successfully create the quote.