Overview
This request allows you to create a transactional template by specifying details such as the name subject line, HTML content, and enabling engagement reporting.
Endpoint
Method | URL |
---|---|
POST | https://api.everlytic.net/transactional/email/v1/templates |
Request Body
{ "name": "string", "subject": "string", "description": "string", "from_email": "string", "from_name": "string", "reply_email": "string", "content_html": "string", "content_text": "string", "track_reads": boolean, "track_links": boolean, "group_by_name": "string" }
Property | Description | Data type | Parameters | Required |
---|---|---|---|---|
name | The name of the template | string | Yes | |
subject | The subject line text that will appear in recipients’ inboxes. | string | Yes | |
description | A short description of the template | string | No | |
from_email | The email address that will appear as the sender in recipients’ inboxes | string | Must be a verified domain | Yes |
from_name | The name that will appear as the sender in recipients’ inboxes | string | No | |
reply_email | The email address that replies to emails using this template will go to. | string | Yes | |
content_html | The HTML body content of the template | string | Yes | |
content_text | The text body content of the template | string | No | |
track_reads | Setting to enable engagement reporting when contacts’ open emails using this template | boolean |
|
No |
track_links | Setting to enable engagement reporting when contacts’ click on links in emails using this template | boolean |
|
No |
group_by_name | Emails sent using this template will be grouped under this name, instead of the default behaviour of grouping by month. | string | No |
Example Request
curl --location 'https://api.everlytic.net/transactional/email/v1/templates' \ --data-raw '{ "name": "Example template", "subject": "Hello!", "description": "Test template", "from_email": "[email protected]", "from_name": "Test", "reply_email": "[email protected]", "track_links": true, "track_opens": true, "group_by_name": "Good templates", "content_html": "Hello world!", "content_text": "Hello world!" }'
Response
Status codes
Status code | Explanation |
---|---|
200 OK | Template was created successfully |
400 Bad Request | The request body was improperly formatted |
401 Unauthorized | The provided authorization credentials are incorrect |
403 Forbidden | This user does not have access to Transactional Emails |
412 Precondition Failed | One or more of the properties in the request body were invalid |
Properties
Properties of responses with status 200
Property | Sub-properties | Description | Data type | Parameters |
---|---|---|---|---|
template | id | The ID that will be used to identify the webhook in future requests | string | |
name | The template’s name | string | ||
subject | The subject line text on the template | string | ||
description | A short description of the template | string | ||
from_email | The email address that will be shown as the sender in the contact’s inbox | string | Verified domain | |
from_name | The name assigned that will appear as the sender in the contact’s inbox | string | ||
reply_email | The email address that will receives replies to emails using this template | string | ||
track_links | This determines whether engagement on links will be recorded on emails using this template | boolean |
|
|
track_clicks | This determines whether engagement on clicks will be recorded on emails using this template | boolean |
|
|
group_by_name | Emails sent using this template will be grouped under this name, instead of the default behaviour of grouping by month. | string | ||
content_html | The HTML body content of the template | string | ||
content_text | The text body content of the template | string | ||
status | The current publication status of the template | enum (string) |
|
|
created_timestamp | The initial date and time that the template was created | date-time | ISO 8601 date-time string | |
updated_timestamp | The latest date and time that the template was updated | date-time | ISO 8601 date-time string |
Properties of responses with 4XX status
Property | Description | Data type | Expected parameters |
---|---|---|---|
code | The HTTP response status code | integer |
|
message | The reason for the failure | string | Valid string |
error | Array containing errors field | JSON |
|
errors | Array containing the failure details | JSON |
|
domain | The classification of the type of error | string |
|
reason | Keyword used to describe the error | string |
|
message | Text describing the reason for the failure | string | Valid string |
locationType | The location where the failure occurred | string |
|
location | The type of validation that failed | string |
|
Example responses
Successful created a template [200 OK]
{ "template": { "id": "f4e2f274-4853-463a-9053-514121bfc837", "name": "My Own Template", "subject": "Test Subject", "description": "Test Description", "from_email": "[email protected]", "from_name": "Test Message", "reply_email": "[email protected]", "track_links": true, "track_opens": true, "group_by_name": "", "content_html": "Test Template", "content_text": "", "status": "published", "created_timestamp": "2023-08-18T10:03:15.000Z", "updated_timestamp": "2023-08-18T10:03:15.000Z" } }
Invalid from email format [412 Precondition Failed]
{ "code": 412, "message": "The from email format is invalid.", "error": { "errors": [ { "domain": "global", "reason": "invalidParameter", "message": "The from email format is invalid.", "locationType": "request", "location": "templateValidation" } ] } }
Invalid/Missing authorization credentials [401 Unauthorized]
{ "code": 401, "message": "Login Required", "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "request", "location": "authorization" } ] } }