Skip to main content

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:

FieldTypeRequiredDescription
titleStringYesTitle of the quote.
companyStringYesID of the company.
customerStringYesID of the customer.
productsArrayYesProducts to include in the quote. See below.
statusStringNopending, approved, rejected, completed, negotiated or expired. Default is pending.
commentStringNoFirst comment to add to the quote.
notesStringNoInternal notes for the quote.
metaFieldsArrayNoCustom field values. See below.

Product Object​

FieldTypeRequiredDescription
productStringYesID of the product.
variantStringNoID of the product variant.
quantityNumberYesQuantity to quote.
companyPriceNumberNoCompany price per unit. Must be 0 or more.
requestedPriceNumberNoPrice per unit requested by the customer.

MetaField Object​

FieldTypeRequiredDescription
codeStringYesCode of an existing metafield.
valueString, Number, Boolean or ArrayNoValue 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​

FieldTypeDescription
successBooleanWhether the request was successful.
messageStringResult message.
dataObjectThe 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.