Create Quote Overview
17 min
create quote overview the nue cpq quote api provides rest endpoints for programmatically creating fully priced quotes with the same pricing fidelity as the nue ui use the cpq rest api when you need to build quotes outside of the nue application for example, from a custom storefront, a partner portal, an ai agent, or any backend integration that requires real time pricing if you are working with post quote lifecycle operations such as order activation, subscription management, or asset tracking, use the lifecycle manager api / /lifecycle%20manager/orders/orders%20overview\ mdx instead the cpq rest api is focused on quote creation and pricing endpoints endpoint method description /cpq/quotes post create and persist a quote (commit mode) /cpq/quotes\ preview post preview a quote without persisting (dry run mode) /cpq/quotes/{quoteid} get retrieve a quote's json representation how it works when you submit a create quote request, the pricing engine performs the following steps product resolution finds products by sku or name, resolves the correct price book entry based on uom, currency, and pricing attributes bundle expansion automatically includes bundled items, auto populates required add ons, resolves dynamic product options pricing engine execution calculates the full pricing formula chain listprice x quantity x term = listtotal , then applies system discounts and discretionary discounts to arrive at the final total price discount propagation applies header level discounts to all undiscounted lines, propagates parent level discounts to children, respects explicit overrides price tag evaluation evaluates tiered, volume, and ramp price/discount tags; applies auto attached tags from product configuration validation enforces business rules and returns structured error messages or warnings key concepts preview vs commit the cpq api supports two modes with identical request bodies mode endpoint persists to database quote id in response preview (dry run) post /cpq/quotes\ preview no null commit post /cpq/quotes yes returns a uuid preview mode runs the full pricing engine but writes nothing to the database use it for pricing previews, what if scenarios, and validation commit mode runs the same engine and persists the result see preview vs commit docid 0jq3sd3mi6ejhjc69ovik for detailed examples product identification products are identified by sku and unit of measure (uom) the sku resolves the product, and the uom resolves the specific price book entry that determines the list price sku + uom (recommended) { "productsku" "nue platform", "uom" "user/month" } name + uom { "productname" "nue platform", "uom" "user/month" } price book entry id { "pricebookentryid" "pbe 001" } when both productsku and productname are provided, the sku is used for product resolution pricing formula the pricing engine applies the following formula for recurring products listtotal = listprice x quantity x term subtotal = listtotal systemdiscount total = subtotal discretionarydiscount one time products use listtotal = listprice x quantity (no term multiplier) prerequisites before creating quotes, ensure you have a valid nue api key with quote creation permissions an opportunity id to associate with the quote products published to your price book with price book entries knowledge of product skus and their units of measure (uom) authentication all cpq operations require authentication using your nue api key in the nue api key header const myheaders = new headers(); myheaders append("nue api key", "your api key here"); myheaders append("content type", "application/json"); minimal example preview a quote curl x post 'https //api nue io/cpq/quotes\ preview' \\ h 'nue api key your api key here' \\ h 'content type application/json' \\ d '{ "opportunityid" "006xx000001abc123", "name" "q1 2026 platform license", "subscriptionstartdate" "2026 01 01", "subscriptionenddate" "2027 01 01", "subscriptiontermdimension" "month", "subscriptionterm" 12, "products" \[ { "productsku" "nue platform", "uom" "user/month", "quantity" 10 } ] }' const myheaders = new headers(); myheaders append("nue api key", "your api key here"); myheaders append("content type", "application/json"); const quotedata = { opportunityid "006xx000001abc123", name "q1 2026 platform license", subscriptionstartdate "2026 01 01", subscriptionenddate "2027 01 01", subscriptiontermdimension "month", subscriptionterm 12, products \[ { productsku "nue platform", uom "user/month", quantity 10 } ] }; fetch('https //api nue io/cpq/quotes\ preview', { method 'post', headers myheaders, body json stringify(quotedata) }) then(response => response json()) then(result => { console log('quote preview ', result); console log(`total amount $${result quote totalamount}`); console log(`line items ${result quotelineitems length}`); // the quote object has no id in preview mode }) catch(error => console log('error ', error)); minimal example commit a quote to persist the quote, use the /cpq/quotes endpoint (without \ preview ) the request body is identical curl x post 'https //api nue io/cpq/quotes' \\ h 'nue api key your api key here' \\ h 'content type application/json' \\ d '{ "opportunityid" "006xx000001abc123", "name" "q1 2026 platform license", "subscriptionstartdate" "2026 01 01", "subscriptionenddate" "2027 01 01", "subscriptiontermdimension" "month", "subscriptionterm" 12, "products" \[ { "productsku" "nue platform", "uom" "user/month", "quantity" 10 } ] }' fetch('https //api nue io/cpq/quotes', { method 'post', headers myheaders, body json stringify(quotedata) }) then(response => response json()) then(result => { console log(`quote id ${result quote id}`); // present quote is persisted console log(`total amount $${result quote totalamount}`); }) catch(error => console log('error ', error)); request structure the create quote request body has three main sections quote header fields field type required description opportunityid string yes the opportunity id to associate with the quote name string yes the quote name subscriptionstartdate date yes start date (yyyy mm dd) subscriptionenddate date no end date; calculated from term if not provided subscriptionterm number yes term length (e g , 12 for 12 months) subscriptiontermdimension string no "month" (default) or "year" pricebookid string no price book id; uses system default if omitted discount number no header level discount percentage (0 100) discountamount number no header level discount as fixed amount billingperiod string no "monthly" , "quarterly" , "semi annually" , "annually" billingtiming string no "in advance" or "in arrears" autorenew boolean no auto renew setting for all products currencyisocode string no iso currency code for multi currency orgs pricetags array no quote level price/discount tags product input fields field type required description productsku string yes product sku (either sku or name required) productname string yes product name (alternative to sku) uom string conditional unit of measure; required if pricebookentryid is not provided quantity number no product quantity (defaults vary by product) startdate date no product start date; defaults to quote start date enddate date no product end date subscriptionterm number no per product term override discount number no line level discount percentage (0 100) discountamount number no line level discount amount billingperiod string no per product billing period override billingtiming string no per product billing timing override autorenew boolean no per product auto renew override evergreen boolean no whether the product is evergreen renewalterm number no renewal term override pricetags array no line level price/discount tags addons array no add on products for bundles (recursive productinput) custompricingattributes array no custom attributes for multi attribute pbe resolution price tag input field type required description code string one of code/id the price tag code id string one of code/id the price tag id response structure the quote and its line items are returned at the top level of the response body { "quote" { }, "quotelineitems" \[ ] } quote the quote header object with all calculated pricing fields quotelineitems array of root line items; bundle children are nested in childrenlineitems on their parent line, not flattened into this array in preview mode the quote object has no id , and each line item carries a temporary id of the form temp \<uuid> in commit mode quote id holds the persisted quote id and line items carry their real ids on failure, the response is an http error status with this body { "status" 400, "error" "failed to create quote", "message" "the field 'accountid' is required ", "errordetails" \[ { "errorcode" "quote accountid required", "message" "the field 'accountid' is required " } ] } here status is the numeric http status and the per error list is errordetails basic request validation failures, such as a missing name or pricebookid , return "error" "bad request" with no errordetails array guide articles article description preview vs commit docid 0jq3sd3mi6ejhjc69ovik understand the difference between dry run and commit modes standalone products docid\ iupfrldiwgoehemeyadpb create quotes with simple standalone products bundles docid\ fri8qggg2m1jvpi qlnvi work with bundle products and add ons discounts docid\ y9awhgt5iyiblymwve6nx apply header, parent, and line level discounts quantity tier attributes docid\ plcj0tpent2lihn0h6qgj configure quantity based pricing tiers