Templates are saved emails you start new campaigns from. All commands take APIKey. Errors use the legacy format with Success and ErrorCode. For PATCH, send everything, including APIKey, as a JSON body.
useremailtemplate.create
POST /api/v1/useremailtemplate.
| Parameter | Required | Description |
|---|---|---|
EmailName |
Yes | Template name |
Subject |
Yes | |
PreHeaderText |
No | |
ContentType |
No | HTML (default), Plain or Both |
HTMLContent, PlainContent |
No | |
Mode |
No | Editor (default) |
ImageEmbedding |
No | Enabled or Disabled (default) |
curl https://app.emailmarketer.io/api/v1/useremailtemplate \
-d APIKey="$EM_API_KEY" \
-d EmailName=Welcome \
-d Subject="Welcome to Acme" \
--data-urlencode HTMLContent='<p>Welcome aboard.</p>'
{ "Success": true, "ErrorCode": 0, "EmailID": 42 }
Errors: 1 missing name, 2 missing subject, 3 invalid ContentType, 4 invalid Mode, 5 invalid ImageEmbedding.
useremailtemplates.get
GET /api/v1/useremailtemplates.
| Parameter | Description |
|---|---|
OrderField |
CreatedAt or EmailName |
OrderType |
ASC or DESC |
Limit |
1 to 100. Default 25 |
Offset |
|
fields |
Comma-separated columns to return |
curl -G https://app.emailmarketer.io/api/v1/useremailtemplates \
-d APIKey="$EM_API_KEY" \
-d Limit=50
{ "Success": true, "ErrorCode": 0, "TotalEmailTemplateCount": 3, "EmailTemplates": [{ "EmailID": 42, "EmailName": "Welcome", "Subject": "Welcome to Acme", "ContentType": "HTML", "CreatedAt": "..." }] }
Other commands
| Command | Path | Required | Optional | Returns | Errors |
|---|---|---|---|---|---|
useremailtemplate.get |
GET /api/v1/useremailtemplate |
EmailID |
none | EmailTemplate with content and Attachments |
1 missing, 2 not a number, 3 not found |
useremailtemplate.update |
PATCH /api/v1/useremailtemplate |
EmailID |
Same fields as create | Success |
1, 2, 3 to 5 invalid values, 6 not found |
useremailtemplate.delete |
DELETE /api/v1/useremailtemplate |
EmailID (comma-separated allowed) |
none | DeletedCount |
1 missing |
useremailtemplate.copy |
POST /api/v1/useremailtemplate.copy |
EmailID |
none | New EmailID, EmailName |
1, 2, 3 |
useremailtemplate.preview |
POST /api/v1/useremailtemplate.preview |
EmailTemplateID |
SampleData (object of merge tag values), IncludeBranding (default true) |
HTMLContent, PlainContent |
1 to 3, 4 SampleData is not an object, 5 a value is not text or a number, 6 invalid IncludeBranding |
Examples:
# useremailtemplate.get
curl -G https://app.emailmarketer.io/api/v1/useremailtemplate \
-d APIKey="$EM_API_KEY" \
-d EmailID=42
# useremailtemplate.update
curl -X PATCH https://app.emailmarketer.io/api/v1/useremailtemplate \
-H "Content-Type: application/json" \
-d '{ "APIKey": "'"$EM_API_KEY"'", "EmailID": 42, "Subject": "Welcome to Acme, Jane" }'
# useremailtemplate.delete
curl -X DELETE -G https://app.emailmarketer.io/api/v1/useremailtemplate \
-d APIKey="$EM_API_KEY" \
-d EmailID=42,43
# useremailtemplate.copy
curl https://app.emailmarketer.io/api/v1/useremailtemplate.copy \
-d APIKey="$EM_API_KEY" \
-d EmailID=42
# useremailtemplate.preview
curl https://app.emailmarketer.io/api/v1/useremailtemplate.preview \
-d APIKey="$EM_API_KEY" \
-d EmailTemplateID=42
Templates for transactional email
The TemplateID field of Send email uses a separate set of templates, managed with the email.template.* commands. The template body replaces HTMLContent and PlainContent. The subject always comes from the send request.
| Command | Path | Required | Optional | Returns | Errors |
|---|---|---|---|---|---|
email.template.create |
POST /api/v1/email.template.create |
TemplateName, plus TemplateHTMLContent or TemplatePlainContent |
TemplateDescription, TemplateSubject |
TemplateID |
1 missing name, 2 no content |
email.templates.get |
GET /api/v1/email.templates.get |
none | none | TotalTemplateCount, Templates |
none documented |
email.template.get |
GET /api/v1/email.template.get |
TemplateID |
none | Template with name, subject and content |
1 missing, 2 not found, 3 access denied |
email.template.update |
POST /api/v1/email.template.update |
TemplateID |
TemplateName, TemplateDescription, TemplateSubject, TemplateHTMLContent, TemplatePlainContent, ClearFields (comma-separated) |
Success |
1 missing, 2 not found, 3 invalid ClearFields, 4 no content would be left |
email.template.delete |
POST /api/v1/email.template.delete |
Templates (comma-separated IDs) |
none | Success |
1 missing, 2 none found |
Examples:
# email.template.create
curl https://app.emailmarketer.io/api/v1/email.template.create \
-d APIKey="$EM_API_KEY" \
-d TemplateName=Receipt \
--data-urlencode TemplateHTMLContent='<p>Thanks for your order.</p>'
# email.templates.get
curl -G https://app.emailmarketer.io/api/v1/email.templates.get \
-d APIKey="$EM_API_KEY"
# email.template.get
curl -G https://app.emailmarketer.io/api/v1/email.template.get \
-d APIKey="$EM_API_KEY" \
-d TemplateID=5
# email.template.update
curl https://app.emailmarketer.io/api/v1/email.template.update \
-d APIKey="$EM_API_KEY" \
-d TemplateID=5 \
-d TemplateName="Order receipt"
# email.template.delete
curl https://app.emailmarketer.io/api/v1/email.template.delete \
-d APIKey="$EM_API_KEY" \
-d Templates=5,6