Creates or updates an email template
https://dns-name/template/create
If you omit the “id” field then a new template will be created. If you specify the “id” field, the system will try to find a template with the specified id and edit it.
Restrictions:
- The maximum request size is 10 MB
- The number of templates is limited to 10000
Request Body
POST https://dns-name/template/create
Content-Type: application/json
X-API-KEY: Value
{
"template": {
"id": "string",
"name": "string",
"body": {
"html": "string",
"plaintext": "string",
"amp": "string"
},
"subject": "string",
"headers": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"attachments": [
{
"type": "string",
"name": "string",
"content": "string"
}
],
"template_builder": "string",
"global_replacements": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"global_info": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"sender_email": "string",
"sender_name": "string",
"reply_to": "string",
"check_links": 0,
"check_read": 0,
"inline_attachments": [
{
"type": "string",
"name": "string",
"content": "string"
}
]
}
}
Request Parameters
Name | Type | Description |
---|---|---|
template | OBJECT Required | Object with all the template properties |
»id | STRING (UUID) Required | Template unique identifier |
»name | STRING (UUID) Required | Template name |
»template_builder | STRING | Editor type, “html” or “visual”. Default is “html”. You can create a template with “visual” editor type only in web interface. |
»global_replacements | OBJECT | Object for passing the substitutions(merge tags) common for all recipients – e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters: – body.html – body.plaintext – body.amp – subject – sender_name – options.unsubscribe_url A substitution name can consist from latin characeters, numbers and “_” or “-” symbols, and should start with the letter. |
»global_info | OBJECT | Object for passing the info common for all the recipients, such as “key”: “value”. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned by webhook on your endpoint. |
»body | OBJECT REQUIRED | Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required. |
»»html | STRING | HTML part of the email body |
»»plaintext | STRING | Plaintext part of the email body |
»»amp | STRING | Optional AMP part of the email body |
»subject | STRING | Email subject |
»sender_email | STRING | Sender’s email. Required only if template_id parameter is empty. |
»sender_name | STRING | Sender’s name |
»reply_to | STRING | Optional Reply-To email (in case it’s different to sender’s email) |
»check_links | INTEGER | 1=click tracking is on (default), 0=click tracking is off |
»check_read | INTEGER | 1=read tracking is on (default), 0=read tracking is off. |
»headers | OBJECT | Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are ignored, for example X-GMS-Global-Language, X-GMS-Template-Engine. |
»attachments | ARRAY | Optional array of attachments |
»»type | STRING REQUIRED | Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»»name | STRING REQUIRED | Attachment name in the format: “name.extension” Attachment content id. For example, “name”=“IMAGECID1” should be referenced in HTML like <img src=“cid:IMAGECID1”> |
»»content | STRING (BYTE) REQUIRED | File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
»inline_attachments | ARRAY | Optional array of inline attachments, e.g. for including images in email instead of loading them from external URL. |
Response Body
{
"status": "string",
"template": {
"id": "string",
"name": "string",
"body": {
"html": "string",
"plaintext": "string",
"amp": "string"
},
"subject": "string",
"headers": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"attachments": [
{
"type": "string",
"name": "string",
"content": "string"
}
],
"template_builder": "string",
"template_creator": "string",
"global_replacements": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"global_info": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"sender_email": "string",
"sender_name": "string",
"reply_to": "string",
"check_links": 0,
"check_read": 0,
"inline_attachments": [
{
"type": "string",
"name": "string",
"content": "string"
}
]
}
}
HTTP Code 200:
Template set successfully |
Response Parameters
Name | Type | Description |
---|---|---|
status | STRING REQUIRED | “Success” string |
template | OBJECT REQUIRED | Object with all the template properties |
»id | STRING (UUID) REQUIRED | Template unique identifier |
»name | STRING (UUID) REQUIRED | Template name |
»template_builder | STRING | Editor type, “html” or “visual”. Default is “html”. You can create a template with “visual” editor type only in web interface. |
»global_replacements | OBJECT | Object for passing the substitutions(merge tags) common for all recipients – e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters: · body.html · body.plaintext · body.amp · subject · sender_name · options.unsubscribe_url A substitution name can consist from latin characeters, numbers and “_” or “-” symbols, and should start with the letter. |
»global_info | OBJECT | Object for passing the info common for all the recipients, such as “key”: “value”. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned by webhook on your endpoint. |
»body | OBJECT REQUIRED | Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required. |
»»html | STRING | HTML part of the email body |
»»plaintext | STRING | Plaintext part of the email body |
»»amp | STRING | Optional AMP part of the email body |
»subject | STRING | Email subject. |
»sender_email | STRING | Sender’s email. Required only if template_id parameter is empty. |
»sender_name | STRING | Sender’s name |
»reply_to | STRING | Optional Reply-To email (in case it’s different to sender’s email) |
»check_links | INTEGER | 1=click tracking is on (default), 0=click tracking is off |
»check_read | INTEGER | 1=read tracking is on (default), 0=read tracking is off |
»headers | OBJECT | Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are ignored, for example X-GMS-Global-Language, X-GMS-Template-Engine |
»attachments | ARRAY | Optional array of attachments |
»»type | STRING REQUIRED | Attachment type, see MIME. If unsure, use “application/octet-stream” |
»»name | STRING REQUIRED | Attachment name in the format: “name.extension” Attachment content id. For example, “name”=“IMAGECID1” should be referenced in HTML like <img src=“cid:IMAGECID1”> |
»»content | STRING (UUID) REQUIRED | File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
»inline_attachments | ARRAY | Optional array of inline attachments, e.g. for including images in email instead of loading them from external URL. |
HTTP Code default:
Error occurred |
{
"status": "string",
"code": 0,
"message": "string"
}
Name | Type | Description |
---|---|---|
status | STRING REQUIRED | “Error” string |
message | STRING REQUIRED | Human-readable error message in English |
code | STRING REQUIRED | API Error code |