Validation Errors
32 min
validation errors the nue cpq quote api returns structured error and warning responses when a request fails validation or contains conditions that merit attention understanding these codes helps you build robust integrations that handle edge cases gracefully error response format a failed request returns an http error status and a body of this shape { "status" 400, "error" "failed to create quote", "message" "the field 'accountid' is required ", "errordetails" \[ { "errorcode" "quote accountid required", "message" "the field 'accountid' is required " } ] } field type description status integer the numeric http status code error string short category failed to create quote for pricing and business rule failures; bad request for basic request validation message string human readable description for a single failure this matches the first entry in errordetails errordetails array one entry per failure, each with errorcode and message absent on bad request responses basic request validation failures a missing name or pricebookid , or two mutually exclusive discount fields on one product return "error" "bad request" with no errordetails array { "status" 400, "error" "bad request", "message" "pricebookid is required " } successful requests return the quote and its line items directly, with no status field and no warnings array { "quote" { }, "quotelineitems" \[ ] } detect success from the http status rather than from a field in the body authentication const myheaders = new headers(); myheaders append("nue api key", "your api key here"); myheaders append("content type", "application/json"); scenario 1 missing quote name the name field is required on every quote request const myheaders = new headers(); myheaders append("nue api key", "your api key here"); myheaders append("content type", "application/json"); const quotedata = { opportunityid "006xx000001abc123", subscriptionstartdate "2026 01 01", subscriptionenddate "2027 01 01", subscriptionterm 12, products \[ { productsku "nue on salesforce", 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('errors ', result errordetails ?? result message); // \[{ code "quote name required", message "quote name is required", field "name" }] }) catch(error => console log('error ', error)); 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", "subscriptionstartdate" "2026 01 01", "subscriptionenddate" "2027 01 01", "subscriptionterm" 12, "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10 } ] }' error code quote name required scenario 2 missing opportunity id the opportunityid field is required to associate the quote with a sales opportunity returns http 400 const quotedata = { name "missing opportunity quote", subscriptionstartdate "2026 01 01", subscriptionenddate "2027 01 01", subscriptionterm 12, products \[ { productsku "nue on salesforce", 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('errors ', result errordetails ?? result message); // \[{ code "quote opportunityid required", message "opportunity id is required" }] }) catch(error => console log('error ', error)); curl x post 'https //api nue io/cpq/quotes\ preview' \\ h 'nue api key your api key here' \\ h 'content type application/json' \\ d '{ "name" "missing opportunity quote", "subscriptionstartdate" "2026 01 01", "subscriptionenddate" "2027 01 01", "subscriptionterm" 12, "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10 } ] }' error code quote opportunityid required scenario 3 negative or zero subscription term the subscriptionterm must be a positive number const quotedata = { opportunityid "006xx000001abc123", name "negative term quote", subscriptionstartdate "2026 01 01", subscriptionterm 6, products \[ { productsku "nue on salesforce", 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('errors ', result errordetails ?? result message); // \[{ code "quote subscriptionterm invalid", message "subscription term must be a positive number" }] }) catch(error => console log('error ', error)); 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" "negative term quote", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 6, "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10 } ] }' error code quote subscriptionterm invalid scenario 4 empty or null products list the products array must contain at least one product const quotedata = { opportunityid "006xx000001abc123", name "empty products quote", subscriptionstartdate "2026 01 01", subscriptionterm 12, products \[] }; fetch('https //api nue io/cpq/quotes\ preview', { method 'post', headers myheaders, body json stringify(quotedata) }) then(response => response json()) then(result => { console log('errors ', result errordetails ?? result message); // \[{ code "missing parameter", message "at least one product is required" }] }) catch(error => console log('error ', error)); 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" "empty products quote", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "products" \[] }' error code missing parameter scenario 5 nonexistent sku if the provided sku does not match any product in the catalog, the api returns an error const quotedata = { opportunityid "006xx000001abc123", name "bad sku quote", subscriptionstartdate "2026 01 01", subscriptionterm 12, products \[ { productsku "nonexistent sku", 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('errors ', result errordetails ?? result message); // \[{ code "invalid input", message "product not found with sku nonexistent sku" }] }) catch(error => console log('error ', error)); 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" "bad sku quote", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "products" \[ { "productsku" "nonexistent sku", "uom" "user/month", "quantity" 10 } ] }' error code invalid input scenario 6 wrong uom each product has a defined set of valid units of measure using an invalid uom triggers an error 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" "wrong uom quote", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "products" \[ { "productsku" "nue on salesforce", "uom" "gb/month", "quantity" 10 } ] }' error code pricebook entry mismatch no price book entry found for product nue on salesforce with uom gb/month scenario 7 mix of valid and invalid products (partial failure) when one product in the products array is invalid, the entire quote request fails there is no partial success const quotedata = { opportunityid "006xx000001abc123", name "mixed valid/invalid products", subscriptionstartdate "2026 01 01", subscriptionterm 12, products \[ { productsku "nue on salesforce", uom "user/month", quantity 10 }, { productsku "nonexistent sku", uom "user/month", quantity 5 } ] }; fetch('https //api nue io/cpq/quotes\ preview', { method 'post', headers myheaders, body json stringify(quotedata) }) then(async response => { const result = await response json(); // the entire request fails even the valid product is not priced console log(response status); // 400 console log(result errordetails ?? result message); }) catch(error => console log('error ', error)); 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" "mixed valid/invalid products", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10 }, { "productsku" "nonexistent sku", "uom" "user/month", "quantity" 5 } ] }' error code invalid input the error identifies the invalid product fix all product issues and resubmit the entire request scenario 8 invalid billing period the billingperiod field only accepts specific values monthly , quarterly , semi annually , annually 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" "invalid billing period", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "billingperiod" "weekly", "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10 } ] }' error code product billingperiod invalid valid values are monthly , quarterly , semi annually , annually scenario 9 invalid billing timing the billingtiming field only accepts "in advance" or "in arrears" 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" "invalid billing timing", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "billingtiming" "on delivery", "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10 } ] }' error code product billingtiming invalid valid values are in advance , in arrears scenario 10 invalid add on product if a product specified as an add on is not a valid option for the parent bundle, the api returns an error const quotedata = { opportunityid "006xx000001abc123", name "invalid add on", subscriptionstartdate "2026 01 01", subscriptionterm 12, products \[ { productsku "enterprise bundle", uom "license/month", quantity 10, addons \[ { productsku "unrelated product", uom "unit/month", quantity 1 } ] } ] }; fetch('https //api nue io/cpq/quotes\ preview', { method 'post', headers myheaders, body json stringify(quotedata) }) then(response => response json()) then(result => { console log('errors ', result errordetails ?? result message); // \[{ code "invalid addon product", message "product unrelated product is not a valid option for bundle enterprise bundle" }] }) catch(error => console log('error ', error)); 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" "invalid add on", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "products" \[ { "productsku" "enterprise bundle", "uom" "license/month", "quantity" 10, "addons" \[ { "productsku" "unrelated product", "uom" "unit/month", "quantity" 1 } ] } ] }' error code invalid addon product scenario 11 both discount percentage and amount on same product discount , discountamount and netsalesprice are mutually exclusive on a product entry supplying more than one fails the request with 400 ; the percentage does not silently win const quotedata = { opportunityid "006xx000001abc123", name "dual discount product", subscriptionstartdate "2026 01 01", subscriptionterm 12, products \[ { productsku "nue on salesforce", uom "user/month", quantity 10, discount 10, discountamount 500 } ] }; fetch('https //api nue io/cpq/quotes\ preview', { method 'post', headers myheaders, body json stringify(quotedata) }) then(async response => { const result = await response json(); console log(response status); // 400 console log(result message); // "product at index 0 validation failed only one of \[discount, discountamount, netsalesprice] should be set" }) catch(error => console log('error ', error)); 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" "dual discount product", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10, "discount" 10, "discountamount" 500 } ] }' response { "status" 400, "error" "bad request", "message" "product at index 0 validation failed only one of \[discount, discountamount, netsalesprice] should be set" } send exactly one of the three on any given product entry note that a header level discount and discountamount on the quote root are both accepted there the percentage wins and the amount is recalculated from it scenario 12 currency mismatch when currencyisocode is set but a product does not have a pbe in that currency, the request fails 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" "currency mismatch", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "currencyisocode" "gbp", "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10 } ] }' error code pricebook entry mismatch no pbe found for product nue on salesforce with currency gbp scenario 13 duplicate price tag the same tag listed more than once on a product is not deduplicated and no warning is returned each entry is evaluated, so a repeated discount tag compounds send each tag once const quotedata = { opportunityid "006xx000001abc123", name "duplicate price tag", subscriptionstartdate "2026 01 01", subscriptionterm 12, products \[ { productsku "nue on salesforce", uom "user/month", quantity 10, pricetags \[ { code "volume discount" }, { code "volume discount" } ] } ] }; fetch('https //api nue io/cpq/quotes\ preview', { method 'post', headers myheaders, body json stringify(quotedata) }) then(response => response json()) then(result => { const line = result quotelineitems\[0]; // both entries are evaluated and the discount compounds // a 20% tag listed twice on a $12,000 line yields 36% (1 0 8 x 0 8), not 20% console log(line pricetags length); // 2 both echoed, not deduplicated console log(line systemdiscount); // 36 console log(line systemdiscountamount); // 4320 }) catch(error => console log('error ', error)); 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" "duplicate price tag", "subscriptionstartdate" "2026 01 01", "subscriptionterm" 12, "products" \[ { "productsku" "nue on salesforce", "uom" "user/month", "quantity" 10, "pricetags" \[ { "code" "volume discount" }, { "code" "volume discount" } ] } ] }' warning code duplicate price tag the tag is applied only once always ensure each price tag is specified only once per product error code reference error code http status description missing parameter 400 a required parameter is missing from the request quote name required 400 the name field is missing or empty quote opportunityid required 400 the opportunityid field is missing or empty quote subscriptionterm invalid 400 the subscriptionterm is zero, negative, or not a number product sku or name required 400 a product entry has neither productsku nor productname product quantity invalid 400 the quantity is zero, negative, or not a number product billingperiod invalid 400 the billingperiod value is not one of the valid options product billingtiming invalid 400 the billingtiming value is not one of the valid options product renewalterm invalid 400 the renewalterm is zero, negative, or not a number product subscriptionterm invalid 400 a per product subscriptionterm override is invalid invalid input 400 general invalid input (e g , nonexistent sku, malformed request) invalid addon product 400 the specified add on is not a valid option for the parent bundle pricebook entry mismatch 400 no pbe found for the given sku + uom + currency + pricing attributes business logic error 400 a business rule was violated (e g , conflicting configurations) warnings the quote endpoints do not return a warnings array the response body contains only quote and quotelineitems conditions that the pricing engine treats as non fatal are therefore not surfaced to api callers, so you cannot detect them from the response where a condition matters enough to act on, it is returned as a 400 error instead (see the scenarios above) inspect the returned line items to confirm what the engine actually applied for example read discount , discountamount , netsalesprice and pricetags on each line rather than relying on a warning to tell you best practices for error handling check the http status there is no success/failure field in the response body inspect errordetails each entry contains an errorcode and a message ; fall back to the top level message when errordetails is absent verify what was applied read the pricing fields on the returned line items, since non fatal conditions are not reported log error codes use the machine readable code for programmatic error handling, not the message use preview mode first validate quote configurations in preview before committing handle all products a single invalid product fails the entire request; validate all products before submitting handle 429 responses implement exponential backoff retry logic for rate limited requests