# Templates
Reading – More information on Templates is available
- API Basics Templates article.
- Twig's official documentation (opens new window).
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}
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
Like other files, your templates must be Base64 encoded.
PGh0bWw+Cgk8Ym9keT4KCQk8aDE+CgkJCVdlbGNvbWUKCQk8L2gxPgoJCTxwPgoJCQlQbGVhc2Ug
Y2xpY2sgPGEgaHJlZj0ie3sgY29uZmlybWF0aW9uX2xpbmsgfX0iPm9uIHRoaXMgbGluazwvYT4g
dG8gdmFsaWRhdGUgeW91ciBhY2NvdW50LgoJCTwvcD4KCTwvYm9keT4KPC9odG1sPg==
2
3
# TXT example
Like other files, your templates must be Base64 encoded.
V2VsY29tZQoKUGxlYXNlIGNsaWNrIHRoZSBmb2xsb3dpbmcgVVJMIHRvIHZhbGlkYXRlIHlvdXIg
YWNjb250Cgp7eyBjb25maXJtYXRpb25fbGluayB9fQ==
2
# 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.
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
# 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
# Errors
Check out possible errors here