Create an email template

Creates an email template.

This operation supports creating the email template for all event types.

  • If you specify the eventCategory field, the email template is created based on a standard event. See Standard Event Categories for all standard event category codes.
  • If you specify the eventTypeName field, the email template is created based on the corresponding custom event or custom scheduled event. See Custom event triggers for more information about custom events, and Custom scheduled events for more information about custom scheduled events.
Request
header Parameters
Idempotency-Key
string <= 255 characters

Specify a unique idempotency key if you want to perform an idempotent POST or PATCH request. Do not use this header in other request types.

With this header specified, the Zuora server can identify subsequent retries of the same request using this value, which prevents the same operation from being performed multiple times by accident.

Accept-Encoding
string

Include the Accept-Encoding: gzip header to compress responses as a gzipped file. It can significantly reduce the bandwidth required for a response.

If specified, Zuora automatically compresses responses that contain over 1000 bytes of data, and the response contains a Content-Encoding header with the compression algorithm so that your client can decompress it.

Content-Encoding
string

Include the Content-Encoding: gzip header to compress a request. With this header specified, you should upload a gzipped file for the request payload instead of sending the JSON payload.

Authorization
required
string

The value is in the Bearer {token} format where {token} is a valid OAuth token generated by calling Create an OAuth token.

Zuora-Track-Id
string <= 64 characters

A custom identifier for tracing the API call. If you set a value for this header, Zuora returns the same value in the response headers. This header enables you to associate your system process identifiers with Zuora API calls, to assist with troubleshooting in the event of an issue.

The value of this field must use the US-ASCII character set and must not include any of the following characters: colon (:), semicolon (;), double quote ("), and quote (').

Zuora-Entity-Ids
string

An entity ID. If you have Zuora Multi-entity enabled and the OAuth token is valid for more than one entity, you must use this header to specify which entity to perform the operation in. If the OAuth token is only valid for a single entity, or you do not have Zuora Multi-entity enabled, you should not set this header.

Zuora-Org-Ids
string

Comma separated IDs. If you have Zuora Multi-Org enabled, you can use this header to specify which orgs to perform the operation in. If you do not have Zuora Multi-Org enabled, you should not set this header.

The IDs must be a sub-set of the user's accessible orgs. If you specify an org that the user does not have access to, the operation fails.

If the header is not set, the operation is performed in scope of the user's accessible orgs.

Request Body schema: application/json
required

The request body to create an email template.

active
boolean
Default: true

The status of the email template. The default value is true.

bccEmailAddress
string <email>

The email bcc address.

ccEmailAddress
string

The email CC address.

ccEmailType
string
Default: "SpecificEmails"

Email CC type.

  • When the base object for the event is associated with Account, ccEmailType can be any values in the enum list.
  • When the base object for the event is not associated with Account, ccEmailType must be TenantAdmin, RunOwner, or SpecificEmail.
Enum: "BillToContact" "SoldToContact" "SpecificEmails" "TenantAdmin" "BillToAndSoldToContacts" "RunOwner" "AllContacts" "InvoiceOwnerBillToContact" "InvoiceOwnerSoldToContact" "InvoiceOwnerBillToAndSoldToContacts" "InvoiceOwnerAllContacts"
description
string <= 255 characters

The description of the email template.

emailBody
required
string

The email body. You can add merge fields in the email body using angle brackets or double curly brackets. For more information, see Merge field syntax for email templates.

You can also embed HTML tags if isHtml is true.

object (emailHeader)

Container for custom email headers. Each custom email header consists of a header name and a header value.

emailSubject
required
string

The email subject. You can add merge fields in the email subject using angle brackets or double curly brackets. For more information, see Merge field syntax for email templates.

encodingType
string
Default: "UTF8"

The endcode type of the email body.

Enum: "UTF8" "Shift_JIS" "ISO_2022_JP" "EUC_JP" "X_SJIS_0213"
eventCategory
number

If you specify this field, the email template is created based on a standard event. See Standard Event Categories for all standard event category codes.

eventTypeName
string

The name of the custom event or custom scheduled event. If you specify this field, the email template is created based on the corresponding custom event or custom scheduled event.

eventTypeNamespace
string

The namespace of the eventTypeName field. The eventTypeName has the user.notification namespace by default.

Note that if the eventTypeName is a standard event type, you must specify the com.zuora.notification namespace; otherwise, you will get an error.

For example, if you want to create an email template on the OrderActionProcessed event, you must specify com.zuora.notification for this field.

fromEmailAddress
string

If fromEmailType is SpecificEmail, this field is required.

fromEmailType
required
string

The type of the email.

Enum: "TenantEmail" "RunOwner" "SpecificEmail"
fromName
string

The name of the email sender.

isHtml
boolean
Default: false

Indicates whether the style of email body is HTML. The default value is false.

name
required
string <= 255 characters

The name of the email template, a unique name in a tenant.

replyToEmailAddress
string

If replyToEmailType is SpecificEmail, this field is required.

replyToEmailType
string

Type of the replyTo email.

Enum: "TenantEmail" "RunOwner" "SpecificEmail"
toEmailAddress
string

If toEmailType is SpecificEmail, this field is required.

toEmailType
required
string

Email receive type.

  • When the base object for the event is associated with Account, toEmailType can be any values in the enum list.
  • When the base object for the event is not associated with Account, toEmailType must be TenantAdmin, RunOwner, or SpecificEmail.
Enum: "BillToContact" "SoldToContact" "SpecificEmails" "TenantAdmin" "BillToAndSoldToContacts" "RunOwner" "AllContacts" "InvoiceOwnerBillToContact" "InvoiceOwnerSoldToContact" "InvoiceOwnerBillToAndSoldToContacts" "InvoiceOwnerAllContacts"
Responses
200

OK

400

Bad Request

404

Not Found

405

Method Not Allowed

415

Unsupported Media Type

500

Internal Server Error

post/notifications/email-templates
Request samples
application/json
{
  • "active": true,
  • "bccEmailAddress": "user@example.com",
  • "ccEmailAddress": "user@example.com",
  • "ccEmailType": "SpecificEmails",
  • "description": "Email when an account is edited",
  • "emailBody": "Dear user,<p>the account <Account.Name> has been edited. <p>Example Co. Ltd.",
  • "emailHeaders": {
    },
  • "emailSubject": "Account <Account.Number> has been edited",
  • "encodingType": "UTF8",
  • "eventTypeName": "AccountEdit",
  • "fromEmailAddress": null,
  • "fromEmailType": "TenantEmail",
  • "fromName": "Example Co. Ltd.",
  • "isHtml": true,
  • "name": "Account Edit Email",
  • "replyToEmailAddress": null,
  • "replyToEmailType": "TenantEmail",
  • "toEmailAddress": null,
  • "toEmailType": "BillToContact"
}
Response samples
application/json
{
  • "active": true,
  • "bccEmailAddress": "user@example.com",
  • "ccEmailAddress": "string",
  • "ccEmailType": "BillToContact",
  • "createdBy": "25a02396-1048-48f9-bf93-102d2fb7895e",
  • "createdOn": "2019-08-24T14:15:22Z",
  • "description": "string",
  • "emailBody": "string",
  • "emailHeaders": {
    },
  • "emailSubject": "string",
  • "encodingType": "UTF8",
  • "eventCategory": 0,
  • "eventTypeName": "string",
  • "eventTypeNamespace": "string",
  • "fromEmailAddress": "string",
  • "fromEmailType": "TenantEmail",
  • "fromName": "string",
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "isHtml": true,
  • "name": "string",
  • "replyToEmailAddress": "string",
  • "replyToEmailType": "TenantEmail",
  • "toEmailAddress": "string",
  • "toEmailType": "BillToContact",
  • "updatedBy": "b0efe45f-0520-4e21-90f0-7e35f137732e",
  • "updatedOn": "2019-08-24T14:15:22Z"
}