Skip to main content
PUT
/
bulk
/
email-templates
Bulk Create/Update Templates
curl --request PUT \
  --url https://api-{dc}.moengage.com/v2/bulk/email-templates \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: <content-type>' \
  --header 'MOE-APPKEY: <moe-appkey>' \
  --data '
[
  {
    "name": "End_Of_Season_Sale_Template",
    "html": "<!DOCTYPE html><html><body><p>Content</p></body></html>",
    "source": "Partner",
    "subject": "End of Season Sale!",
    "attachments": [
      "https://app-cdn.moengage.com/assets/LogoThumbnail.jpg"
    ],
    "sender_name": "Your Brand Name",
    "updated_by": "john.doe@example.com",
    "id": "63f30792c66ddcaac2ef9109"
  }
]
'
{
  "status": "success",
  "data": {
    "new_templates": [
      "645a2c0d10e0307e6d7f7719"
    ],
    "updated_templates": [
      "645a2bd910e0307e6d7f7717"
    ]
  }
}

Rate Limit

The rate limits are at the app level, and a maximum of a thousand (sum of all the API requests per app)requests are allowed for an app per minute.

FAQ

How is the create request differentiated from an update template request? In the case of an update, the template to be updated is identified using its template id. It is mandatory to pass the id field in the required for an update template request. Otherwise, it will be treated as a create template request.

Authorizations

Authorization
string
header
required

The API request will be authenticated through Basic Authentication. Basic Authentication sends a Base64-encoded string containing your username and password with every API request.

The username and password details can be obtained from the MoEngage Dashboard. If you're using the API for the first time, follow these steps:

  1. Navigate to Settings -> Account -> APIs.
  2. Copy the following details:
    • Username: Under Workspace ID (earlier app id), click the copy icon to copy the username.
    • Password: In the API keys section, click the copy icon in the Data tile to copy the API key.
  3. Use these details to authenticate the API requests.

Headers

MOE-APPKEY
string
required

This is your MoEngage account's APP ID that has to be passed along with the request. You can find your MoEngage APP ID at Settings -> Account -> APIs -> App ID.

Content-Type
enum<string>
required

Set the Content-Type header to application/json.

Available options:
application/json
Authorization
string
required

This authentication parameter, used for access control, must be passed along with the request. To generate the authentication header, refer to Authentication.

Body

application/json
Maximum array length: 50
name
string
required

This field contains the name of the template and would be used for identifying the template. You can look for the template created using this API in the second step of campaign creation in the 'My Saved Templates' tab using this name.

Note:

  • The name field can contain only alphanumeric and underscore characters.
  • The length of this field can be between 5-50 characters.
Required string length: 5 - 50
Pattern: ^[a-zA-Z0-9_]+$
Example:

"End_Of_Season_Sale_Template"

html
string
required

This field contains the message body of the email. This is where you define the email template being created. The HTML tag and BODY tag (with text/tags) are mandatory. The SCRIPT tag is not allowed.

Example:

"<!DOCTYPE html><html><body><p>Content</p></body></html>"

source
string
required

This field contains information about the source of template creation. This can be the name of the email partner.

Note: Only alphanumerics, spaces, and underscores are allowed in this field.

Example:

"Partner"

subject
string

This field contains the subject of the email campaign.

Example:

"End of Season Sale!"

attachments
string<uri>[]

This field contains the attachments to be included in the email.

Note:

  • Only URLs can be added as part of Email attachments.
  • A maximum of ten attachments are allowed.
  • The URL should start with https and end with a valid extension. The following extensions are not allowed: .dmg, .exe, .xls, .ddl, .class, .obj, .int, .gnt, .o, .so, .lbr, and .net
  • Individual attachments should be less than 6 MB, and the total size of the attachments should be less than 20 MB.
Maximum array length: 10
sender_name
string

This field contains the name displayed that is displayed in the inboxes of your recipients. Sender names are one of the first things people see when you send them an email.

Example:

"Your Brand Name"

updated_by
string

This field contains information about who created the template.

Note: Only alphanumerics, spaces, and hyphens are allowed in this field. This field can contain the email ID of the creator as well. The email id should be in the right format and a valid one.

Example:

"john.doe@example.com"

id
string

This is the Template id of the template being updated. It is mandatory to add this field when updating a template. The template id is a unique identifier that is generated at the time of template creation using the Create Email Template API.

Example:

"63f30792c66ddcaac2ef9109"

Response

This response is returned when the request is processed successfully.

status
string

This field contains the status of the request and denotes whether it was successful or not.

Example:

"success"

data
object

This field contains the id of the created template when the request is successful and the error details in case of an unsuccessful request.