curl --request POST \
--url https://api-{dc}.moengage.com/v1.0/custom-templates/email \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"basic_details": {
"subject": "Email_Subject",
"email_content": "<!DOCTYPE html><html><head><title>My Short HTML</title></head><body><h1>Hello, World!</h1><p>This is a simple HTML example.</p></body></html>",
"thumbnail_url": "{{template_thumbnail_thumbnail_url}}",
"sender_name": "Sender_Name",
"preview_text": "Preview_text",
"attachments": []
},
"meta_info": {
"created_by": "john.doe@example.com",
"template_id": "{{template_id_1}}",
"template_name": "{{template_name}}",
"template_version": "{{template_version}}",
"locale": "{{Locale_name}}",
"variation": 1
}
}
'{
"external_template_id": "d05a44f0-a7cf-471a-bcb6-63054800a367"
}Create Email Template (V2)
This API creates an email template in MoEngage. You can use this API to upload templates created outside the MoEngage ecosystem to MoEngage and use them for campaign creation. The uploaded templates can be edited in the Froala editor (custom HTML editor) on the MoEngage dashboard.
curl --request POST \
--url https://api-{dc}.moengage.com/v1.0/custom-templates/email \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"basic_details": {
"subject": "Email_Subject",
"email_content": "<!DOCTYPE html><html><head><title>My Short HTML</title></head><body><h1>Hello, World!</h1><p>This is a simple HTML example.</p></body></html>",
"thumbnail_url": "{{template_thumbnail_thumbnail_url}}",
"sender_name": "Sender_Name",
"preview_text": "Preview_text",
"attachments": []
},
"meta_info": {
"created_by": "john.doe@example.com",
"template_id": "{{template_id_1}}",
"template_name": "{{template_name}}",
"template_version": "{{template_version}}",
"locale": "{{Locale_name}}",
"variation": 1
}
}
'{
"external_template_id": "d05a44f0-a7cf-471a-bcb6-63054800a367"
}Rate Limit
The rate limit is 100 RPM. You can upload a maximum of 10000 templates per channel.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 Campaign report/Business events/Custom templates/Catalog API/Inform Report tile.
For more information on authentication and getting your credentials, refer here.
Body
This field contains the email content. This is where you define the email template being created.
Show child attributes
Show child attributes
This field contains information about the template being created, such as the name, version, and ID of the template and the creator's details.
Show child attributes
Show child attributes
This field contains the name of the team to which this template should be assigned.
Team-based template management lets you create separate templates for different teams within your workspace (for example, a template created by the Marketing team and another by the Engineering team), so that each team's campaigns use their own templates.
team_nameis mandatory if teams are enabled for your workspace.- If teams are enabled for your workspace and this field is not passed, the template will not be created and the request will fail with an error.
- Team-based template management is currently released behind a feature flag and may not be enabled for your workspace. If this flag is not enabled and you pass
team_name, the request will fail. Reach out to your Customer Success Manager (CSM) to get this setting enabled before using this field. - If teams are not enabled for your workspace, do not pass this field. Existing integrations that use
team_id(or that do not pass any team information) are unaffected and continue to work as before.
"team1"
Response
This response is returned when the request is processed successfully.
This field contains the unique template id corresponding to a successful template creation request and needs to be stored by you. This template id would be used for searching a specific template and updating it. For a parent (default) template, the generated "external_template_id" acts as its group ID.