Generate Quote Document API

Creates and saves a CPQ quote document.

Required Editions
Available in: Salesforce CPQ Winter ’19 and later
Name

QuoteDocumentAPI.SaveProposal

“Proposal” refers to Salesforce CPQ’s Quote Document object.

Formats

JSON, Apex

HTTP Method

POST

Authentication

Authorization: Bearer token

NameTypeRequiredDefinition
NameStringNoThe document name
paperSizeStringNoValues are Default, Letter, Legal, A4. Defaults to “Default.”
outputFormatStringNoValues are PDF, Word. Defaults to “PDF.”
quoteIdIDYesThe quote’s ID
templateIdIDYesThe quote template’s ID
languageStringNoDefaults to “en_US.”
NameTypeDescription
jobIDIDApex queueable job ID

Example request body data.json file for generating and saving a quote document.

Example response body after creating the APEX job for creating the quote document.

If the Bearer token contains special characters, enclose the Authorization header in single quotes instead of double quotes.

Before saving the GenerateQuoteProposal example class, make sure that the CPQ model classes are added as individual APEX classes in your org.

Run the following code in anonymous Apex to get the Apex job ID for generating and saving the quote proposal.

  • Attachments marked Required are ignored when you’re using the API. In contrast, when you’re using the Preview and Generate document buttons, the attachments are automatically generated as part of the document.
  • An attachment in the Template section is always included regardless of whether it’s marked Required. This behavior is also observed when you’re using Preview and Generate document buttons.
  • Guest users can’t create quote documents in the Documents folder. See Salesforce Help and SOAP API Developer Guide for details.

See Also