# Email Template
Email template allows developers to send emails with similar content to different customers.
You can query, add, delete and modify templates with API.
# Query (Batch Query)
Basic information of returned email template
URL
https://api2.sendcloud.net/api/template/list
HTTP Request Method
post get
Parameter Description
parameter | type | required or not | description |
---|---|---|---|
apiUser | string | yes | API_USER |
apiKey | string | yes | API_KEY |
invokeName | string | no | name of calling email template |
templateType | int | no | type of email type: 0 (transactional), 1 (marketing) |
start | int | no | start position, [0-], defaults to 0 |
limit | int | no | amount, [0-100],defaults to 100 |
Request Example
https://api2.sendcloud.net/api/template/list?apiUser=***&apiKey=***&start=0&limit=3
Return Value Description
parameter | description |
---|---|
name | template name |
invokeName | name of the calling template |
templateType | template type |
gmtCreated | time of template creation |
gmtModified | time of template modification |
Returned Value Example
{
"info": {
"dataList": [
{
"name": "ifaxin bill",
"invokeName": "***",
"templateType": 1,
"templateStat": 1,
"gmtCreated": "2013-11-21 16:37:41",
"gmtUpdated": "2015-06-12 19:44:07"
},
{
"name": "ifaxin retrieve password ",
"invokeName": "***",
"templateType": 0,
"templateStat": 1,
"gmtCreated": "2013-11-21 16:39:53",
"gmtUpdated": "2013-11-21 16:39:53"
}
],
"total": 42,
"count": 2
},
"statusCode": 200,
"message": "request was successful",
"result": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Query
Detailed information of returned email template
URL
https://api2.sendcloud.net/api/template/get
HTTP Request Method
post get
Parameter Description
parameter | type | required or not | description |
---|---|---|---|
apiUser | string | yes | API_USER |
apiKey | string | yes | API_KEY |
invokeName | string | yes | name of the calling email template |
Request Example
https://api2.sendcloud.net/api/template/get?apiUser=***&apiKey=***&invokeName=test
Return Value Description
parameter | description |
---|---|
name | template name |
invokeName | name of the calling template |
templateType | template type |
gmtCreated | time of template creation |
gmtModified | time of template modification |
html | template content |
contentSummary | summary of email content |
subject | summary of email content |
Returned Value Example
{
"statusCode": 200,
"info": {
"data": {
"name": "SendCloud",
"invokeName": "15_invoke_2",
"templateType": 0,
"templateStat": 1,
"gmtCreated": "2015-02-02 17:01:43",
"gmtUpdated": "2015-04-16 15:04:12",
"html": "<p>Wonderful! You’ve successfully sent the first testing email through SendCloud. Next, please log in to complete your account information.
</p>\n",
"subject": "The first Email from SendCloud!",
"contentSummary":"shesh"
}
},
"message": "request was successful",
"result": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Add
URL
https://api2.sendcloud.net/api/template/add
HTTP Request Method
post get
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | yes | API_USER |
apiKey | string | yes | API_KEY |
invokeName | string | yes | name of the calling template |
name | string | yes | template name |
html | string | yes | content in html format |
text | string | no | content in html format |
subject | string | yes | template subject |
templateType | int | yes | template type: 0 (triggered), 1 (bulk) |
Tips:
- Variables (opens new window) are allowed in html content.
- post is required when html content is too long or contains special characters.
- Templates should not be more than 1,000.
Request Example
curl -d 'apiUser=***&apiKey=***&invokeName=testtemplate&name=test&html=<p>add new template</p>&subject=test_subject&templateType=1' http://api2.sendcloud.net/api/template/add
Returned Value Description
parameter | description |
---|---|
name | template name |
invokeName | name of the calling template |
templateType | template type |
gmtCreated | time of template creation |
gmtModified | time of template modification |
html | template content |
subject | template subject |
Returned Value Example
{
"statusCode": 200,
"info": {
"data": {
"name": "test",
"invokeName": "testtemplate",
"templateType": 0,
"templateStat": 0,
"gmtCreated": "2015-10-16 10:42:01",
"gmtUpdated": "",
"html": "<p>add new template</p>",
"subject": "test_subject"
}
},
"message": "request was successful",
"result": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Delete
URL
https://api2.sendcloud.net/api/template/delete
Parameter Description
post get
Parameter Description
parameter | type | required or not | description |
---|---|---|---|
apiUser | string | yes | API_USER |
apiKey | string | yes | API_KEY |
invokeName | string | yes | name of the calling template |
Request Example
curl http://api2.sendcloud.net/api/template/delete?apiUser=***&apiKey=***&invokeName=test
Returned Value Description
parameter | description |
---|---|
count | count of deleted templates |
Returned Value Example
{
"statusCode": 200,
"message": "request was successful",
"result": true,
"info": {
"count": 1
}
}
2
3
4
5
6
7
8
9
10
# Modification
Name, content, subject and type of the template can be modified.
URL
https://api2.sendcloud.net/api/template/update
HTTP Request Method
post get
parameter | type | required or not | description |
---|---|---|---|
apiUser | string | yes | API_USER |
apiKey | string | yes | API_KEY |
invokeName | string | yes | name of the calling template |
name | string | no | template name |
html | string | no | content in html format |
subject | string | no | template subject |
templateType | int | no | template type: 0 (transactional), 1 (marketing) |
Tips:
- Variables (opens new window)are allowed in html content.
- post request is required when html content is too long or contains
Request Example
curl -d 'apiUser=***&apiKey=***&invokeName=testtemplate&name=test&html=<p>update template</p>&subject=test&templateType=1' http://api2.sendcloud.net/api/template/update
Request Example
parameter | description |
---|---|
count | count of modified templates |
Returned Value Example
{
"statusCode": 200,
"message": "request was successful",
"result": true,
"info": {
"count": 1
}
}
2
3
4
5
6
7
8