All URIs are relative to https://api.sendx.io/api/v1/rest
| Method | HTTP request | Description |
|---|---|---|
| createEmailTemplate | POST /template/email | Create email template |
| deleteEmailTemplate | DELETE /template/email/{identifier} | Delete template |
| getAllEmailTemplates | GET /template/email | Get all templates |
| getEmailTemplate | GET /template/email/{identifier} | Get template by ID |
| updateEmailTemplate | PUT /template/email/{identifier} | Update template |
RestRTemplate createEmailTemplate(restETemplate)
Create email template
Creates a new reusable email template.
import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';
let apiInstance = new sendx.TemplateApi();
let restETemplate = {"name":"Weekly Newsletter Template","htmlCode":"<div class=\"newsletter\"><h1>{{company.name}} Weekly Update</h1><div class=\"content\">{{email.content}}</div></div>","templateCode":"{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null,\"showIfKey\":null},\"content\":[{\"type\":\"text\",\"text\":\"This is a new template\"}]}]}","editorType":1}; // RestETemplate |
apiInstance.createEmailTemplate(restETemplate).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});| Name | Type | Description | Notes |
|---|---|---|---|
| restETemplate | RestETemplate |
- Content-Type: application/json
- Accept: application/json
DeleteResponse deleteEmailTemplate(identifier)
Delete template
Deletes an email template.
import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';
let apiInstance = new sendx.TemplateApi();
let identifier = "template_f3lJvTEhSjKGVb5Lwc5SWS"; // String | The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS`
apiInstance.deleteEmailTemplate(identifier).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});| Name | Type | Description | Notes |
|---|---|---|---|
| identifier | String | The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS` |
- Content-Type: Not defined
- Accept: application/json
[RestRTemplate] getAllEmailTemplates(opts)
Get all templates
Retrieves all email templates.
import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';
let apiInstance = new sendx.TemplateApi();
let opts = {
'offset': 0, // Number | Number of records to skip for pagination. **Examples:** - `0` - First page (default) - `25` - Second page (with limit=25) - `50` - Third page (with limit=25)
'limit': 10, // Number | Maximum number of templates to return per page. **Guidelines:** - Default: 10 templates - Maximum: 100 templates - Recommended: 25-100 for optimal performance
'search': "search_example" // String | Search templates by name (case-insensitive partial matching). **Examples:** - `newsletter` - Finds \"Weekly Newsletter\", \"Monthly Newsletter\" - `welcome` - Finds \"Welcome Email\", \"New User Welcome\" - `product` - Finds \"Product Launch\", \"Product Update\"
};
apiInstance.getAllEmailTemplates(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});| Name | Type | Description | Notes |
|---|---|---|---|
| offset | Number | Number of records to skip for pagination. Examples: - `0` - First page (default) - `25` - Second page (with limit=25) - `50` - Third page (with limit=25) | [optional] [default to 0] |
| limit | Number | Maximum number of templates to return per page. Guidelines: - Default: 10 templates - Maximum: 100 templates - Recommended: 25-100 for optimal performance | [optional] [default to 10] |
| search | String | Search templates by name (case-insensitive partial matching). Examples: - `newsletter` - Finds "Weekly Newsletter", "Monthly Newsletter" - `welcome` - Finds "Welcome Email", "New User Welcome" - `product` - Finds "Product Launch", "Product Update" | [optional] |
- Content-Type: Not defined
- Accept: application/json
RestRTemplate getEmailTemplate(identifier)
Get template by ID
Retrieves a specific email template.
import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';
let apiInstance = new sendx.TemplateApi();
let identifier = "template_f3lJvTEhSjKGVb5Lwc5SWS"; // String | The unique template identifier. - `template_f3lJvTEhSjKGVb5Lwc5SWS` - Standard prefixed ID
apiInstance.getEmailTemplate(identifier).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});| Name | Type | Description | Notes |
|---|---|---|---|
| identifier | String | The unique template identifier. - `template_f3lJvTEhSjKGVb5Lwc5SWS` - Standard prefixed ID |
- Content-Type: Not defined
- Accept: application/json
RestRTemplate updateEmailTemplate(restETemplate, identifier)
Update template
Updates an existing email template.
import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';
let apiInstance = new sendx.TemplateApi();
let restETemplate = new sendx.RestETemplate(); // RestETemplate |
let identifier = "template_f3lJvTEhSjKGVb5Lwc5SWS"; // String | The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS`
apiInstance.updateEmailTemplate(restETemplate, identifier).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});| Name | Type | Description | Notes |
|---|---|---|---|
| restETemplate | RestETemplate | ||
| identifier | String | The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS` |
- Content-Type: application/json
- Accept: application/json