Convert Quote to Order
This POST API places an order from an approved quote. The order takes the quote's customer, company and line items (at the quoted company price, or the quote price when no company price is set), so you only supply the order details the quote does not carry, such as addresses and statuses.
On success the quote moves to completed and is linked to the new order. A quote can be converted only once.
Endpoint Details
- URL:
/api/quote/{quote_id}/order - Method:
POST - Authentication: Bearer Token (required)
- Required Scopes:
READ_WRITE_QUOTEandREAD_WRITE_ORDER
Path Parameters
| Parameter | Type | Description |
|---|---|---|
quote_id | string | The unique identifier of the quote to convert. |
Authentication
You must provide a valid accessToken in the request headers. The token's app must have both the READ_WRITE_QUOTE and READ_WRITE_ORDER scopes.
Authentication Headers
| Header | Type | Description |
|---|---|---|
Content-Type | string | Must be set to application/json. |
accessToken | string | A valid access token is required. |
Request Body
Do not send customer or lineItems; they are taken from the quote.
| Field | Type | Requirements/Notes |
|---|---|---|
billingAddress | joiId | Identifier of an existing billing address of the customer. |
newBillingAddress | object | A new billing address. Defined in New Billing Address. |
shippingAddressId | joiId | Identifier of an existing shipping address of the customer. |
newShippingAddress | object | A new shipping address. Defined in New Shipping Address. |
paymentStatus | enum | Defaults to "unpaid". Valid values: "unpaid", "authorized", "declined", "partially paid", "paid", "partially refunded", "refunded". |
orderStatus | enum | Defaults to "pending". Valid values: "fulfilled", "pending", "processing", "partially fulfilled", "restocked", "cancelled". |
paymentTerm | joiId | Id of a payment term assigned to the quote's company. |
shippingCost | number | Cost of shipping, must be positive or zero. |
taxAmount | number | Total tax amount for the order. |
shippingLabel | string | Label for the shipping, allows empty or null. |
notes | string | Notes for the order. |
metaFields | array of objects | Collection of metaField objects stored on the order. |
Either billingAddress or newBillingAddress, and either shippingAddressId or newShippingAddress, must be present.
Sample Request Body
{
"billingAddress": "63356b3b3a6353a69043680b",
"shippingAddressId": "63356b3b3a6353a69043680c",
"paymentStatus": "unpaid",
"orderStatus": "pending",
"shippingCost": 12.5,
"taxAmount": 4.2,
"shippingLabel": "UPS Ground",
"notes": "Deliver to the loading dock."
}
Response
Success Response
| Status Code | Description |
|---|---|
| 200 OK | The quote was converted and the order 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 | The newly created order. Defined in Order Object. |
The order carries a quoteId meta field holding the quote's number, so you can trace it back to the quote.
Sample Response Body
{
"success": true,
"message": "Quote converted to order successfully",
"data": {
"id": "6745f1c2a9d3e81b2c4f7a10",
"entityId": "1088",
"customer": "66d07121db294e0b70180bf6",
"company": "65ba028af764f931f1c7c18b",
"orderStatus": "pending",
"paymentStatus": "unpaid",
"metaFields": [
{
"code": "quoteId",
"label": "quoteId",
"value": 1042,
"valueType": "text",
"displayStorefront": true
}
]
//...
}
}
Error Responses
| Status Code | Description |
|---|---|
| 400 Bad Request | Invalid request body, or the quote cannot be converted (see Conversion Rules). The message field names the reason. |
| 401 Unauthorized | Invalid or missing access token. |
| 403 Forbidden | The token does not have both the READ_WRITE_QUOTE and READ_WRITE_ORDER scopes. |
| 404 Not Found | Quote not found. |
| 500 Internal Server Error | Server encountered an error. |
Conversion Rules
The request fails with 400 and one of these messages when the quote cannot be converted:
| Message | Cause |
|---|---|
Quote not found | quote_id is not a valid identifier. |
Quote not approved | The quote's status is not approved. |
Quote is expired | The quote's expiry date has passed. |
Quote is already converted to an order | The quote is already linked to an order. |
Quote is already being converted to an order | Another request converted the quote at the same time. |
Grouped products cannot be ordered directly | The quote contains a grouped product. |
Errors from order placement, such as Customer not have create order permission or Shipping Address not exists, are returned with 400 as well. When order placement fails, the quote stays approved and can be converted again.
Notes
- Only an
approved, unexpired quote can be converted. - Line item prices come from the quote and cannot be overridden in the request.
- For a B2B customer, the order is placed for the quote's company.