Skip to main content

Add template

Description

Adds a new message template.

Request URL

Method: POST

https://example.com/api/v1.1/templates/add

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
formatstring"json"NoResponse data format
By default– json
namestring"Subscription confirmation template"YesTemplate name
descrstring"Template used in Double Opt-In scenario"NoTemplate description
channels[]channels
"channels": [
   {
      "sid": "email",
      "fields":{
         "text": "Hello, world!",
         "html": "Hello, world!",
         "subject": "Subject line",
         "from_email": "",
         "from_name": "",
         "replyto_email": "",
         "replyto_name": ""
      }
   }
]
YesTemplate settings for a certain channel.

Learn more
json_urlstring"https://altcraft.com/public/assets/example/test.json"NoLink to dynamic JSON content
ui_tags[]string["tag_1","tag_2"]NoList of tags
groups[]int[1,2]NoList of group IDs
is_draftboolfalseNoDraft template flag.
If this is a draft, the template cannot be sent.
is_confirmbooltrueNoConfirm subscription link flag.

Is there a confirmation link in the body of the email or not.
suppress_idint2NoSuppression list ID

Request example

{
"token": "abcdefghijklmnqrstuvwxyz",
"name": "Subscription confirmation template",
"descr":"Template used in Double Opt-In scenario",
"channels": [
{
"sid": "email",
"fields": {
"text": "Hello, world!",
"html": "<html>Hello, world!</html>",
"subject": "Тема письма",
"from_email": "",
"from_name": "",
"replyto_email": "",
"replyto_name": "",
"is_not_inline": true
}
}
],
"json_url": "https://altcraft.com/example/message.json",
"ui_tags": ["tag_1","tag_2"],
"groups": [1,2],
"is_draft": false,
"is_confirm": false,
"suppress_id": 2
}

Response example

{
"data": {
"saved_id": 10
},
"error": 0,
"error_text": "Successful operation"
}

Response parameters

ПараметрТипОписание
errorintError code
error_textstringError text
saved_idstringCreated template ID