curl --request PUT \
--url https://api-{dc}.moengage.com/v2/bulk/email-templates \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--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"
]
}
}{
"status": "success",
"data": {
"new_templates": [
"Email attachment should be valid one with size less than 6mb & total attachments size less than 20mb"
],
"updated_templates": [
"Given id is invalid email template id"
]
}
}{
"status": "error",
"data": {
"code": 401,
"title": "Authentication required",
"description": "Invalid APP_ID used in Authentication Header"
}
}{
"status": "error",
"data": {
"code": 429,
"title": "rate limiter exception",
"description": "Exceeded rate limit for this app"
}
}{
"title": "Internal Server Error",
"message": "An unexpected error was encountered while processing this request. Please contact MoEngage Team"
}Bulk Create/Update Templates
This API creates or updates email templates in bulk. You can create or update up to 50 templates in a single request.
curl --request PUT \
--url https://api-{dc}.moengage.com/v2/bulk/email-templates \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--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"
]
}
}{
"status": "success",
"data": {
"new_templates": [
"Email attachment should be valid one with size less than 6mb & total attachments size less than 20mb"
],
"updated_templates": [
"Given id is invalid email template id"
]
}
}{
"status": "error",
"data": {
"code": 401,
"title": "Authentication required",
"description": "Invalid APP_ID used in Authentication Header"
}
}{
"status": "error",
"data": {
"code": 429,
"title": "rate limiter exception",
"description": "Exceeded rate limit for this app"
}
}{
"title": "Internal Server Error",
"message": "An unexpected error was encountered while processing this request. Please contact MoEngage Team"
}Rate Limit
The rate limits are at the workspace level, and a maximum of 1000 (sum of all the API requests per workspace) requests are allowed for a workspace per minute.Authorizations
Authentication is done via Basic Auth. This requires a base64-encoded string of your credentials in the format 'username:password'.
- Username: Use your MoEngage workspace ID (also known as the App ID). You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).
- Password: Use your API Key, which you can find within the Data tile.
For more information on authentication and getting your credentials, refer here.
Headers
This is the Workspace ID of your MoEngage account that must be passed with the request. You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).
Body
50This 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.
5 - 50^[a-zA-Z0-9_]+$"End_Of_Season_Sale_Template"
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.
"<!DOCTYPE html><html><body><p>Content</p></body></html>"
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.
"Partner"
This field contains the subject of the email campaign.
"End of Season Sale!"
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.
10This 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.
"Your Brand Name"
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.
"john.doe@example.com"
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.
"63f30792c66ddcaac2ef9109"
Response
This response is returned when the request is processed successfully.
Was this page helpful?