Retrieve an Email Template
This API is used to retrieve one or all of the configured Email Templates. Specifying an Id on the URI will retrieve a single Email Template. Leaving off the Id will retrieve all of the Email Templates.
Request#
OpenAPI Spec
OpenAPI Spec
Request Parameters#
emailTemplateIdUUIDoptionalThe Id of the Email Template to retrieve.
Response#
The response for this API contains either a single Email Template or all of the Email Templates. When you call this API with an Id the response will contain just that Email Template. When you call this API without an Id the response will contain all of the Email Templates. Both response types are defined below along with an example JSON response.
Response Codes| Code | Description |
|---|---|
| 200 | The request was successful. The response will contain a JSON body. |
| 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. |
| 404 | The object you requested doesn't exist. The response will be empty. |
| 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.defaultFromNameStringThe 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.defaultHtmlTemplateStringThe default HTML Email Template.
emailTemplate.defaultSubjectStringThe default Subject used when sending emails.
emailTemplate.defaultTextTemplateStringThe default Text Email Template.
emailTemplate.fromEmailStringThe 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.idUUIDThe Id of Email Template.
emailTemplate.insertInstantLongThe instant when the Email Template was created.
emailTemplate.lastUpdateInstantLongThe instant when the Email Template was last updated.
emailTemplate.localizedFromNamesMap<Locale,String>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.localizedHtmlTemplatesMap<Locale,String>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.localizedSubjectsMap<Locale,String>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.localizedTextTemplatesMap<Locale,String>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.nameStringA descriptive name for the email template (i.e. "April 2016 Coupon Email").
Example Response JSON for a Single Email Template
{
"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"
}
}
Response Body#
emailTemplatesArrayThe list of all the Email Templates.
emailTemplates[x].defaultFromNameStringThe 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).
emailTemplates[x].defaultHtmlTemplateStringThe default HTML Email Template.
emailTemplates[x].defaultSubjectStringThe default Subject used when sending emails.
emailTemplates[x].defaultTextTemplateStringThe default Text Email Template.
emailTemplates[x].fromEmailStringThe 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).
emailTemplates[x].idUUIDThe Id of Email Template.
emailTemplates[x].insertInstantLongThe instant when the Email Template was created.
emailTemplates[x].lastUpdateInstantLongThe instant when the Email Template was last updated.
emailTemplates[x].localizedFromNamesMap<Locale,String>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.
emailTemplates[x].localizedHtmlTemplatesMap<Locale,String>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.
emailTemplates[x].localizedSubjectsMap<Locale,String>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.
emailTemplates[x].localizedTextTemplatesMap<Locale,String>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.
emailTemplates[x].nameStringA descriptive name for the email template (i.e. "April 2016 Coupon Email").
Example Response JSON for all the Email Templates
{
"emailTemplates": [
{
"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"
}
]
}