Create Email Template

Learn to create email template with API

This API allows you to create email templates. This is currently supported exclusively for email channels. This API allows users to define and configure new templates, incorporating content through URL or inline methods and supports AMP HTML content as well.

HTTP Method

This API uses the POST method to create a new email template.

API Endpoint

The Create Email Template API is available across multiple regions; below are the base URLs for different regions.

Request Header

Authentication details are required to access the API. Ensure you include the necessary tokens or credentials in your request headers.

Header NameTypeDescriptionExampleRequired?
api-keyStringAPI key for authentication41a1de35948f915f64907ced9eed4f00Yes

Request Body

All necessary parameters should be passed in the request body in JSON format.

Body ParameterData TypeDescriptionRequired?Part of Body Parameter
channelstringSpecifies the platform for the template. For example: emailYes
template_content_meta_dataobjectContains metadata about the template content.Yes
typestringIntake type, either "URL" or "inline". Only one can be used; choosing one excludes the other.Yestemplate_content_meta_data
encodingstringSpecifies encoding as "base64" or left blank.
Note: If "base64" encoding is specified, the content within the content block (inline_html or amp_inline_html), must adhere to base64 encoding standards.
Notemplate_content_meta_data
categorystringOptional category for the template. If unspecified, the template remains uncategorized.Notemplate_content_meta_data
template_content_blockobjectContains the actual content for the template.Yes
html_urlstringURL for HTML content, applicable when type is "url".Notemplate_content_block
inline_htmlstringInline HTML content, applicable when type is "inline".Notemplate_content_block
amp_urlstringAMP HTML URL, applicable when type is "url".Notemplate_content_block
amp_inline_htmlstringAMP HTML inline content, applicable when type is "inline" for AMP templates.Notemplate_content_block
template_namestringRequired name of templateYes

Example Request Body

{
  "channel": "email",
  "template_content_meta_data": {
    "type": "inline",
    "encoding": "base64",
    "category": "Marketing"
  },
  "template_content_block": {
    "inline_html": "<html><body><h1>Hello, World!</h1></body></html>",
    "amp_inline_html": "<html amp4email><body><h1>Hello, AMP World!</h1></body></html>"
  },
  "template_name": "Welcome Email Template"
}

Response & Error Codes

Error CodeDescriptionExample Sample
200The request was successful, and the template was created.{ "data": { "status": "string", "description": "string" }, "message": "string", "statusCode": 200 }
400The request was invalid. Check the request parameters and body for errors.{ "message": "Bad request", "statusCode": 400 }
500An error occurred on the server while processing the request.{ "message": "failed. Internal server error. Please try again.", "statusCode": 500 }