openapi: 3.0.0
info:
  title: MoEngage - Content - Email Templates
  description: >-
    Email Template APIs enables you to fetch, create and update email templates
    on your MoEngage dashboard.


    The following APIs are available:


    1.  [Get all email
    templates](https://developers.moengage.com/hc/en-us/articles/9465771762836)

    2.  [Get a specific email
    template](https://developers.moengage.com/hc/en-us/articles/9465909636884)

    3.  [Create/update email
    template](https://developers.moengage.com/hc/en-us/articles/9466025591060)
        

    Find API documentation here
    -[https://developers.moengage.com/hc/en-us/articles/9465764058388-Email-Template-APIs-](https://developers.moengage.com/hc/en-us/articles/9465764058388-Email-Template-APIs-)
  version: 1.0.0
servers:
  - url: https://api-{{0x}}.moengage.com
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
paths:
  /upsertEmailTemplate:
    post:
      tags:
        - General
      summary: Create or update email templates
      description: >-
        This API is used for create & update email templates.


        Note - If you want to update, you need to send the "id" field. Refer the
        request body section below.


        **Base URL**


        | Data Center | Replace {{OX}} with |

        | --- | --- |

        | DATA_CENTER_1 | 01 |

        | DATA_CENTER_2 | 02 |

        | DATA_CENTER_3 | 03 |


        ###### Request Headers


        | Key | Sample value | Description |

        | --- | --- | --- |

        | Authorization | Basic | We accept Base 64 encoded Username:Password 
        <br>  <br>Here,  <br>\- Username is the APP_ID. You can access your
        MoEngage App ID by navigating to Settings > APIs> APP ID on your
        MoEngage Dashboard.  <br>  <br>\- Password is the Data API Key. You can
        access your MoEngage Data API Key by navigating to Settings > APIs> Data
        API Key on your MoEngage Dashboard.  <br>  <br> |

        | Content-Type | application/json | \-- |


        ###### Request Body


        | Parameter | Type | Data type | Description |

        | --- | --- | --- | --- |

        | id | Optional | String | If the id passed is already present in
        MoEngage only then the template will be updated. Else, we will create a
        new template. |

        | name | Mandatory | String | Name of the template that you want to
        create. If the template already exists, it will update the existing
        template.  <br>\- Only alpha numerics, underscores are allowed.  <br>\-
        Length should be between 5 & 100 |

        | subject | Optional | String | Subject of your email campaign template
        |

        | attachments | Optional | Hash map | Attachments to added in the email
        campaigns  <br>  <br>\- Should start with https & end with valid
        extension  <br>\- Extension not allowed:
        .dmg|.exe|.xls|.ddl|.class|.obj|.int|.gnt|.o|.so|.lbr|.net |

        | html | Mandatory | String | Message body of your email campaign
        template.  <br>  <br>\- html tag and body tag (with text/tags) is
        mandatory  <br>  <br>\- script tag is not allowed  <br>  <br> |

        | sender_name | Optional | String | Name of the sender that you want to
        add in your email campaign |

        | source | Mandatory | String | Source of the template creation -
        customer name or partner name  <br>  <br>Note- Only alphanumerics,
        spaces, underscores are allowed  <br>  <br> |

        | updated_by | Optional | String | User/service that is
        creating/updating the template  <br>  <br>Note - Only alphanumerics,
        spaces, hyphen are allowed OR this should be email id in proper format. 
        <br>  <br> |


        Find API documentation here-
        [https://developers.moengage.com/hc/en-us/articles/9466025591060](https://developers.moengage.com/hc/en-us/articles/9466025591060)
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "{\n        \"name\": \"Single_Email_Template\",\n       
                \"html\": \"<html><body>Test HTML
                Content</body></html>\",\n        \"subject\": \"Test
                Subject\",\n        \"attachments\": [\n           
                \"https://www.learningcontainer.com/wp-content/uploads/2020/07/Sample-JPEG-Image-File-Download.jpg\"\n       
                ],\n        \"sender_name\": \"Test Sender Name\",\n       
                \"source\": \"Test Partner\",\n        \"updated_by\":
                \"user@example.com\"\n    }"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /getEmailTemplateById:
    get:
      tags:
        - General
      summary: Get a specific email template
      description: >-
        You can use this API to get a specific email template from your MoEngage
        account.


        #### Important


        Templates built using the Drag & Drop Editor are not supported.


        **Base URL**


        | Data Center | Replace {{OX}} with |

        | --- | --- |

        | DATA_CENTER_1 | 01 |

        | DATA_CENTER_2 | 02 |

        | DATA_CENTER_3 | 03 |


        **Request Headers**


        | Key | Sample value | Description |

        | --- | --- | --- |

        | Authorization | Basic | We accept Base 64 encoded Username:Password 
        <br>  <br>Here,  <br>Username is the APP_ID. You can access your
        MoEngage App ID by navigating to Settings > APIs> APP ID on your
        MoEngage Dashboard.  <br>  <br>Password is the Data API Key. You can
        access your MoEngage Data API Key by navigating to Settings > APIs> Data
        API Key on your MoEngage Dashboard. |


        Find API Documentation here -


        [https://developers.moengage.com/hc/en-us/articles/9465909636884-Get-a-specific-email-template-](https://developers.moengage.com/hc/en-us/articles/9465909636884-Get-a-specific-email-template-)
      security:
        - basicAuth: []
      parameters:
        - name: id
          in: query
          schema:
            type: string
          description: >
            Here, template_id is the MoEngage template id for the specific
            template that you want to fetch. 
          example: '{{template_id}}'
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /bulkUpsertEmailTemplate:
    post:
      tags:
        - General
      summary: Bulk create/update templates
      description: >-
        This API is used to create / update more than one email templates. Max
        allowed are 50.


        #### Template limit


        You can create/update up to 50 templates at a time.


        **Base URL**


        | Data Center | Replace {{OX}} with |

        | --- | --- |

        | DATA_CENTER_1 | 01 |

        | DATA_CENTER_2 | 02 |

        | DATA_CENTER_3 | 03 |


        #### Request Body


        | Parameter | Type | Data type | Description |

        | --- | --- | --- | --- |

        | id | Optional | String | If the id passed is already present in
        MoEngage only then the template will be updated. Else, we will create a
        new template. |

        | name | Mandatory | String | Name of the template that you want to
        create. If the template already exists, it will update the existing
        template.  <br>\- Only alpha numerics, underscores are allowed.  <br>\-
        Length should be between 5 & 100 |

        | subject | Optional | String | Subject of your email campaign template
        |

        | attachments | Optional | Hash map | Attachments to added in the email
        campaigns  <br>  <br>\- Should start with https & end with valid
        extension  <br>  <br>\- Extension not allowed:
        .dmg|.exe|.xls|.ddl|.class|.obj|.int|.gnt|.o|.so|.lbr|.net |

        | html | Mandatory | String | Message body of your email campaign
        template |

        | sender_name | Optional | String | Name of the sender that you want to
        add in your email campaign |

        | source | Mandatory | String | Source of the template creation -
        customer name or partner name  <br>Note- Only alphanumerics, spaces,
        underscores are allowed |

        | updated_by | Optional | String |   <br>  <br>User/service that is
        creating/updating the template  <br>  <br>Note - Only alphanumerics,
        spaces, hyphen are allowed OR this should be email id in proper format. 
        <br>  <br> |


        Find API documentation here -
        [https://developers.moengage.com/hc/en-us/articles/9466025591060](https://developers.moengage.com/hc/en-us/articles/9466025591060)
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "[\n    {\n        \"name\": \"Bulk_Email_Template1\",\n       
                \"html\": \"<html><body>Test HTML
                Content</body></html>\",\n        \"subject\": \"Test
                Subject\",\n        \"attachments\": [\n           
                \"https://www.learningcontainer.com/wp-content/uploads/2020/07/Sample-JPEG-Image-File-Download.jpg\"\n       
                ],\n        \"sender_name\": \"Test Sender Name\",\n       
                \"source\": \"Test Partner\",\n        \"updated_by\":
                \"user@example.com\"\n    },\n    {\n        \"name\":
                \"Bulk_Email_Template2\",\n        \"html\": \"<html><body>Test
                HTML Content</body></html>\",\n        \"subject\": \"Test
                Subject\",\n        \"attachments\": [\n           
                \"https://www.learningcontainer.com/wp-content/uploads/2020/07/Sample-JPEG-Image-File-Download-scaled.jpg\"\n       
                ],\n        \"sender_name\": \"Test Sender Name\",\n       
                \"source\": \"Test Partner\",\n        \"updated_by\":
                \"user@example.com\"\n    }\n]"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /getAllEmailTemplates:
    get:
      tags:
        - General
      summary: Get all email templates
      description: >-
        You can use this API to get a list of available email templates in your
        MoEngage account


        **Base URL**


        | Data Center | Replace {{OX}} with |

        | --- | --- |

        | DATA_CENTER_1 | 01 |

        | DATA_CENTER_2 | 02 |

        | DATA_CENTER_3 | 03 |


        API Documentation -
        [https://developers.moengage.com/hc/en-us/articles/9465771762836](https://developers.moengage.com/hc/en-us/articles/9465771762836)
      security:
        - basicAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
