Create Quote
Creates a new quote for a customer and company. Product names, SKUs, images and prices are filled in from your catalog, and the quote is given a quote number and an expiry date based on your store's quote settings.
HTTP Request
- URL:
/quote/create - Method:
POST - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_QUOTE
Request Body
The request body must be JSON and contain the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
title | String | Yes | Title of the quote. |
company | String | Yes | ID of the company. |
customer | String | Yes | ID of the customer. |
products | Array | Yes | Products to include in the quote. See below. |
status | String | No | pending, approved, rejected, completed, negotiated or expired. Default is pending. |
comment | String | No | First comment to add to the quote. |
notes | String | No | Internal notes for the quote. |
metaFields | Array | No | Custom field values. See below. |
Product Object
| Field | Type | Required | Description |
|---|---|---|---|
product | String | Yes | ID of the product. |
variant | String | No | ID of the product variant. |
quantity | Number | Yes | Quantity to quote. |
companyPrice | Number | No | Company price per unit. Must be 0 or more. |
requestedPrice | Number | No | Price per unit requested by the customer. |
MetaField Object
| Field | Type | Required | Description |
|---|---|---|---|
code | String | Yes | Code of an existing metafield. |
value | String, Number, Boolean or Array | No | Value for the metafield. |
cURL Example
curl --location '<BASE_URL>/quote/create' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"title": "Q4 Restock Quote",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"products": [
{
"product": "65b88ef5045a7d009e79974b",
"quantity": 10,
"companyPrice": 119,
"requestedPrice": 110
},
{
"product": "66b4a01249e6ce3d41c428fa",
"variant": "66d5a286fcb786834cebb16a",
"quantity": 4
}
],
"comment": "Please confirm lead time.",
"notes": "Priority account"
}'
Response
- 200 OK: The quote was created successfully.
- 400 Bad Request: The access token is missing or invalid, does not have the required scope, or the request body is not valid (for example, the customer or company was not found).
Sample JSON Response
{
"success": true,
"message": "Quote created Successfully",
"data": {
"_id": "6720f3c1a8b4e21f9c3d5a10",
"quoteId": 1042,
"title": "Q4 Restock Quote",
"status": "pending",
"requestedCount": 0,
"company": "65ba028af764f931f1c7c18b",
"companyDetails": {
"companyId": "65ba028af764f931f1c7c18b",
"name": "Northwind Supplies",
"email": "purchasing@northwind.example",
"phoneNumber": "+1 312 555 0142"
},
"customer": "66d07121db294e0b70180bf6",
"customerDetails": {
"customerId": "66d07121db294e0b70180bf6",
"firstName": "Dana",
"lastName": "Whitfield",
"email": "dana.whitfield@northwind.example",
"phoneNumber": "+1 312 555 0187"
},
"products": [
{
"_id": "6720f3c1a8b4e21f9c3d5a11",
"product": "65b88ef5045a7d009e79974b",
"variant": null,
"name": "Cordless Drill 18V",
"sku": "CD-18V",
"productSku": "CD-18V",
"image": "https://cdn.example.com/products/cd-18v.webp",
"options": [],
"quantity": 10,
"price": 129,
"companyPrice": 119,
"requestedPrice": 110,
"extendedPrice": 1190,
"selectedCurrencyPrice": null
},
{
"_id": "6720f3c1a8b4e21f9c3d5a15",
"product": "66b4a01249e6ce3d41c428fa",
"variant": "66d5a286fcb786834cebb16a",
"name": "Safety Gloves",
"sku": "SG-L-BLK",
"productSku": "SG",
"image": "https://cdn.example.com/products/sg-l-blk.webp",
"options": [
{
"_id": "66d5a286fcb786834cebb16b",
"optionName": "Size",
"optionValueLabel": "Large",
"optionValue": "l"
}
],
"quantity": 4,
"price": 12.5,
"companyPrice": null,
"requestedPrice": null,
"extendedPrice": 50,
"selectedCurrencyPrice": null
}
],
"comments": [
{
"_id": "6720f3c1a8b4e21f9c3d5a13",
"name": "ERP Integration",
"comment": "Please confirm lead time.",
"isCustomer": false,
"customer": null,
"user": "66d07121db294e0b70180bf6",
"replies": [],
"createdAt": "2024-10-29T14:02:09.512Z",
"updatedAt": "2024-10-29T14:02:09.512Z"
}
],
"timeline": [
{
"_id": "6720f3c1a8b4e21f9c3d5a12",
"name": "ERP Integration",
"description": "ERP Integration created new quote",
"isCustomer": true,
"customer": "66d07121db294e0b70180bf6",
"user": null,
"createdAt": "2024-10-29T14:02:09.512Z",
"updatedAt": "2024-10-29T14:02:09.512Z"
}
],
"createdBy": {
"_id": "6720f3c1a8b4e21f9c3d5a14",
"id": "6650c2e9f1a3b84d2e7a9c01",
"name": "ERP Integration",
"type": "api"
},
"notes": "Priority account",
"metaFields": [],
"expiryDate": "2024-11-13T14:02:09.498Z",
"order": null,
"isCompleted": false,
"selectedCurrency": null,
"createdAt": "2024-10-29T14:02:09.512Z",
"updatedAt": "2024-10-29T14:02:09.512Z"
}
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the request was successful. |
message | String | Result message. |
data | Object | The new quote. _id is the quote ID. |
Quote Data
The quote fields are described in Get Single Quote.
Notes
- The quote expires after the number of days set in your store's quote settings (15 days by default).
- Products or variants that are not found in your catalog are skipped.