SMTP API

This API is only for transactional emails.
Version 1.2



Send transactional message


Request Parameters:
Name Example Value Default Value Description Type Data Type Required
subject Example text Subject body string(200)
group your-group null Group code body string(100)
sender Sender body array
sender: email company@example.com Sender email body string(100)
sender: name Your Company null Sender name body string(100)
plan_time 2016-06-22T10:46:06+02:00 NOW Scheduled start of sending body ISO8601
recipients empty Recipients body array
recipients[n]: email john.doe@example.com Recipient email body string(100)
recipients[n]: create true false Add subscriber to client's profile body boolean
recipients[n]: fields true empty Merge tag fields body boolean
recipients[n]: fields: [key] socks_size Merge tag field - key body string [a-zA-Z0-9_]
recipients[n]: fields[key]: value 59 inches Merge tag field - value body
content Content body array
content: type plaintext html Body type body string
content: body <html></html> Content body body string
content: text Your text vesrion null Text version (only for HTML type) body string
attachments empty Attachments body array
attachments[n]: name your-file.txt File name in UTF-8 encoding body string
attachments[n]: crc d1bf8fc6af9166875316587ad697a719 Content check sum MD5 body string
attachments[n]: content_type text/plain Content type body string
attachments[n]: content YmxhYmxhYmxhCg== Content - Base64 body string
Request Example:
{
    "subject": "My Transaction Message",
    "group": "my-group",
    "sender": {
        "email": "company@example.com",
        "name": "My Company"
    },
    "recipients": [
        {
            "email": "john.doe@example.com",
            "create": false,
            "fields": {
                "name": "John Doe",
                "socks_size": "59 em"
            }
        },
        {
            "email": "mike.johnson@example.com",
            "create": false,
            "fields": {
                "name": "Mike Johnson",
                "socks_size": "23 em"
            }
        }
    ],
    "content": {
        "type": "html",
        "body": "<html><body><h1>Hello {{fields.name}},<\/h1><a href=\"https:\/\/clevermonitor.com\">Lorem ipsum dolor!<\/a>{{url(\"sign-out\", \"Sign out\")}}<\/body><\/html>",
        "text": "Lorem ipsum dolor"
    },
    "attachments": [
        {
            "name": "example.txt",
            "crc": "d1bf8fc6af9166875316587ad697a719",
            "content_type": "text\/plain",
            "content": "YmxhYmxhYmxhCg=="
        },
        {
            "name": "example_2.txt",
            "crc": "d1bf8fc6af9166875316587ad697a719",
            "content_type": "text\/plain",
            "content": "YmxhYmxhYmxhCg=="
        }
    ]
}
Example Request URL:
https://smtpapi.clevermonitor.com/v1.2/message
Response Parameters:
Name Data Type Reference Description
success array Success
success[n]: message_id string(38) Message ID
success[n]: status string(20) transaction_status Status
success[n]: create_time ISO8601 Timestamp of creation
success[n]: plan_time ISO8601 Scheduled start of sending
success[n]: subject string(200) Subject
success[n]: sender array Sender
success[n]: sender: email string(100) Sender email
success[n]: sender: name string(100) Sender name
success[n]: recipient array Recipient
success[n]: recipient: email string(100) Recipient email
success[n]: content array Content
success[n]: content: type string [html, plaintext] Body type
success[n]: fields array Merge tag fields
success[n]: fields: [key] string Merge tag field - key
success[n]: fields[key]: value string Merge tag field - value
success[n]: attachments array Attachments
success[n]: attachments[n]: name string File name
success[n]: attachments[n]: crc string Content check sum MD5
success[n]: attachments[n]: content_type string Content type
error array Blacklisted email addresses
error: [n] string Email
Response Messages:
Code Status Example Body
200 OK
{
    "success": [
        {
            "message_id": "58dce463f342cb3124002077",
            "subject": "My Transaction Message",
            "group": "my-group",
            "content": {
                "type": "html"
            },
            "status": "SCHEDULED",
            "create_time": "2017-03-30T10:56:35+00:00",
            "sender": {
                "email": "company@example.com",
                "name": "My Company"
            },
            "plan_time": "2017-03-30T10:56:35+00:00",
            "recipient": {
                "email": "john.doe@example.com",
                "added": false
            },
            "fields": {
                "name": "John Doe",
                "socks_size": "59 em"
            },
            "attechments": [
                {
                    "name": "example.txt",
                    "crc": "d1bf8fc6af9166875316587ad697a719",
                    "content_type": "text\/plain"
                },
                {
                    "name": "example_2.txt",
                    "crc": "d1bf8fc6af9166875316587ad697a719",
                    "content_type": "text\/plain"
                }
            ]
        }
    ],
    "error": [
        "mike.johnson@example.com"
    ]
}

List of transactional messages in client's profile


Request Parameters:
Name Example Value Default Value Description Type Data Type Required
group your-group null(Main Group) Messages group query string(100)
status scheduled all Message status query reference: transaction_status
count 100 100 Record limit query integer(max. 100)
offset 0 0 Record offset query integer
Example Request URL:
https://smtpapi.clevermonitor.com/v1.2/message/overview/?status=scheduled&count=10&offset=0
Response Parameters:
Name Data Type Reference Description
message_id string(38) Message ID
group string(100) Message group
status string(20) transaction_status Status
create_time ISO8601 Timestamp of creation
plan_time ISO8601 Scheduled start of sending
sent_time ISO8601 Time of sending
subject string(200) Subject
sender array Sender
sender: email string(100) Sender email
sender: name string(100) Sender name
recipient array Recipient
recipient: email string(100) Recipient email
content array Content
content: type string [html, plaintext] Content type
fields array Merge tag fields
fields: [key] string Merge tag field - key
fields[key]: value string Merge tag field - value
Response Messages:
Code Status Example Body
200 OK
[
    {
        "message_id": "58dcc58bf342cb3124002055",
        "group": "my-group",
        "status": "SENDING",
        "create_time": "2017-03-30T08:44:59+00:00",
        "plan_time": "2017-03-30T08:44:59+00:00",
        "sent_time": null,
        "subject": "Test 1",
        "sender": {
            "email": "company@example.com",
            "name": "Company"
        },
        "recipient": {
            "email": "john.doe@example.com"
        },
        "fields": {
            "name": "John Doe",
            "socks_size": "59 em"
        },
        "content": {
            "type": "html"
        }
    },
    {
        "message_id": "58dcc706f342cb3124002069",
        "group": "my-group",
        "status": "SENT",
        "create_time": "2017-03-30T08:51:18+00:00",
        "plan_time": "2017-03-30T08:51:18+00:00",
        "sent_time": "2017-03-30T08:51:29+00:00",
        "subject": "Test 2",
        "sender": {
            "email": "company@example.com",
            "name": "Company"
        },
        "recipient": {
            "email": "mike.johnson@example.com"
        },
        "fields": {
            "name": "Mike Johnson",
            "socks_size": "24 em"
        },
        "content": {
            "type": "html"
        }
    }
]
204 NO CONTENT
null

Detail of transactional message


Request Parameters:
Name Example Value Default Value Description Type Data Type Required
id 58db989af342cb3124002047 Message ID path string(30)
Example Request URL:
https://smtpapi.clevermonitor.com/v1.2/message/58db989af342cb3124002047
Response Parameters:
Name Data Type Reference Description
message_id string(30) Message ID
subject string(200) Subject
group string(100) Group code
status string transaction_status Status
sender array Sender
sender: email string(100) Sender email
sender: name string(100) Sender name
plan_time ISO8601 Scheduled start of sending
sent_time ISO8601 Time of sending
create_time ISO8601 Time of creation
recipient array Recipient
recipient: email string(100) Recipient email
statistics array Statistics
statistics: undelivered array Undelivered
statistics: undelivered: time ISO8601 Undelivered time
statistics: undelivered: reason string Undelivered reason
statistics: unsubscribed ISO8601 Unsubscribed
statistics: spam ISO8601 SPAM
statistics: domain string(100) Domain
statistics: open_last ISO8601 Last open
statistics: open_count integer(5) Count of opens
statistics: click_last ISO8601 Last click
statistics: click_count integer(5) Count of clicks
Response Messages:
Code Status Example Body
200 OK
{
    "message_id": "58dcc706f342cb3124002069",
    "group": "my-group",
    "subject": "Your Message",
    "status": "SENT",
    "recipient": {
        "email": "john.doe@example.com"
    },
    "sender": {
        "email": "company@example.com",
        "name": "Company"
    },
    "create_time": "2017-03-30T08:51:18+00:00",
    "plan_time": "2017-03-30T08:51:18+00:00",
    "sent_time": "2017-03-30T08:51:29+00:00",
    "statistics": {
        "undelivered": {
            "time": null,
            "reason": null
        },
        "unsubscribed": null,
        "spam": null,
        "domain": "example.com",
        "open_last": "2017-03-30T10:37:02+00:00",
        "open_count": 1,
        "click_last": "2017-03-30T10:37:09+00:00",
        "click_count": 2
    }
}
404 Not Found
{
    "code": 404,
    "status": "error",
    "message": "Message not found!"
}

Message content


Request Parameters:
Name Example Value Default Value Description Type Data Type Required
id 58db989af342cb3124002047 Message ID path string(30)
Example Request URL:
https://smtpapi.clevermonitor.com/v1.2/message/58db989af342cb3124002047/content
Response Parameters:
Name Data Type Reference Description
message_id string(30) Message ID
subject string(200) Subject
status string transaction_status Status
create_time ISO8601 Time of creation
plan_time ISO8601 Scheduled start of sending
sent_time ISO8601 Time of sending
content array Content
content: type string [html, plaintext] Body type
content: body string Content body
content: text string Text version (only for HTML type)
fields array Merge tag fields
fields: [key] string Merge tag field - key
fields[key]: value string Merge tag field - value
Response Messages:
Code Status Example Body
200 OK
{
    "message_id": "58dcc706f342cb3124002069",
    "subject": "Your Message",
    "status": "SENT",
    "create_time": "2017-03-30T08:51:18+00:00",
    "plan_time": "2017-03-30T08:51:18+00:00",
    "sent_time": "2017-03-30T08:51:29+00:00",
    "content": {
        "type": "html",
        "body": "<html><body><h1>Hello {{fields.name}},<\/h1><a href=\"https:\/\/clevermonitor.com\">Lorem ipsum dolor!<\/a>{{url(\"sign-out\", \"Sign out\")}}<\/body><\/html>",
        "text": "Lorem ipsum dolor"
    },
    "fields": {
        "name": "John Doe",
        "socks_size": "59 em"
    }
}
404 Not Found
{
    "code": 404,
    "status": "error",
    "message": "Message not found!"
}

Delete transactional message


Request Parameters:
Name Example Value Default Value Description Type Data Type Required
id 58db989af342cb3124002047 null Message ID path string(30)
Example Request URL:
https://smtpapi.clevermonitor.com/v1.2/message/58db989af342cb3124002047
Response Parameters:
Name Data Type Reference Description
message_id string(30) Message ID
Response Messages:
Code Status Example Body
200 OK
{
    "message_id": "58db989af342cb3124002047"
}
404 Not Found
{
    "code": 404,
    "status": "error",
    "message": "Message not found!"
}

Copyright © CleverMonitor, 2017