Skip to content

Templates

books icon

Reading – More information on Templates is available

Currently, only the confirmation email can be templated.

Create your templates

We expect two formats, an HTML template and a TXT template.

The second one is used as a fallback for email clients that don't support HTML, and for screen readers. Although not mandatory, it is strongly recommended to also upload a TXT template.

To retrieve the list of available variables within the confirmation email template, you can use the following endpoints:

  • GET /customization/templates/email.user.onboarding_confirmation_{html|text}
  • GET /customization/templates/email.user.password_change{html|text}
Thumbs icon

Best practice – Keep the confirmation link variable

The confirmation_link variable must always be present. It is the URL a user is asked to visit to activate their account.

HTML example

twig
<html>
	<body>
		<h1>
			Welcome
		</h1>
		<p>
			Please click <a href="{{ confirmation_link }}">on this link</a> to validate your account.
		</p>
	</body>
</html>

Like other files, your templates must be Base64 encoded.

base64
PGh0bWw+Cgk8Ym9keT4KCQk8aDE+CgkJCVdlbGNvbWUKCQk8L2gxPgoJCTxwPgoJCQlQbGVhc2Ug
Y2xpY2sgPGEgaHJlZj0ie3sgY29uZmlybWF0aW9uX2xpbmsgfX0iPm9uIHRoaXMgbGluazwvYT4g
dG8gdmFsaWRhdGUgeW91ciBhY2NvdW50LgoJCTwvcD4KCTwvYm9keT4KPC9odG1sPg==

TXT example

twig
Welcome

Please click the following URL to validate your accont

{{ confirmation_link }}

Like other files, your templates must be Base64 encoded.

base64
V2VsY29tZQoKUGxlYXNlIGNsaWNrIHRoZSBmb2xsb3dpbmcgVVJMIHRvIHZhbGlkYXRlIHlvdXIg
YWNjb250Cgp7eyBjb25maXJtYXRpb25fbGluayB9fQ==

Upload your templates

Your templates must be uploaded to the PUT /customization/templates/email.user.onboarding_confirmation_{html|text} endpoint.

Example

Note that both HTML and TXT templates are uploaded at the same time.

bash
curl -X PUT {baseUrl}/customization/templates/email.user.onboarding_confirmation_{html|text}/template \
	-H 'Authorization: Bearer {accessToken}' \
	-H 'Content-Type: application/json' \
	-d '{
		"template": "{base64EncodedTemplate}"
	}'
Warning icon

Caution – Replacing a Template

  • Takes effect immediately.
  • Cannot be undone.

Retrieve your template

To retrieve the template you already uploaded, you can use the GET /customization/templates/email.user.onboarding_confirmation_{html|text} endpoint.

Example

bash
curl -X GET {baseUrl}/customization/templates/email.user.onboarding_confirmation_{html|text} \
	-H 'Authorization: Bearer {accessToken}' \
	-H 'Content-Type: application/json'

Testing your template

To test your template with dummy values you can use the GET /customization/templates/email.user.onboarding_confirmation_{html|text}/demo endpoint.

Example

bash
curl -X GET {baseUrl}/customization/templates/email.user.onboarding_confirmation_{html|text}/example \
	-H 'Authorization: Bearer {accessToken}' \
	-H 'Content-Type: application/json'

Errors

Check out possible errors here