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
| Header | Type | Description |
|---|---|---|
Content-Type | string | Must be set to application/json. |
accessToken | string | A 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:
| Field | Type | Description |
|---|---|---|
title | string | The title of the quote. |
company | string | The unique identifier of the company associated with the quote. |
customer | string | The unique identifier of the customer for whom the quote is created. |
status | string | The status of the quote (e.g., "pending", "approved", "rejected"). |
products | array | Array of objects detailing the products, including quantities and requested prices. |
comment | string | Additional comments or notes for the quote. |
Product Object (products[])
Each object in the products array should follow this structure:
| Field | Type | Description |
|---|---|---|
product | string | Unique identifier for the product. |
variant | string | Unique identifier for the product variant (optional). |
quantity | number | Quantity of the product or variant requested in the quote. |
requestedPrice | string | The 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 Code | Description |
|---|---|
| 200 OK | The request was successful, and the new quote was created. |
Success Response Body Structure
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the request was successful. |
message | string | Message indicating the result of the operation. |
data | object | Contains 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 Code | Description |
|---|---|
| 400 Bad Request | Invalid request format or missing data. |
| 401 Unauthorized | Invalid or missing access token. |
| 403 Forbidden | Access denied. |
| 500 Internal Server Error | Server encountered an error. |
Notes
- Ensure that the provided
companyandcustomerIDs 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.