> For the complete documentation index, see [llms.txt](https://fusionauth.io/docs/llms.txt)

# Update an Email Template

API documentation for the FusionAuth Update an Email Template API.

# Update an Email Template

This API is used to update an existing Email Template.

You must specify all of the properties of the Email Template when calling this API with the `PUT` HTTP method. When used with `PUT`, this API doesn't merge the existing Email Template and your new data. It replaces the existing Email Template with your new data.

Utilize the `PATCH` HTTP method to send specific changes to merge into an existing Email Template.

## Request

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Update an Email Template by Id

PUT/api/email/template/{emailTemplateId}

OpenAPI Spec

PATCH/api/email/template/{emailTemplateId}

OpenAPI Spec

note

For backward compatibility, the `PATCH` method accepts the same media type (specified by a `Content-Type` of `application/json`) and body as the `PUT` request. You can also use the following media types for different behavior:

*   [JSON Patch/RFC 6902](https://www.rfc-editor.org/rfc/rfc6902): `application/json-patch+json`
*   [JSON Merge Patch/RFC 7396](https://www.rfc-editor.org/rfc/rfc7396): `merge-patch+json`

For details, see the [PATCH documentation](https://fusionauth.io/docs/apis.md#the-patch-http-method).

Using a media type of `application/json` merges the provided request parameters into the existing object. As a result, all parameters are optional with `PATCH`: only provide the values you want to change. To remove a value, provide a `null` value. Patching an `Array` appends all values in the new list to the old list.

### Request Parameters

`emailTemplateId`UUIDrequired

The Id of the Email Template to update.

#### Request Body

`emailTemplate.defaultFromName`optional

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](mailto:jared@piedpiper.com)).

`emailTemplate.defaultHtmlTemplate`required

The default HTML Email Template.

`emailTemplate.defaultSubject`required

The default Subject used when sending emails.

`emailTemplate.defaultTextTemplate`required

The default Text Email Template.

`emailTemplate.fromEmail`Stringoptional

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](mailto:jared@piedpiper.com)).

`emailTemplate.localizedFromNames`optional

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`optional

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`optional

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`optional

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`Stringrequired

A descriptive name for the email template (i.e. "April 2016 Coupon Email")

*Example Request JSON*

```json
{
  "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 new information for the Email Template that was updated.

*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](https://fusionauth.io/docs/apis/errors.md) 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](https://fusionauth.io/docs/apis/authentication.md). |
| 404 | The object you are trying to update 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.defaultFromName`String

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](mailto:jared@piedpiper.com)).

`emailTemplate.defaultHtmlTemplate`String

The default HTML Email Template.

`emailTemplate.defaultSubject`String

The default Subject used when sending emails.

`emailTemplate.defaultTextTemplate`String

The default Text Email Template.

`emailTemplate.fromEmail`String

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](mailto:jared@piedpiper.com)).

`emailTemplate.id`UUID

The Id of Email Template.

`emailTemplate.insertInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) when the Email Template was created.

`emailTemplate.lastUpdateInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) when the Email Template was last updated.

`emailTemplate.localizedFromNames`Map<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.localizedHtmlTemplates`Map<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.localizedSubjects`Map<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.localizedTextTemplates`Map<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.name`String

A descriptive name for the email template (i.e. "April 2016 Coupon Email").

*Example Response JSON for a Single Email Template*

```json
{
  "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"
  }
}
```