Emails
Email API mainly allows you to send emails to all over the world. You can also create or delete email templates, get clicks, opens and statuses on your emails and more. * * There are two ways to send emails using our API: * - transactional email API that allows you to send emails to a single or an array of email addresses * - email campaigns that allows you to send emails to created group through API or account panel
Use this method to list all created email templates.
The number of items omitted from the beginning of the list. Default ‘0’.
0
The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.
100
The smtp account name.
1.test.smtp
The unique ID of the object you are looking for.
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.messageflow.com/v2.1/email/template?offset=0&limit=100&smtpAccount=1.test.smtp&externalId=<string>");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
},
"data": [
{
"createdAt": "text",
"html": "text",
"text": "text",
"name": "text",
"externalId": "text",
"smtpAccount": "text"
}
]
}
Use this method to add email template which you can use with the Send emails method.
The HTML content of your message.
The plain text content of your message.
The name of the new template.
The unique ID of the new template. If you won’t add it the externalId will be generated in the response.
The name of your smtp account you want the new template to be saved on.
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "{\"html\":\"\",\"text\":\"\",\"name\":\"\",\"externalId\":\"\",\"smtpAccount\":\"\"}";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.messageflow.com/v2.1/email/template");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}
Use this method to delete email templates.
The unique ID of the template.
XXX-XXX
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "{\"externalId\":[\"XXX-XXX\"]}";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.messageflow.com/v2.1/email/template");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}
Use this method to get email statistics.
The name of your smtp account.
1.test.smtp
The start date of the range as timestamp.
The end date of the range as timestamp.
This field indicates whether the data should be aggregated by tags or not ( 1 - with aggregation, 0 - no aggregation ).
1
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.messageflow.com/v2.1/email/aggregate?smtpAccount=1.test.smtp&dateFrom=<string>&dateTo=<string>&withTags=1");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}
Use this method to get details of clicks such as date, IP, browser, operation system and more. Please remember the clicks are stored for 7 days.
The number of items omitted from the beginning of the list. Default ‘0’.
0
The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.
100
Search with date. Use RFC 3339 standard or simpler "YYYY-MM-DD hh:mm:ii" format. The difference between dateTo and dateFrom cannot be more than 3 days.
2025-01-03 00:00:00
Search with date. Use RFC 3339 standard or simpler "YYYY-MM-DD hh:mm:ii" format. The difference between dateTo and dateFrom cannot be more than 3 days.
2025-01-01 00:00:00
The smtp account name.
1.test.smtp
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.messageflow.com/v2.1/email/click?offset=0&limit=100&dateTo=2025-01-03 00:00:00&dateFrom=2025-01-01 00:00:00&smtpAccount=1.test.smtp&[email protected]");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
},
"data": [
{
"messageId": "text",
"date": "text",
"to": "text",
"smtpAccount": "text",
"ip": "text",
"browser": "text",
"os": "text",
"userAgent": "text",
"link": "text"
}
]
}
Use this method to get details of the email with statuses such as injected, ok, softbounce, hardbounce, spambounce, deffered and dropped. By default, you can only access data from the last week
The number of items omitted from the beginning of the list. Default ‘0’.
0
The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.
100
The smtp account name.
1.test.smtp
Search with date. Use RFC 3339 standard or simpler "YYYY-MM-DD hh:mm:ii" format. The farthest date is specified by the TTL of your account (which is 1 week by default).
2025-01-01 00:00:00
Search with date. Use RFC 3339 standard or simpler "YYYY-MM-DD hh:mm:ii" format.
2025-01-03 00:00:00
List of tags that searched emails must have. You can add up to 10 tags separated by ",".
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.messageflow.com/v2.1/email?offset=0&limit=100&smtpAccount=1.test.smtp&[email protected]&[email protected]&dateFrom=2025-01-01 00:00:00&dateTo=2025-01-03 00:00:00&tags=<string>");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
},
"data": [
{
"subject": "text",
"smtpAccount": "1.test.smtp",
"tags": [
"text"
],
"to": [
{
"email": "[email protected]",
"name": "Test sender",
"messageId": "[email protected]"
}
],
"from": {
"email": "text",
"name": "text"
},
"status": "text",
"statusTime": 1,
"statusDesc": "text",
"allStatuses": [
{
"status": "text",
"statusTime": 1,
"statusDesc": "text"
}
]
}
]
}
Send new email through transactional API which means that you can send email to a single email address or an array of email addresses. You can send the message to a maximum of 200 recipients. The entire query should not exceed 15 MB, and should not exceed 10 000 elements. If you want to send email to a group created through Create group method please use Send email campaign. Link tracking is enabled by default, you can disable it by adding a header {"X-TRACKING-OFF":1}
Object passed when sending emails.
The subject of the message.
Test email subject
The smtp account name the email will be sent from.
1.test.smtp
The values to tag the message with. Tags can be non-unique.
test-tag
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "{\"subject\":\"Test email subject\",\"smtpAccount\":\"1.test.smtp\",\"tags\":[\"test-tag\"],\"content\":[],\"bcc\":[[]],\"cc\":[[]],\"from\":[],\"replyTo\":[],\"headers\":{\"X-TEST-HEADER\":\"val\"},\"globalVars\":{\"sex\":\"unknown\",\"hasNewsletter\":false,\"promos\":{\"1\":{\"name\":\"test40\",\"value\":300},\"2\":{\"name\":\"test800\",\"value\":3008}},\"footer\":\"<div><strong>crazy footer<\\/strong><\\/div>\"},\"to\":[[]],\"attachments\":[[]]}";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.messageflow.com/v2.1/email");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
},
"data": [
{
"subject": "text",
"smtpAccount": "1.test.smtp",
"tags": [
"text"
],
"to": [
{
"email": "[email protected]",
"name": "Test sender",
"messageId": "[email protected]"
}
],
"from": {
"email": "text",
"name": "text"
},
"status": "text",
"statusTime": 1,
"statusDesc": "text",
"allStatuses": [
{
"status": "text",
"statusTime": 1,
"statusDesc": "text"
}
]
}
]
}
Use this method to get details of email opens such as date, IP, browser, operation system and more. Please remember the opens are stored for 7 days.
The number of items omitted from the beginning of the list. Default ‘0’.
0
The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.
100
Search with date. Use RFC 3339 standard or simpler "YYYY-MM-DD hh:mm:ii" format. The difference between dateTo and dateFrom cannot be more than 3 days.
2025-01-03 00:00:00
Search with date. Use RFC 3339 standard or simpler "YYYY-MM-DD hh:mm:ii" format. The difference between dateTo and dateFrom cannot be more than 3 days.
2025-01-01 00:00:00
The smtp account name.
1.test.smtp
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.messageflow.com/v2.1/email/open?offset=0&limit=100&dateTo=2025-01-03 00:00:00&dateFrom=2025-01-01 00:00:00&smtpAccount=1.test.smtp&[email protected]");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
},
"data": [
{
"messageId": "text",
"date": "text",
"to": "text",
"smtpAccount": "text",
"ip": "text",
"browser": "text",
"os": "text",
"userAgent": "text"
}
]
}
Use this method to list details of the smtp account such as smtp name, smtp type and vps connected to your account.
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Options, "https://api.messageflow.com/v2.1/email/smtpAccount");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
},
"data": [
{
"smtpAccount": "text",
"smtpName": "text",
"smtpType": "text",
"vps": [
{
"vpsName": "text",
"host": "text",
"vpsType": "text",
"ip": "text"
}
]
}
]
}