Skip to main content
Version: 1.0.1

Save Email Template


Create or update an email notification template for a company. Templates are used to render the emails sent to a company's customers; sending the request again updates the existing template.

Endpoint​

PropertyValue
URLPOST /email-template/save/{companyId}
MethodPOST
AuthR-Auth: <company-jwt>
Content-Typeapplication/json
Base URLStage Environment https://api-stage.docnova.ai/
Production Environment https://api.docnova.ai/

Example Request​

curl --location '{{baseUrl}}/email-template/save/{{companyId}}' \
--header 'Content-Type: application/json' \
--header 'R-Auth: {{companyJwt}}' \
--data-raw '{
"name": "template name",
"language": "EN",
"bodyTemplate": "<p>Hello {{name}},</p><p style=\"margin-top: 40px\">You have received a new invoice via {{portalName}} from {{companyName}}.</p><p style=\"margin-top: 20px\"><strong>Invoice Number: </strong><span>{{extra1}}</span></p><p style=\"margin-top: 30px\">Please find the attached PDF document that contains invoice details. If you have any questions regarding this invoice, please contact {{companyName}} directly.</p><p style=\"margin-top: 40px\">Best regards,</p><p>Docnova Team</p>",
"subjectTemplate": "template subject"
}'

Path parameters​

ParameterTypeRequiredDescription
companyIdUUIDYesCompany UUID the template belongs to

Request body​

{
"name": "template name",
"language": "EN",
"bodyTemplate": "<p>Hello {{name}},</p><p style=\"margin-top: 40px\">You have received a new invoice via {{portalName}} from {{companyName}}.</p><p style=\"margin-top: 20px\"><strong>Invoice Number: </strong><span>{{extra1}}</span></p><p style=\"margin-top: 30px\">Please find the attached PDF document that contains invoice details. If you have any questions regarding this invoice, please contact {{companyName}} directly.</p><p style=\"margin-top: 40px\">Best regards,</p><p>Docnova Team</p>",
"subjectTemplate": "template subject"
}

Request fields​

FieldTypeRequiredDescription
namestringYesTemplate name used to identify it in the Portal
languagestringYesLanguage code the template content is written in (e.g. EN)
subjectTemplatestringYesTemplate used to render the email subject line
bodyTemplatestringYesHTML template used to render the email body
note

bodyTemplate and subjectTemplate support placeholders such as {{name}}, {{portalName}}, {{companyName}} and {{extra1}}, which are replaced with the actual values when the email is sent.

Response​

"3fa85f64-5717-4562-b3fc-2c963f66afa6"

Response fields​

FieldTypeDescription
(body)string (UUID)Unique identifier (UUID) of the saved email template. The response is a plain UUID value, not a JSON object.

Response Codes​

CodeDescription
200OK — Email template saved. Example value: 3fa85f64-5717-4562-b3fc-2c963f66afa6
201Created
401Unauthorized — R-Auth header missing or invalid
403Forbidden — Company is not authorized for this operation
404Not Found