Skip to main content
POST
/
custom-templates
/
email
/
search
Search Email Template
curl --request POST \
  --url https://api-0{dc}.moengage.com/v1.0/custom-templates/email/search \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "page": 123,
  "entries": 123,
  "template_name": "<string>",
  "template_source": [
    "<string>"
  ],
  "template_version": "<string>",
  "template_id": "<string>",
  "template_type": [
    "<string>"
  ],
  "created_by": [
    "<string>"
  ],
  "updated_by": [
    "<string>"
  ],
  "sort_params": [
    {}
  ],
  "external_template_ids": [
    {
      "external_template_id": "<string>",
      "version": 123
    }
  ],
  "group_id": "<string>",
  "is_grouped_response": true,
  "is_count_required": true
}
'
{
  "data": [
    {
      "external_template_id": "{{external_template_id}}",
      "version": 2,
      "basic_details": {
        "email_content": "<!DOCTYPE html><html><head><title>Sample Webpage</title></head><body><h1>Welcome to My Sample Webpage 1</h1><p>This is a small example of an HTML webpage.</p><p>Below is an unordered list:</p><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul><p>Here's an image:</p><img src=\"https://example.com/sample-image.jpg\" alt=\"Sample Image\"><p>Visit our <a href=\"https://www.example.com\">website</a> for more information.</p></body></html>",
        "subject": "Hi, Test subject 1",
        "attachments": [],
        "thumbnail_url": "https://img.freepik.com/free-vector/bright-yellow-sunflower-design-decorations_1308-130330.jpg",
        "sender_name": "test sender 1"
      },
      "meta_info": {
        "template_id": "{{template_id}}",
        "template_name": "test_template_1",
        "template_version": "0",
        "created_by": "user1@moengage.com"
      }
    }
  ]
}

Rate Limit

The rate limit is 100 RPM.

Note

  1. You can send empty filters to fetch all the email templates.
  2. You can send only template_ids if you want specific older versions of the email template. In other cases, you will receive the latest version of the template.
  3. By default, the is_default_template_of_group flag is set to “true” for the default (parent) template and “false” for child templates.

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. It encodes a 'username:password' string in Base64 and appends the encoded string with 'Basic '. This string is included in the authorization header as shown below:

{"Authorization: Basic Base64_ENCODED_WORKSPACEID_APIKEY=="}

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

Content-Type
string
default:application/json
required

Set the Content-Type header to 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
page
integer

This field contains the index of the pages to be returned in the search result.

entries
integer

This field contains the number of entries per page in the search result.

template_name
string

This field indicates the name of the template. When this value is specified, the template that matches the name specified in this field will be returned.

template_source
string[]

This field indicates the template source that created the template. For example ["API", "MOENGAGE"]. When specified, the templates whose source matches that specified in this list will be returned.

template_version
string

This field indicates the template version. When specified, the template whose template version matches that specified in this field will be returned.

template_id
string

This field indicates the template id. When specified, the template whose template id matches that specified in this field will be returned.

template_type
string[]

This field indicates whether the template is a custom one or a pre-built one. Allowed values: CUSTOM, PRE_BUILT. When specified, the templates whose template type matches that specified in this list will be returned.

created_by
string[]

This field indicates the user who created the template. When specified, the templates for which the created_by user information matches that specified in this list will be returned. Example: ["user1@moengage.com", "user2@moengage.com"]

updated_by
string[]

This field indicates the user who updated the template. When specified, the templates for which the updated_by user information matches that specified in this list will be returned. Example: ["user1@moengage.com", "user2@moengage.com"]

sort_params
object[]

This field indicates the sorting parameters for the search result and the sort order. Example: "sort_params":[{"template_name": "ASCENDING","last_modified_date": "ASCENDING","last_modified_by": "ASCENDING"}]

external_template_ids
object[]

This field indicates the list of the template ids and their versions that must be fetched. When this value is specified, the template that matches the id and version specified in this field will be returned.

group_id
string

This field indicates the group ID of the parent template. Pass the Group ID of the parent (default) template of the group to fetch all templates associated with that group. The "external_template_id" generated for the parent template acts as its group ID.

is_grouped_response
boolean

If the value is "true", this API fetches only the default template data, including additional fields such as unique locale count, unique variations, total templates in the group, and all individual templates that are not part of any group. If the value is "false", this API will fetch all individual templates and their template data.

is_count_required
boolean

If the value is "true", this API fetches total templates of the same request to support pagination on the UI.

Response

This response is returned when the request is processed successfully.

data
object[]

This field contains the list of email templates that satisfy the search criteria. For information about the template, refer to Basic Details and Meta Info.

error
object

This field contains the reason for the request's failure.