Text templates
Learn how to manage template texts for invoice notes and customer-facing emails.
Learn how to manage template texts for invoice notes and customer-facing emails.
Entities that create invoices or other financial documents may want to use the same memo note or email message text for multiple documents. These texts can be stored in Monite as text templates and fetched on demand. Templates can include {variables} that serve as placeholders for various customer-specific and document-specific values.
Templates can be created for:
Each entity starts with a predefined set of templates and can also create additional templates.
Each entity starts with a predefined set of templates. To get all available templates, call GET /text_templates. You can optionally filter the results by type, document_type, and is_default. (More details on these fields are given below.)
Examples:
GET /text_templates?document_type=invoice - get all templates for Accounts Receivable invoices.GET /text_templates?is_default=true - get all default templates.GET /text_templates?type=email_header - get all templates for email subject lines.TextTemplate objectMonite stores text templates in this format:
The main fields in a TextTemplate object are:
name - the display name of a template.
document_type - the document type for which this template was created. Can be:
type - where this template is used:
memo field in receivables or the message field in purchase orders.template - the actual text of a template as a plain JSON-formatted string, such as “New invoice from Acme Inc”. Multiple lines can be separated by \n.
The text can include {variables} as placeholders for customer-specific, document-specific, and entity-specific values. For example, "Invoice {invoice_number} from {entity_name}".
For a list of supported variables, see Variables.
To create a new template, call POST /text_templates and specify the template name (display name), the document_type this template will be used for (for example, “quote”), the template type (email_header, email_body, or memo), and the template contents as a JSON-formatted string.
The response contains the id assigned to the created template. You can use this ID later to retrieve or update the template contents.
Each combination of document_type and type has its default template. The default template is indicated by the is_default field set to true.
Entities can use the default templates as-is, change them, assign other default templates, or create and use any number of custom templates.
What does “default” mean?
It just means “preferred template”. Note that this does not mean the default template is automatically used by Monite’s subsystems.
To mark a template as default, call POST /text_templates/{text_template_id}/make_default. This template will become the default one for its associated document_type and type.
Entities can modify the templates, including the default ones, at any time. To update a specific template, call PATCH /text_templates/{text_template_id}:
The type and document_type of existing templates cannot be changed. To change these fields, you’ll have to delete the existing template and create a new one instead.
Use DELETE /text_templates/{text_template_id} to delete an existing text template that an entity no longer needs:
Default templates cannot be deleted. Attempts to delete a default template will fail with a 409 error.