Create an Email Template API
On this page
This API is used to create an Email Template. Specifying an Id on the URI will instruct FusionAuth to use that Id when creating the Email Template. Otherwise, FusionAuth will generate an Id for the Email Template.
Request#
OpenAPI Spec
OpenAPI Spec
Path Parameters#
emailTemplateIdThe Id to use for the new Email Template. If not specified a secure random UUID will be generated.
Request Body#
emailTemplate.defaultFromName The default From Name used when sending emails. If not provided, and a localized value cannot be determined, the default value for the tenant will be used. This is the display name part of the email address ( i.e. Jared Dunn jared@piedpiper.com).
emailTemplate.defaultHtmlTemplate The default HTML Email Template.
emailTemplate.defaultSubject The default Subject used when sending emails.
emailTemplate.defaultTextTemplate The default Text Email Template.
emailTemplate.fromEmail The email address that this email will be sent from. If not provided, the default value for the tenant will be used. This is the address part email address (i.e. Jared Dunn jared@piedpiper.com).
emailTemplate.localizedFromNames The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user's list of preferred languages.
emailTemplate.localizedHtmlTemplates The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user's list of preferred languages.
emailTemplate.localizedSubjects The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user's list of preferred languages.
emailTemplate.localizedTextTemplates The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user's list of preferred languages.
emailTemplate.name A descriptive name for the email template (i.e. "April 2016 Coupon Email")
{
"emailTemplate": {
"defaultFromName": "Administrator",
"defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To FusionAuth!</p>",
"defaultSubject": "Hello World",
"defaultTextTemplate": "Hello ${user.username},\nWelcome To FusionAuth!",
"fromEmail": "email@example.com",
"localizedFromNames": {
"de": "Verwalter",
"fr": "Administrateur"
},
"localizedHtmlTemplates": {
"de": "<p>Hallo ${user.username}</p><p>Willkommen auf der FusionAuth!<p>",
"fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à FusionAuth!<p>"
},
"localizedSubjects": {
"de": "Hallo Welt",
"fr": "Bonjour le monde"
},
"localizedTextTemplates": {
"de": "Hallo ${user.username},\nWillkommen auf der FusionAuth!",
"fr": "Bonjour ${user.username},\nBienvenue à FusionAuth!"
},
"name": "Hello World"
}
}Response#
The response for this API contains the information for the Email Template that was created.
Response Codes| Code | Description |
|---|---|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
Response Body#
emailTemplate.defaultFromName The default From Name used when sending emails. If not provided, and a localized value cannot be determined, the default value for the tenant will be used. This is the display name part of the email address ( i.e. Jared Dunn jared@piedpiper.com).
emailTemplate.defaultHtmlTemplate The default HTML Email Template.
emailTemplate.defaultSubject The default Subject used when sending emails.
emailTemplate.defaultTextTemplate The default Text Email Template.
emailTemplate.fromEmail The email address that this email will be sent from. If not provided, the default value for the tenant will be used. This is the address part email address (i.e. Jared Dunn jared@piedpiper.com).
emailTemplate.id The Id of Email Template.
emailTemplate.insertInstant The instant when the Email Template was created.
emailTemplate.lastUpdateInstant The instant when the Email Template was last updated.
emailTemplate.localizedFromNames The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user's list of preferred languages.
emailTemplate.localizedHtmlTemplates The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user's list of preferred languages.
emailTemplate.localizedSubjects The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user's list of preferred languages.
emailTemplate.localizedTextTemplates The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user's list of preferred languages.
emailTemplate.name A descriptive name for the email template (i.e. "April 2016 Coupon Email").
{
"emailTemplate": {
"defaultFromName": "Administrator",
"defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To FusionAuth!</p>",
"defaultSubject": "Hello World",
"defaultTextTemplate": "Hello ${user.username},\nWelcome To FusionAuth!",
"fromEmail": "email@example.com",
"id": "00000000-0000-0000-0000-0000000000ab",
"insertInstant": 1572469040579,
"lastUpdateInstant": 1572477740579,
"localizedFromNames": {
"de": "Verwalter",
"fr": "Administrateur"
},
"localizedHtmlTemplates": {
"de": "<p>Hallo ${user.username}</p><p>Willkommen auf der FusionAuth!<p>",
"fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à FusionAuth!<p>"
},
"localizedSubjects": {
"de": "Hallo Welt",
"fr": "Bonjour le monde"
},
"localizedTextTemplates": {
"de": "Hallo ${user.username},\nWillkommen auf der FusionAuth!",
"fr": "Bonjour ${user.username},\nBienvenue à FusionAuth!"
},
"name": "Hello World"
}
}Related
Learn about the APIs for creating, retrieving, updating and deleting email templates as well as sending emails to users.
API documentation for the FusionAuth Preview an Email Template API.
API documentation for the FusionAuth Retrieve an Email Template API.
API documentation for the FusionAuth Search for Email Templates API.