Skip to content

Render to document

Request

Render a file (text, html or pdf) from template and write it to a document descriptor.

It selects an appropriate Template Descriptor (matching subject, channel), and renders the active Template Version with the given context. Only the content matching the fmt query parameter is returned in the file.

The rendered template file is then associated with the given documentId. (i.e., this new content can be downloaded via that Document Descriptor.)

WARNING: if there is existing document content for that document it will be overwritten.

Security
oauth2(Required scopes: communicator:render) or bearerAuth or apiKeyHeader
Query
fmtstring

The desired output format.

Default:"html"
Enum:"text""html""pdf"
Bodyapplication/jsonrequired

Template selectors, context and the document ID.

caseIdstring

The unique identifier of the Case. Can be Peach or lender's external identifier. The case attributes will be used as dynamic fields in the template.

channelstringrequired

Templates with the same subject can have multiple versions per channel. For example: paymentFailed can have email and text message (aka SMS) versions.

Enum:"email""text""mail""gui""document"
contextobject or autopayAmountChanged (object) or autopayCanceledBySystem (object) or autopayEnabled (object) or autopayEnableReminder (object) or autopayPaymentCanceled (object) or autopayPaymentMethodUpdated (object) or autopayPaymentReminder (object) or autopayPaymentRescheduled (object) or cardExpiresReminder (object) or ceaseCommunicationAcknowledgement (object) or ceaseCommunicationRefuseToPay (object) or confirmationCode (object) or contactTakeover (object) or customX (object) or debtValidationNotice (object) or debtValidationNoticeArizona (object) or debtValidationNoticeAutomatic (object) or debtValidationNoticeNYCYonkers (object) or debtValidationNoticePuertoRico (object) or deceasedConfirmationOfPayoff (object) or deceasedNoticeToRepresentative (object) or deceasedNotificationUponDeath (object) or disputeOfDebtSubmitDocumentation (object) or disputeOfDebtConfirmed (object) or disputeOfDebtSubmitDocumentationReminder (object) or disputeOfDebtUnableToConfirm (object) or disputeOfDebtUnableToResolve (object) or electronicConsentOptOut (object) or failedSettlementInvestor (object) or freeFormBranded (object) or futurepayCanceledf (object) or futurepayPaymentDueReminder (object) or identityTheftIncompleteDocumentation (object) or identityTheftSubmitDocumentationFirstReminder (object) or identityTheftSubmitDocumentation (object) or identityTheftSubmitDocumentationSecondReminder (object) or identityTheftValidated (object) or identityTheftNotValidated (object) or autopayAgreement (object) or drawFundsDisclosure (object)(ContextObject)
Any of:

The data used to render the template. Provided in JSON format, it must be a mapping of context variables to values.

The context variables of borrower, loan, case and statement do not need to be provided since the system will automatically add these objects to context assuming you provide personId, loanId, caseId and statementId to the endpoint.

For example if your provided the context...

{
  "dateSigned": "Aug 27, 2021"
  "lenderName": "Peachy Lender"
  "paymentMethod": "bankAccount"
  "paymentMethodLastFour": "1110"
  "supportEmail": "support@peach.com"
  "supportPhone": "888-888-8888"
}

...then a template like Hello from {{lenderName}}! would render like Hello from Peachy Lender!

object
loanIdstring

The unique identifier of the Loan. Can be Peach or lender's external identifier. The loan attributes will be used as dynamic fields in the template.

overrideTemplateIdstring or null(OverrideTemplateId)

The template version ID (like TV-AAAA-BBBB) or template descriptor ID (like TD-AAAA-BBBB) to use.

If a template descriptor is given, then the current template descriptor's activeVersionId is used.

This should be used in special cases where you do not want to use the implicit template selected by the subject and channel fields.

Example:"TV-AAAA-BBBB"
personIdstringrequired

The unique identifier of the Borrower. Can be Peach or a lender's external identifier. The borrower attributes will be used as dynamic fields in the template.

subjectstring(InteractionSubject)required

The subject of the interaction. The subject identifies the category of the content in the message.

Most subjects have an associated implicit theme. e.g., loanOverdueFirstNotice has a theme of opsCollDebt. For these subjects it is not necessary to specify a theme.

Some subjects like freeForm and custom<N> do not have an implicit theme. When using these subjects you must specify a theme.

DEPRECATED: locStatementGenerated and locStatementRegenerated are deprecated. They will be automatically converted into statementGenerated and statementRegenerated respectively. You should switch to use those subjects directly.

DEPRECATED: failedSettlementPeach is deprecated. This was always a subject used by the Peach application internally, and will no longer be used. Attempts to set this subject will be rejected with a 400 error.

Enum:"annualPrivacyPolicyNotice""autopayAgreement""autopayAmountChanged""autopayCanceledBySystem""autopayEnabled""autopayEnableReminder""autopayPaymentCanceled""autopayPaymentMethodUpdated""autopayPaymentReminder""autopayPaymentRescheduled"
documentIdstringrequired

The unique identifier of the Document Descriptor. Can be Peach or lender's external identifier. The rendered content will create a file in HTML or text format and associate it with the documentId. To convert the rendered document to PDF please use another endpoint, convert_person_document, as an extra step.

statementIdstring

The unique identifier of the Statement. Can be Peach or lender's external identifier. The statement attributes will be used as dynamic fields in the template.

POST
/communicator/render-to-document
curl -i -X POST \
  'https://sandboxapi.peach.finance/api/communicator/render-to-document?fmt=text' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "caseId": "string",
    "channel": "email",
    "context": {},
    "loanId": "string",
    "overrideTemplateId": "TV-AAAA-BBBB",
    "personId": "string",
    "subject": "annualPrivacyPolicyNotice",
    "documentId": "string",
    "statementId": "string"
  }'

Responses

OK

Bodytext/plain
string(newStatus)
Response
string