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.
Region | Base URL |
---|---|
India | https://apiind.netcoresmartech.com/v4/content/create |
United States | https://api.netcoresmartech.com/v4/content/create |
Europe | https://apieu.netcoresmartech.com/v4/content/create |
Request Header
Authentication details are required to access the API. Ensure you include the necessary tokens or credentials in your request headers.
Header Name | Type | Description | Example | Required? |
---|---|---|---|---|
api-key | String | API key for authentication | 41a1de35948f915f64907ced9eed4f00 | Yes |
Request Body
All necessary parameters should be passed in the request body in JSON format.
Body Parameter | Data Type | Description | Required? | Part of Body Parameter |
---|---|---|---|---|
channel | string | Specifies the platform for the template. For example: email | Yes | |
template_content_meta_data | object | Contains metadata about the template content. | Yes | |
type | string | Intake type, either "URL" or "inline". Only one can be used; choosing one excludes the other. | Yes | template_content_meta_data |
encoding | string | Specifies 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. | No | template_content_meta_data |
category | string | Optional category for the template. If unspecified, the template remains uncategorized. | No | template_content_meta_data |
template_content_block | object | Contains the actual content for the template. | Yes | |
html_url | string | URL for HTML content, applicable when type is "url". | No | template_content_block |
inline_html | string | Inline HTML content, applicable when type is "inline". | No | template_content_block |
amp_url | string | AMP HTML URL, applicable when type is "url". | No | template_content_block |
amp_inline_html | string | AMP HTML inline content, applicable when type is "inline" for AMP templates. | No | template_content_block |
template_name | string | Required name of template | Yes |
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 Code | Description | Example Sample |
---|---|---|
200 | The request was successful, and the template was created. | { "data": { "status": "string", "description": "string" }, "message": "string", "statusCode": 200 } |
400 | The request was invalid. Check the request parameters and body for errors. | { "message": "Bad request", "statusCode": 400 } |
500 | An error occurred on the server while processing the request. | { "message": "failed. Internal server error. Please try again.", "statusCode": 500 } |
Updated about 2 months ago