openapi: 3.0.0
info:
  title: MoEngage - Content - Email Template APIs - v2
  version: 1.0.0
servers:
  - url: https://api-{{0x}}.moengage.com
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
paths:
  /v2/email-templates:
    post:
      tags:
        - General
      summary: Create a single template
      description: |-
        This API is used for create & update email templates.  
        for update id field should be passed
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "{\n    \"name\": \"Single_Email_Template_Name\",\n    \"html\":
                \"<html><body>Test HTML Content </body></html>\",\n   
                \"subject\": \"Test Subject\",\n    \"attachments\": [\n       
                \"{{template_attachment_url}}\"\n    ],\n    \"sender_name\":
                \"Test Sender Name\",\n    \"source\":
                \"Test_Source_name\",\n    \"updated_by\":
                \"user@example.com\"\n}\n"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: MOE-APPKEY
          in: header
          schema:
            type: string
          example: '{{DATA_APP_ID}}'
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    get:
      tags:
        - General
      summary: Get All Templates
      description: This API is used to view all email templates of a App.
      security:
        - basicAuth: []
      parameters:
        - name: MOE-APPKEY
          in: header
          schema:
            type: string
          example: '{{DATA_APP_ID}}'
        - name: page
          in: query
          schema:
            type: integer
          example: '1'
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /v2/email-templates/{template_id}:
    put:
      tags:
        - General
      summary: Update a single template
      description: |-
        This API is used for create & update email templates.  
        for update id field should be passed
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "{\n    \"name\": \"Single_Email_Template_Name\",\n    \"html\":
                \"<html><body>Test HTML Content </body></html>\",\n   
                \"subject\": \"Test Subject\",\n    \"attachments\": [\n       
                \"{{template_attachment_url}}\"\n    ],\n    \"sender_name\":
                \"Test Sender Name\",\n    \"source\":
                \"Test_Source_name\",\n    \"updated_by\":
                \"user@example.com\"\n}"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: MOE-APPKEY
          in: header
          schema:
            type: string
          example: '{{DATA_APP_ID}}'
        - name: template_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    get:
      tags:
        - General
      summary: Get Specific Template
      description: This api is used to get templates by template id
      security:
        - basicAuth: []
      parameters:
        - name: MOE-APPKEY
          in: header
          schema:
            type: string
          example: '{{DATA_APP_ID}}'
        - name: template_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /v2/bulk/email-templates:
    put:
      tags:
        - General
      summary: Create or update bulk templates
      description: >-
        This API is used to create / update more than one email templates. Max
        allowed are 50.
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "[\n    {\n        \"name\":
                \"Bulk_Email_Template_Name1\",\n        \"html\":
                \"<html><body>Test HTML Content </body></html>\",\n       
                \"subject\": \"Test Subject\",\n        \"attachments\":
                [\n            \"{{template_attachment_url1}}\"\n       
                ],\n        \"sender_name\": \"Test Sender Name\",\n       
                \"source\": \"Test_Source_name\",\n        \"updated_by\":
                \"user@example.com\"\n    },\n    {\n        \"name\":
                \"Bulk_Email_Template_Name2\",\n        \"html\":
                \"<html><body>Test HTML Content </body></html>\",\n       
                \"subject\": \"Test Subject\",\n        \"attachments\":
                [\n            \"{{template_attachment_url2}}\"\n       
                ],\n        \"sender_name\": \"Test Sender Name\",\n       
                \"source\": \"Test_Source_name\",\n        \"updated_by\":
                \"user@example.com\"\n    }\n]"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/json
        - name: MOE-APPKEY
          in: header
          schema:
            type: string
          example: '{{DATA_APP_ID}}'
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
