Web API v1.73
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
All UniOne API methods require HTTPS connection. UniOne accepts HTTP POST requests in JSON format up to 10 megabytes long and returns HTTP response also in JSON. API endpoint (or base URL) depends on which datacenter the user is registered at.
-
https://us1.unione.io/en/transactional/api/v1 - UniOne USA & Canada Instance
-
https://eu1.unione.io/en/transactional/api/v1 - UniOne European Instance
Authentication
Every method call requires authentication by providing user API key or project API key in either of two places:
- X-API-KEY HTTP header
- api_key JSON field
You can obtain user API key in account settings. Project API key can be obtained using Projects page or by project API methods.
Error Handling
UniOne API method call returns HTTP code 200 OK on success or HTTP code 4xx/5xx on error:
HTTP Code | Meaning |
---|---|
200 | OK – Request was successfully processed. |
400 | Bad Request – Your request is invalid. Please check request format and parameters. |
401 | Unauthorized – Your API key is wrong. |
403 | Forbidden – Not enough rights to process the request. |
404 | Not Found – The specified endpoint not found. |
413 | Request Entity Too Large – Request size is too large, reduce size to 10 MB. |
429 | Too Many Requests – Please slow down request rate. |
50x | Internal Server Error – We had a problem with our server (might be 500, 502, 503 etc.). Please try again later. |
HTTP error code gives generic information about error reason, but usually a JSON object is returned also with more details and API error code. Read more in API Errors section.
Email Methods
This group of methods is related with email sending.
email-send
POST https://us1.unione.io/en/transactional/api/v1/email/send.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"message": {
"recipients": [
{
"email": "user@example.com",
"substitutions": {
"CustomerId": 12452,
"to_name": "John Smith"
},
"metadata": {
"campaign_id": "c77f4f4e-3561-49f7-9f07-c35be01b4f43",
"customer_hash": "b253ac7"
}
}
],
"template_id": "string",
"tags": [
"string1"
],
"skip_unsubscribe": 0,
"global_language": "string",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"bypass_global": 0,
"bypass_unavailable": 0,
"bypass_unsubscribed": 0,
"bypass_complained": 0,
"idempotence_key": "SG1VsbG68sIH2dvc5mx890kIQ",
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
],
"options": {
"send_at": "2021-11-19 10:00:00",
"unsubscribe_url": "https://example.org/unsubscribe/{{CustomerId}}",
"custom_backend_id": 0,
"smtp_pool_id": "string"
}
}
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"message" => [
"recipients" => [
[
"email" => "user@example.com",
"substitutions" => [
"CustomerId" => 12452,
"to_name" => "John Smith"
],
"metadata" => [
"campaign_id" => "c77f4f4e-3561-49f7-9f07-c35be01b4f43",
"customer_hash" => "b253ac7"
]
]
],
"template_id" => "string",
"tags" => [
"string1"
],
"skip_unsubscribe" => 0,
"global_language" => "string",
"template_engine" => "simple",
"global_substitutions" => [
"property1" => "string",
"property2" => "string"
],
"global_metadata" => [
"property1" => "string",
"property2" => "string"
],
"body" => [
"html" => "<b>Hello, {{to_name}}</b>",
"plaintext" => "Hello, {{to_name}}",
"amp" => "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body[visibility:hidden]</style></head><body> Hello, AMP4EMAIL world.</body></html>"
],
"subject" => "string",
"from_email" => "user@example.com",
"from_name" => "John Smith",
"reply_to" => "user@example.com",
"reply_to_name" => "John Smith",
"track_links" => 0,
"track_read" => 0,
"bypass_global" => 0,
"bypass_unavailable" => 0,
"bypass_unsubscribed" => 0,
"bypass_complained" => 0,
"idempotence_key" => "SG1VsbG68sIH2dvc5mx890kIQ",
"headers" => [
"X-MyHeader" => "some data",
"List-Unsubscribe" => "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
],
"attachments" => [
[
"type" => "text/plain",
"name" => "readme.txt",
"content" => "SGVsbG8sIHdvcmxkIQ=="
]
],
"inline_attachments" => [
[
"type" => "image/gif",
"name" => "IMAGECID1",
"content" => "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
]
],
"options" => [
"send_at" => "2021-11-19 10:00:00",
"unsubscribe_url" => "https://example.org/unsubscribe/{{CustomerId}}",
"custom_backend_id" => 0,
"smtp_pool_id" => "string"
]
]
];
try {
$response = $client->request('POST','email/send.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"message": {
"recipients": [
{
"email": "user@example.com",
"substitutions": {
"CustomerId": 12452,
"to_name": "John Smith"
},
"metadata": {
"campaign_id": "c77f4f4e-3561-49f7-9f07-c35be01b4f43",
"customer_hash": "b253ac7"
}
}
],
"template_id": "string",
"tags": [
"string1"
],
"skip_unsubscribe": 0,
"global_language": "string",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"bypass_global": 0,
"bypass_unavailable": 0,
"bypass_unsubscribed": 0,
"bypass_complained": 0,
"idempotence_key": "SG1VsbG68sIH2dvc5mx890kIQ",
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
],
"options": {
"send_at": "2021-11-19 10:00:00",
"unsubscribe_url": "https://example.org/unsubscribe/{{CustomerId}}",
"custom_backend_id": 0,
"smtp_pool_id": "string"
}
}
}
r = requests.post(base_url+'/email/send.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"message" => {
"recipients" => [
{
"email" => "user@example.com",
"substitutions" => {
"CustomerId" => 12452,
"to_name" => "John Smith"
},
"metadata" => {
"campaign_id" => "c77f4f4e-3561-49f7-9f07-c35be01b4f43",
"customer_hash" => "b253ac7"
}
}
],
"template_id" => "string",
"tags" => [
"string1"
],
"skip_unsubscribe" => 0,
"global_language" => "string",
"template_engine" => "simple",
"global_substitutions" => {
"property1" => "string",
"property2" => "string"
},
"global_metadata" => {
"property1" => "string",
"property2" => "string"
},
"body" => {
"html" => "<b>Hello, {{to_name}}</b>",
"plaintext" => "Hello, {{to_name}}",
"amp" => "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject" => "string",
"from_email" => "user@example.com",
"from_name" => "John Smith",
"reply_to" => "user@example.com",
"reply_to_name" => "John Smith",
"track_links" => 0,
"track_read" => 0,
"bypass_global" => 0,
"bypass_unavailable" => 0,
"bypass_unsubscribed" => 0,
"bypass_complained" => 0,
"idempotence_key" => "SG1VsbG68sIH2dvc5mx890kIQ",
"headers" => {
"X-MyHeader" => "some data",
"List-Unsubscribe" => "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments" => [
{
"type" => "text/plain",
"name" => "readme.txt",
"content" => "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments" => [
{
"type" => "image/gif",
"name" => "IMAGECID1",
"content" => "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
],
"options" => {
"send_at" => "2021-11-19 10:00:00",
"unsubscribe_url" => "https://example.org/unsubscribe/{{CustomerId}}",
"custom_backend_id" => 0,
"smtp_pool_id" => "string"
}
}
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/email/send.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"message\": {"
+" \"recipients\": ["
+" {"
+" \"email\": \"user@example.com\","
+" \"substitutions\": {"
+" \"CustomerId\": 12452,"
+" \"to_name\": \"John Smith\""
+" },"
+" \"metadata\": {"
+" \"campaign_id\": \"c77f4f4e-3561-49f7-9f07-c35be01b4f43\","
+" \"customer_hash\": \"b253ac7\""
+" }"
+" }"
+" ],"
+" \"template_id\": \"string\","
+" \"tags\": ["
+" \"string1\""
+" ],"
+" \"skip_unsubscribe\": 0,"
+" \"global_language\": \"string\","
+" \"template_engine\": \"simple\","
+" \"global_substitutions\": {"
+" \"property1\": \"string\","
+" \"property2\": \"string\""
+" },"
+" \"global_metadata\": {"
+" \"property1\": \"string\","
+" \"property2\": \"string\""
+" },"
+" \"body\": {"
+" \"html\": \"<b>Hello, {{to_name}}</b>\","
+" \"plaintext\": \"Hello, {{to_name}}\","
+" \"amp\": \"<!doctype html><html amp4email><head> <meta charset=\\\"utf-8\\\"><script async src=\\\"https://cdn.ampproject.org/v0.js\\\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>\""
+" },"
+" \"subject\": \"string\","
+" \"from_email\": \"user@example.com\","
+" \"from_name\": \"John Smith\","
+" \"reply_to\": \"user@example.com\","
+" \"reply_to_name\": \"John Smith\","
+" \"track_links\": 0,"
+" \"track_read\": 0,"
+" \"bypass_global\": 0,"
+" \"bypass_unavailable\": 0,"
+" \"bypass_unsubscribed\": 0,"
+" \"bypass_complained\": 0,"
+" \"idempotence_key\": \"SG1VsbG68sIH2dvc5mx890kIQ\","
+" \"headers\": {"
+" \"X-MyHeader\": \"some data\","
+" \"List-Unsubscribe\": \"<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>\""
+" },"
+" \"attachments\": ["
+" {"
+" \"type\": \"text/plain\","
+" \"name\": \"readme.txt\","
+" \"content\": \"SGVsbG8sIHdvcmxkIQ==\""
+" }"
+" ],"
+" \"inline_attachments\": ["
+" {"
+" \"type\": \"image/gif\","
+" \"name\": \"IMAGECID1\","
+" \"content\": \"R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw==\""
+" }"
+" ],"
+" \"options\": {"
+" \"send_at\": \"2021-11-19 10:00:00\","
+" \"unsubscribe_url\": \"https://example.org/unsubscribe/{{CustomerId}}\","
+" \"custom_backend_id\": 0,"
+" \"smtp_pool_id\": \"string\""
+" }"
+" }"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("email/send.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/email/send.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"message\": {"
+" \"recipients\": ["
+" {"
+" \"email\": \"user@example.com\","
+" \"substitutions\": {"
+" \"CustomerId\": 12452,"
+" \"to_name\": \"John Smith\""
+" },"
+" \"metadata\": {"
+" \"campaign_id\": \"c77f4f4e-3561-49f7-9f07-c35be01b4f43\","
+" \"customer_hash\": \"b253ac7\""
+" }"
+" }"
+" ],"
+" \"template_id\": \"string\","
+" \"tags\": ["
+" \"string1\""
+" ],"
+" \"skip_unsubscribe\": 0,"
+" \"global_language\": \"string\","
+" \"template_engine\": \"simple\","
+" \"global_substitutions\": {"
+" \"property1\": \"string\","
+" \"property2\": \"string\""
+" },"
+" \"global_metadata\": {"
+" \"property1\": \"string\","
+" \"property2\": \"string\""
+" },"
+" \"body\": {"
+" \"html\": \"<b>Hello, {{to_name}}</b>\","
+" \"plaintext\": \"Hello, {{to_name}}\","
+" \"amp\": \"<!doctype html><html amp4email><head> <meta charset=\\\"utf-8\\\"><script async src=\\\"https://cdn.ampproject.org/v0.js\\\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>\""
+" },"
+" \"subject\": \"string\","
+" \"from_email\": \"user@example.com\","
+" \"from_name\": \"John Smith\","
+" \"reply_to\": \"user@example.com\","
+" \"reply_to_name\": \"John Smith\","
+" \"track_links\": 0,"
+" \"track_read\": 0,"
+" \"bypass_global\": 0,"
+" \"bypass_unavailable\": 0,"
+" \"bypass_unsubscribed\": 0,"
+" \"bypass_complained\": 0,"
+" \"idempotence_key\": \"SG1VsbG68sIH2dvc5mx890kIQ\","
+" \"headers\": {"
+" \"X-MyHeader\": \"some data\","
+" \"List-Unsubscribe\": \"<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>\""
+" },"
+" \"attachments\": ["
+" {"
+" \"type\": \"text/plain\","
+" \"name\": \"readme.txt\","
+" \"content\": \"SGVsbG8sIHdvcmxkIQ==\""
+" }"
+" ],"
+" \"inline_attachments\": ["
+" {"
+" \"type\": \"image/gif\","
+" \"name\": \"IMAGECID1\","
+" \"content\": \"R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw==\""
+" }"
+" ],"
+" \"options\": {"
+" \"send_at\": \"2021-11-19 10:00:00\","
+" \"unsubscribe_url\": \"https://example.org/unsubscribe/{{CustomerId}}\","
+" \"custom_backend_id\": 0,"
+" \"smtp_pool_id\": \"string\""
+" }"
+" }"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"message": {
"recipients": [
{
"email": "user@example.com",
"substitutions": {
"CustomerId": 12452,
"to_name": "John Smith"
},
"metadata": {
"campaign_id": "c77f4f4e-3561-49f7-9f07-c35be01b4f43",
"customer_hash": "b253ac7"
}
}
],
"template_id": "string",
"tags": [
"string1"
],
"skip_unsubscribe": 0,
"global_language": "string",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"bypass_global": 0,
"bypass_unavailable": 0,
"bypass_unsubscribed": 0,
"bypass_complained": 0,
"idempotence_key": "SG1VsbG68sIH2dvc5mx890kIQ",
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
],
"options": {
"send_at": "2021-11-19 10:00:00",
"unsubscribe_url": "https://example.org/unsubscribe/{{CustomerId}}",
"custom_backend_id": 0,
"smtp_pool_id": "string"
}
}
};
fetch('https://us1.unione.io/en/transactional/api/v1/email/send.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/email/send.json
Sends an email or a bunch of emails
While sending you can provide substitutions (merge tags), use a template, turn on read or click tracking, etc.
Restrictions:
- maximum request size is 10 MB
- maximum number of recipients is 500
- The symbol ‘/’ is not allowed in attachment names
If the list of recipients contains invalid, non-existent, duplicate, or unsubscribed emails, those emails will be returned in the output parameter failed_emails, and the email will be sent to all other valid emails addresses. If all the emails addresses fall into failed_emails, sending will not be carried out and API error 204 will be returned.
Parameters
Name | Type | Description |
---|---|---|
message | Required object |
Object containing all message properties. |
» recipients | Required array |
Contains recipient emails, substitutions(merge tags) and metadata. |
Required string(email) |
Recipient email | |
»» substitutions | Optional object |
Object to pass the substitutions(merge tags) for the recipient (e.g. recipient name, discount code, password change link, etc. See Template engines). The substitutions can be used in the following parameters:
|
»» metadata | Optional object |
Object for passing the metadata, such as “key”: “value”. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned by webhook and event-dump methods. If you pass strign up to 128 bit with “campaign_id” field name (name is configurable thru support), it will be considered as campaign identifier in statistics. |
» template_id | Optional string(uuid) |
Optional identifier of the template that had been created by template/set method. If template_id is passed then fields from the template are used instead of missed email/send parameters. E.g. if “body” parameter in email/send is omitted, “body” from template will be used. If “subject” in email/send is omitted, “subject” from template will be used. |
» tags | Optional array |
An array of strings. The maximum string length is 50 characters. You can include up to 4 strings which must be unique. No more than 10 000 tags are allowed per project; if you try to add more, email/send will return an error. You may use tags to categorize emails by your own criteria, and they will be passed along by event-dump methods. |
» skip_unsubscribe | Optional integer |
Whether to skip or not appending default unsubscribe footer. 1=skip, 0=append, default is 0. You should ask support to approve |
» global_language | Optional string |
The language of the unsubscribe footer and unsubscribe page. Languages supported are: “be”, “de”, “en”, “es”, “fr”, “it”, “pl”, “pt”, “ru”, “ua”, “kz”. |
» template_engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. |
» global_substitutions | Optional object |
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
|
» global_metadata | Optional object |
Object for passing the metadata common for all the recipients, such as “key”: “value”. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned by webhook. To group single emails into a campaign, you can use the system key ‘campaign_id’ with a value in the form of a non-negative decimal integer up to 128 bits or a UUID in the format ‘c7703772-453e-4c77-a9ae-9a1b94051b5a’. Incorrect values will be treated as ‘0’. |
» body | Required object |
Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required. |
»» html | Optional string |
HTML part of the email body |
»» plaintext | Optional string |
Plaintext part of the email body. |
»» amp | Optional string |
Optional AMP part of the email body. |
» subject | Required string |
Email subject. |
» from_email | Optional string(email) |
Sender’s email. Required only if template_id parameter is empty. |
» from_name | Optional string |
Sender’s name. |
» reply_to | Optional string |
Optional Reply-To email (in case it’s different to sender’s email) |
» reply_to_name | Optional string |
Optional Reply-To name (if reply_to email is specified and you want to display not only this email but also the name) |
» track_links | Optional integer |
1 = click tracking is on (default), 0 = click tracking is off. To use track_links = 0, you need to ask support to enable this feature. |
» track_read | Optional integer |
1 = read tracking is on (default), 0=read tracking is off. To use track_read = 0, you need to ask support to enable this feature. |
» bypass_global | Optional integer |
(allowed values 0 or 1, default 0) If set to 1, the global unavailability list will be ignored. Even if the address was found to be unreachable while sending other UniOne users’ emails, or its owner has issued complaints, the message will still be sent. The setting may be ignored for certain addresses. |
» bypass_unavailable | Optional integer |
(allowed values 0 or 1, default 0) If set to 1, the current user’s or project’s unavailability list will be ignored. Works only if bypass_global is set to 1. |
» bypass_unsubscribed | Optional integer |
(allowed values 0 or 1, default 0) If set to 1, the current list of unsubscribed addresses for this account or project will be ignored. Works only if bypass_global is set to 1. The setting is available only for users that have been granted the right to omit the unsubscribe link (to request, please contact support). |
» bypass_complained | Optional integer |
(allowed values 0 or 1, default 0) If set to 1, the user’s or project’s complaint list will be ignored. Works only if bypass_global is set to 1. The setting is available only for users that have been granted the right to omit the unsubscribe link (to request, please contact support). |
» idempotence_key | Optional string |
A string of up to 64 characters containing a unique message key. This can be used to prevent occasional message duplicates. If you send another API request with the same message key within the next minute, it will be declined. We can generate a message key for each letter automatically; to enable this option, please contact our tech support. |
» headers | Optional object |
Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are ignored, for example X-UNIONE-Global-Language, X-UNIONE-Template-Engine. Standard headers “To,” “CC,” and “BCC” are passed without the “X-.” Yet, they are processed in a particular way and, as a result, have a number of restrictions. You can find more details about it here. If our support have approved omitting standard unsubscription block for you, you can also pass List-Unsubscribe, List-Subscribe, List-Help, List-Owner, List-Archive, In-Reply-To and References headers. |
»» X-UNIONE-Global-Language | Optional string |
The language of the unsubscribe footer and unsubscribe page. Languages supported are: “be”, “de”, “en”, “es”, “fr”, “it”, “pl”, “pt”, “ru”, “ua”, “kz”. |
»» X-UNIONE-Template-Engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. Has a priority over the value allowed in the “template_engine” parameter. |
» attachments | Optional array |
Optional array of attachments |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment name in the format: “name.extension”. When multiple attachments are passed, their names must be unique. The symbol ‘/’ is not allowed in attachment names. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
» inline_attachments | Optional array |
Optional array of inline attachments, e.g. for including images in email instead of loading them from external URL. |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment content id. For example, “name”=“IMAGECID1” should be referenced in HTML like <img src=“cid:IMAGECID1”>. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
» options | Optional object |
Additional message options. |
»» send_at | Optional string |
Date and time in “YYYY-MM-DD hh:mm:ss” format in the UTC timezone. Allows schedule sending up to 24 hours in advance. |
»» unsubscribe_url | Optional string |
Custom unsubscribe link. Read more here. |
»» custom_backend_id | Optional integer |
Backend-domain identifier to send message with. If custom_backend_id is not set, default one for your account/project will be used. You can pay for one or more dedicated IPs and use this option. |
»» smtp_pool_id | Optional string(uuid) |
SMTP pool identifier to send message with. Usually you don’t need to pass this parameter because correct smtp_pool_id is selected automatically based on the default one for your account/project or according to custom_backend_id parameter. |
200 Response
{
"status": "success",
"job_id": "1ZymBc-00041N-9X",
"emails": [
"user@example.com"
],
"failed_emails": {
"email1@gmail.com": "temporary_unavailable",
"bad@address": "invalid",
"email@example.com": "duplicate",
"root@example.org": "permanent_unavailable",
"olduser@example.net": "unsubscribed"
}
}
Response Schema
HTTP Code 200:
Email successfully accepted for sending.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
job_id | Required string |
Job identifier, might be useful for investigating errors. |
emails | Optional array |
Array of recipients emails successfully accepted for sending. |
failed_emails | Optional object |
Object with emails rejected for sending as property names and their statuses as property values, e.g.: {“email1@gmail.com”: “temporary_unavailable”}. Possible statuses:
|
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
email-subscribe
POST https://us1.unione.io/en/transactional/api/v1/email/subscribe.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"from_email": "user@example.com",
"from_name": "string",
"to_email": "user@example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"from_email" => "user@example.com",
"from_name" => "string",
"to_email" => "user@example.com"
];
try {
$response = $client->request('POST','email/subscribe.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"from_email": "user@example.com",
"from_name": "string",
"to_email": "user@example.com"
}
r = requests.post(base_url+'/email/subscribe.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"from_email" => "user@example.com",
"from_name" => "string",
"to_email" => "user@example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/email/subscribe.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"from_email\": \"user@example.com\","
+" \"from_name\": \"string\","
+" \"to_email\": \"user@example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("email/subscribe.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/email/subscribe.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"from_email\": \"user@example.com\","
+" \"from_name\": \"string\","
+" \"to_email\": \"user@example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"from_email": "user@example.com",
"from_name": "string",
"to_email": "user@example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/email/subscribe.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/email/subscribe.json
Sends an email with (re)subscribe link.
This method allows subscription renewal by a former subscriber who has previously unsubscribed, or who is blocked because of complaints. This method sends an email with a new subscription link to a former subscriber. Once the recipient clicks the link, their subscription status is restored. There is a default restriction that limits this method to being used once a day. If you need to resubscribe more often, please ask support about it.
Parameters
Name | Type | Description |
---|---|---|
from_email | Required string(email) |
Sender’s email. (Field alias “email_address_from” is supported, too). |
from_name | Required string |
Sender’s name. (Field alias “name_from” is supported, too). |
to_email | Required string(email) |
Recipient’s email. (Field alias “email_address_to” is supported, too). |
200 Response
{
"status": "success"
}
Response Schema
HTTP Code 200:
Email successfully accepted for sending.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Email-validation Methods
Email validation methods. As a result of the check, you’ll get detailed information on email validity. It will help eliminate nonexistent emails, decrease the number of complaints, clean up the subscribers list and eventually enhance your sender reputation score. For example, you may add validation to a subscription form on your site to let users know they’ve just entered an invalid address.
email-validation-single
POST https://us1.unione.io/en/transactional/api/v1/email-validation/single.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"email": "user@example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"email" => "user@example.com"
];
try {
$response = $client->request('POST','email-validation/single.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"email": "user@example.com"
}
r = requests.post(base_url+'/email-validation/single.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"email" => "user@example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/email-validation/single.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"email\": \"user@example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("email-validation/single.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/email-validation/single.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"email\": \"user@example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"email": "user@example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/email-validation/single.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/email-validation/single.json
A maximum of two concurrent requests are allowed; if you send more requests, an error will be returned. Since the verification process should be completed promptly, we’ve set a time limit on email check. If we encounter a slow email server that does not respond in 5 seconds, you may get an “unknown” status.
Parameters
Name | Type | Description |
---|---|---|
Required string(email) |
Email address to be checked. |
200 Response
{
"status": "success",
"email": "user@example.com",
"result": "suspicious",
"cause": "disposable",
"validity": 10,
"local_part": "user",
"domain": "example.com",
"mx_found": true,
"mx_record": 10,
"did_you_mean": "user@example.com",
"processed_at": "2023-01-01 22:14:59"
}
Response Schema
HTTP Code 200:
Email check completed successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
Required string(email) |
Email address to be checked. | |
result | Required string |
Possible statuses:
|
cause | Required string |
Possible statuses:
|
validity | Required integer |
Validity score, from 0 to 100 (0 – invalid, 100 – valid). |
local_part | Required string |
Local part (everything preceding the @ sign). |
domain | Required string |
Domain name part. |
mx_found | Required boolean |
True if the address’ domain does have an MX record, false if does not. |
mx_record | Required string |
Preferred MX record for the domain. |
did_you_mean | Required string(email) |
For addresses which are likely to have typing errors (cause=possible_typo), a suggested variant with a fixed typo. |
processed_at | Required string(utc-date-time) |
Email check date and time, YYYY-MM-DD hh:mm:ss UTC. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Template Methods
You have the option of storing a template on the UniOne side and then using it by id, which is highly recommended for sending repetitive messages or high volume traffic. UniOne supports two different template engines.
template-set
POST https://us1.unione.io/en/transactional/api/v1/template/set.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"template": {
"id": "string",
"name": "string",
"editor_type": "html",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
]
}
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"template" => [
"id" => "string",
"name" => "string",
"editor_type" => "html",
"template_engine" => "simple",
"global_substitutions" => [
"property1" => "string",
"property2" => "string"
],
"global_metadata" => [
"property1" => "string",
"property2" => "string"
],
"body" => [
"html" => "<b>Hello, {{to_name}}</b>",
"plaintext" => "Hello, {{to_name}}",
"amp" => "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body[visibility:hidden]</style></head><body> Hello, AMP4EMAIL world.</body></html>"
],
"subject" => "string",
"from_email" => "user@example.com",
"from_name" => "John Smith",
"reply_to" => "user@example.com",
"reply_to_name" => "John Smith",
"track_links" => 0,
"track_read" => 0,
"headers" => [
"X-MyHeader" => "some data",
"List-Unsubscribe" => "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
],
"attachments" => [
[
"type" => "text/plain",
"name" => "readme.txt",
"content" => "SGVsbG8sIHdvcmxkIQ=="
]
],
"inline_attachments" => [
[
"type" => "image/gif",
"name" => "IMAGECID1",
"content" => "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
]
]
]
];
try {
$response = $client->request('POST','template/set.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"template": {
"id": "string",
"name": "string",
"editor_type": "html",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
]
}
}
r = requests.post(base_url+'/template/set.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"template" => {
"id" => "string",
"name" => "string",
"editor_type" => "html",
"template_engine" => "simple",
"global_substitutions" => {
"property1" => "string",
"property2" => "string"
},
"global_metadata" => {
"property1" => "string",
"property2" => "string"
},
"body" => {
"html" => "<b>Hello, {{to_name}}</b>",
"plaintext" => "Hello, {{to_name}}",
"amp" => "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject" => "string",
"from_email" => "user@example.com",
"from_name" => "John Smith",
"reply_to" => "user@example.com",
"reply_to_name" => "John Smith",
"track_links" => 0,
"track_read" => 0,
"headers" => {
"X-MyHeader" => "some data",
"List-Unsubscribe" => "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments" => [
{
"type" => "text/plain",
"name" => "readme.txt",
"content" => "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments" => [
{
"type" => "image/gif",
"name" => "IMAGECID1",
"content" => "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
]
}
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/template/set.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"template\": {"
+" \"id\": \"string\","
+" \"name\": \"string\","
+" \"editor_type\": \"html\","
+" \"template_engine\": \"simple\","
+" \"global_substitutions\": {"
+" \"property1\": \"string\","
+" \"property2\": \"string\""
+" },"
+" \"global_metadata\": {"
+" \"property1\": \"string\","
+" \"property2\": \"string\""
+" },"
+" \"body\": {"
+" \"html\": \"<b>Hello, {{to_name}}</b>\","
+" \"plaintext\": \"Hello, {{to_name}}\","
+" \"amp\": \"<!doctype html><html amp4email><head> <meta charset=\\\"utf-8\\\"><script async src=\\\"https://cdn.ampproject.org/v0.js\\\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>\""
+" },"
+" \"subject\": \"string\","
+" \"from_email\": \"user@example.com\","
+" \"from_name\": \"John Smith\","
+" \"reply_to\": \"user@example.com\","
+" \"reply_to_name\": \"John Smith\","
+" \"track_links\": 0,"
+" \"track_read\": 0,"
+" \"headers\": {"
+" \"X-MyHeader\": \"some data\","
+" \"List-Unsubscribe\": \"<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>\""
+" },"
+" \"attachments\": ["
+" {"
+" \"type\": \"text/plain\","
+" \"name\": \"readme.txt\","
+" \"content\": \"SGVsbG8sIHdvcmxkIQ==\""
+" }"
+" ],"
+" \"inline_attachments\": ["
+" {"
+" \"type\": \"image/gif\","
+" \"name\": \"IMAGECID1\","
+" \"content\": \"R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw==\""
+" }"
+" ]"
+" }"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("template/set.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/template/set.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"template\": {"
+" \"id\": \"string\","
+" \"name\": \"string\","
+" \"editor_type\": \"html\","
+" \"template_engine\": \"simple\","
+" \"global_substitutions\": {"
+" \"property1\": \"string\","
+" \"property2\": \"string\""
+" },"
+" \"global_metadata\": {"
+" \"property1\": \"string\","
+" \"property2\": \"string\""
+" },"
+" \"body\": {"
+" \"html\": \"<b>Hello, {{to_name}}</b>\","
+" \"plaintext\": \"Hello, {{to_name}}\","
+" \"amp\": \"<!doctype html><html amp4email><head> <meta charset=\\\"utf-8\\\"><script async src=\\\"https://cdn.ampproject.org/v0.js\\\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>\""
+" },"
+" \"subject\": \"string\","
+" \"from_email\": \"user@example.com\","
+" \"from_name\": \"John Smith\","
+" \"reply_to\": \"user@example.com\","
+" \"reply_to_name\": \"John Smith\","
+" \"track_links\": 0,"
+" \"track_read\": 0,"
+" \"headers\": {"
+" \"X-MyHeader\": \"some data\","
+" \"List-Unsubscribe\": \"<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>\""
+" },"
+" \"attachments\": ["
+" {"
+" \"type\": \"text/plain\","
+" \"name\": \"readme.txt\","
+" \"content\": \"SGVsbG8sIHdvcmxkIQ==\""
+" }"
+" ],"
+" \"inline_attachments\": ["
+" {"
+" \"type\": \"image/gif\","
+" \"name\": \"IMAGECID1\","
+" \"content\": \"R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw==\""
+" }"
+" ]"
+" }"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"template": {
"id": "string",
"name": "string",
"editor_type": "html",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
]
}
};
fetch('https://us1.unione.io/en/transactional/api/v1/template/set.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/template/set.json
Creates or updates an email template.
Restrictions:
- The maximum request size is 10 MB.
- The number of templates is limited to 10000.
Parameters
Name | Type | Description |
---|---|---|
template | Required object |
Object with all the template properties. |
» id | Optional string(uuid) |
Template unique identifier. If you omit the “id” field then new template will be created. If you specify the “id” field, the system will try to find a template with the specified id and edit it. |
» name | Required string |
Template name. |
» editor_type | Optional string |
Editor type, “html” or “visual”. Default is “html”. You can create a template with “visual” editor type only in web interface. |
» template_engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. |
» global_substitutions | Optional object |
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
|
» global_metadata | Optional object |
Object for passing the metadata common for all the recipients, such as “key”: “value”. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned by webhook. To group single emails into a campaign, you can use the system key ‘campaign_id’ with a value in the form of a non-negative decimal integer up to 128 bits or a UUID in the format ‘c7703772-453e-4c77-a9ae-9a1b94051b5a’. Incorrect values will be treated as ‘0’. |
» body | Optional object |
Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required. |
»» html | Optional string |
HTML part of the email body |
»» plaintext | Optional string |
Plaintext part of the email body. |
»» amp | Optional string |
Optional AMP part of the email body. |
» subject | Optional string |
Email subject. |
» from_email | Required string |
Sender’s email. |
» from_name | Optional string |
Sender’s name. |
» reply_to | Optional string |
Optional Reply-To email (in case it’s different to sender’s email) |
» reply_to_name | Optional string |
Optional Reply-To name (if reply_to email is specified and you want to display not only this email but also the name) |
» track_links | Optional integer |
1 = click tracking is on (default), 0 = click tracking is off. To use track_links = 0, you need to ask support to enable this feature. |
» track_read | Optional integer |
1 = read tracking is on (default), 0=read tracking is off. To use track_read = 0, you need to ask support to enable this feature. |
» headers | Optional object |
Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are ignored, for example X-UNIONE-Global-Language, X-UNIONE-Template-Engine. Standard headers “To,” “CC,” and “BCC” are passed without the “X-.” Yet, they are processed in a particular way and, as a result, have a number of restrictions. You can find more details about it here. If our support have approved omitting standard unsubscription block for you, you can also pass List-Unsubscribe, List-Subscribe, List-Help, List-Owner, List-Archive, In-Reply-To and References headers. |
»» X-UNIONE-Global-Language | Optional string |
The language of the unsubscribe footer and unsubscribe page. Languages supported are: “be”, “de”, “en”, “es”, “fr”, “it”, “pl”, “pt”, “ru”, “ua”, “kz”. |
»» X-UNIONE-Template-Engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. Has a priority over the value allowed in the “template_engine” parameter. |
» attachments | Optional array |
Optional array of attachments |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment name in the format: “name.extension”. When multiple attachments are passed, their names must be unique. The symbol ‘/’ is not allowed in attachment names. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
» inline_attachments | Optional array |
Optional array of inline attachments, e.g. for including images in email instead of loading them from external URL. |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment content id. For example, “name”=“IMAGECID1” should be referenced in HTML like <img src=“cid:IMAGECID1”>. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
200 Response
{
"status": "success",
"template": {
"id": "string",
"name": "string",
"editor_type": "html",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
]
}
}
Response Schema
HTTP Code 200:
Template set successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
template | Required object |
Object with all the template properties. |
» id | Optional string(uuid) |
Template unique identifier. If you omit the “id” field then new template will be created. If you specify the “id” field, the system will try to find a template with the specified id and edit it. |
» name | Required string |
Template name. |
» editor_type | Optional string |
Editor type, “html” or “visual”. Default is “html”. You can create a template with “visual” editor type only in web interface. |
» template_engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. |
» global_substitutions | Optional object |
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
|
» global_metadata | Optional object |
Object for passing the metadata common for all the recipients, such as “key”: “value”. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned by webhook. To group single emails into a campaign, you can use the system key ‘campaign_id’ with a value in the form of a non-negative decimal integer up to 128 bits or a UUID in the format ‘c7703772-453e-4c77-a9ae-9a1b94051b5a’. Incorrect values will be treated as ‘0’. |
» body | Optional object |
Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required. |
»» html | Optional string |
HTML part of the email body |
»» plaintext | Optional string |
Plaintext part of the email body. |
»» amp | Optional string |
Optional AMP part of the email body. |
» subject | Optional string |
Email subject. |
» from_email | Required string |
Sender’s email. |
» from_name | Optional string |
Sender’s name. |
» reply_to | Optional string |
Optional Reply-To email (in case it’s different to sender’s email) |
» reply_to_name | Optional string |
Optional Reply-To name (if reply_to email is specified and you want to display not only this email but also the name) |
» track_links | Optional integer |
1 = click tracking is on (default), 0 = click tracking is off. To use track_links = 0, you need to ask support to enable this feature. |
» track_read | Optional integer |
1 = read tracking is on (default), 0=read tracking is off. To use track_read = 0, you need to ask support to enable this feature. |
» headers | Optional object |
Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are ignored, for example X-UNIONE-Global-Language, X-UNIONE-Template-Engine. Standard headers “To,” “CC,” and “BCC” are passed without the “X-.” Yet, they are processed in a particular way and, as a result, have a number of restrictions. You can find more details about it here. If our support have approved omitting standard unsubscription block for you, you can also pass List-Unsubscribe, List-Subscribe, List-Help, List-Owner, List-Archive, In-Reply-To and References headers. |
»» X-UNIONE-Global-Language | Optional string |
The language of the unsubscribe footer and unsubscribe page. Languages supported are: “be”, “de”, “en”, “es”, “fr”, “it”, “pl”, “pt”, “ru”, “ua”, “kz”. |
»» X-UNIONE-Template-Engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. Has a priority over the value allowed in the “template_engine” parameter. |
» attachments | Optional array |
Optional array of attachments |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment name in the format: “name.extension”. When multiple attachments are passed, their names must be unique. The symbol ‘/’ is not allowed in attachment names. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
» inline_attachments | Optional array |
Optional array of inline attachments, e.g. for including images in email instead of loading them from external URL. |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment content id. For example, “name”=“IMAGECID1” should be referenced in HTML like <img src=“cid:IMAGECID1”>. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
template-get
POST https://us1.unione.io/en/transactional/api/v1/template/get.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"id": "string"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"id" => "string"
];
try {
$response = $client->request('POST','template/get.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"id": "string"
}
r = requests.post(base_url+'/template/get.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"id" => "string"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/template/get.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"id\": \"string\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("template/get.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/template/get.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"id\": \"string\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"id": "string"
};
fetch('https://us1.unione.io/en/transactional/api/v1/template/get.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/template/get.json
Gets template properties by it’s id.
Parameters
Name | Type | Description |
---|---|---|
id | Required string(uuid) |
Template id. |
200 Response
{
"status": "success",
"template": {
"id": "string",
"name": "string",
"editor_type": "html",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
]
}
}
Response Schema
HTTP Code 200:
Template returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
template | Required object |
Object with all the template properties. |
» id | Optional string(uuid) |
Template unique identifier. If you omit the “id” field then new template will be created. If you specify the “id” field, the system will try to find a template with the specified id and edit it. |
» name | Required string |
Template name. |
» editor_type | Optional string |
Editor type, “html” or “visual”. Default is “html”. You can create a template with “visual” editor type only in web interface. |
» template_engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. |
» global_substitutions | Optional object |
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
|
» global_metadata | Optional object |
Object for passing the metadata common for all the recipients, such as “key”: “value”. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned by webhook. To group single emails into a campaign, you can use the system key ‘campaign_id’ with a value in the form of a non-negative decimal integer up to 128 bits or a UUID in the format ‘c7703772-453e-4c77-a9ae-9a1b94051b5a’. Incorrect values will be treated as ‘0’. |
» body | Optional object |
Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required. |
»» html | Optional string |
HTML part of the email body |
»» plaintext | Optional string |
Plaintext part of the email body. |
»» amp | Optional string |
Optional AMP part of the email body. |
» subject | Optional string |
Email subject. |
» from_email | Required string |
Sender’s email. |
» from_name | Optional string |
Sender’s name. |
» reply_to | Optional string |
Optional Reply-To email (in case it’s different to sender’s email) |
» reply_to_name | Optional string |
Optional Reply-To name (if reply_to email is specified and you want to display not only this email but also the name) |
» track_links | Optional integer |
1 = click tracking is on (default), 0 = click tracking is off. To use track_links = 0, you need to ask support to enable this feature. |
» track_read | Optional integer |
1 = read tracking is on (default), 0=read tracking is off. To use track_read = 0, you need to ask support to enable this feature. |
» headers | Optional object |
Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are ignored, for example X-UNIONE-Global-Language, X-UNIONE-Template-Engine. Standard headers “To,” “CC,” and “BCC” are passed without the “X-.” Yet, they are processed in a particular way and, as a result, have a number of restrictions. You can find more details about it here. If our support have approved omitting standard unsubscription block for you, you can also pass List-Unsubscribe, List-Subscribe, List-Help, List-Owner, List-Archive, In-Reply-To and References headers. |
»» X-UNIONE-Global-Language | Optional string |
The language of the unsubscribe footer and unsubscribe page. Languages supported are: “be”, “de”, “en”, “es”, “fr”, “it”, “pl”, “pt”, “ru”, “ua”, “kz”. |
»» X-UNIONE-Template-Engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. Has a priority over the value allowed in the “template_engine” parameter. |
» attachments | Optional array |
Optional array of attachments |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment name in the format: “name.extension”. When multiple attachments are passed, their names must be unique. The symbol ‘/’ is not allowed in attachment names. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
» inline_attachments | Optional array |
Optional array of inline attachments, e.g. for including images in email instead of loading them from external URL. |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment content id. For example, “name”=“IMAGECID1” should be referenced in HTML like <img src=“cid:IMAGECID1”>. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
template-list
POST https://us1.unione.io/en/transactional/api/v1/template/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"limit": 50,
"offset": 0
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"limit" => 50,
"offset" => 0
];
try {
$response = $client->request('POST','template/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"limit": 50,
"offset": 0
}
r = requests.post(base_url+'/template/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"limit" => 50,
"offset" => 0
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/template/list.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"limit\": 50,"
+" \"offset\": 0"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("template/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/template/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"limit\": 50,"
+" \"offset\": 0"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"limit": 50,
"offset": 0
};
fetch('https://us1.unione.io/en/transactional/api/v1/template/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/template/list.json
Returns the list of all or some templates of the account.
You can iterate thru large list using “offset” and “limit” parameters. When less than “limit” templates are returned then the end of list is reached.
Parameters
Name | Type | Description |
---|---|---|
limit | Optional integer |
Limits the number of templates returned, default is 50. |
offset | Optional integer |
Index of the first template in the list, starting with 0. |
200 Response
{
"status": "success",
"templates": [
{
"id": "string",
"name": "string",
"editor_type": "html",
"template_engine": "simple",
"global_substitutions": {
"property1": "string",
"property2": "string"
},
"global_metadata": {
"property1": "string",
"property2": "string"
},
"body": {
"html": "<b>Hello, {{to_name}}</b>",
"plaintext": "Hello, {{to_name}}",
"amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
},
"subject": "string",
"from_email": "user@example.com",
"from_name": "John Smith",
"reply_to": "user@example.com",
"reply_to_name": "John Smith",
"track_links": 0,
"track_read": 0,
"headers": {
"X-MyHeader": "some data",
"List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/{{CustomerId}}>"
},
"attachments": [
{
"type": "text/plain",
"name": "readme.txt",
"content": "SGVsbG8sIHdvcmxkIQ=="
}
],
"inline_attachments": [
{
"type": "image/gif",
"name": "IMAGECID1",
"content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
}
],
"created": "string",
"user_id": 11344,
"project_id": "6123462132634",
"project_name": "Project 1A"
}
]
}
Response Schema
HTTP Code 200:
Template list returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
templates | Required array |
Array of template objects. |
» id | Required string(uuid) |
Template unique identifier. |
» name | Required string |
Template name. |
» editor_type | Optional string |
Editor type, “html” or “visual”. Default is “html”. You can create a template with “visual” editor type only in web interface. |
» template_engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. |
» global_substitutions | Optional object |
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
|
» global_metadata | Optional object |
Object for passing the metadata common for all the recipients, such as “key”: “value”. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned by webhook. To group single emails into a campaign, you can use the system key ‘campaign_id’ with a value in the form of a non-negative decimal integer up to 128 bits or a UUID in the format ‘c7703772-453e-4c77-a9ae-9a1b94051b5a’. Incorrect values will be treated as ‘0’. |
» body | Required object |
Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required. |
»» html | Optional string |
HTML part of the email body |
»» plaintext | Optional string |
Plaintext part of the email body. |
»» amp | Optional string |
Optional AMP part of the email body. |
» subject | Optional string |
Email subject. |
» from_email | Required string |
Sender’s email. |
» from_name | Optional string |
Sender’s name. |
» reply_to | Optional string |
Optional Reply-To email (in case it’s different to sender’s email) |
» reply_to_name | Optional string |
Optional Reply-To name (if reply_to email is specified and you want to display not only this email but also the name) |
» track_links | Optional integer |
1 = click tracking is on (default), 0 = click tracking is off. To use track_links = 0, you need to ask support to enable this feature. |
» track_read | Optional integer |
1 = read tracking is on (default), 0=read tracking is off. To use track_read = 0, you need to ask support to enable this feature. |
» headers | Optional object |
Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are ignored, for example X-UNIONE-Global-Language, X-UNIONE-Template-Engine. Standard headers “To,” “CC,” and “BCC” are passed without the “X-.” Yet, they are processed in a particular way and, as a result, have a number of restrictions. You can find more details about it here. If our support have approved omitting standard unsubscription block for you, you can also pass List-Unsubscribe, List-Subscribe, List-Help, List-Owner, List-Archive, In-Reply-To and References headers. |
»» X-UNIONE-Global-Language | Optional string |
The language of the unsubscribe footer and unsubscribe page. Languages supported are: “be”, “de”, “en”, “es”, “fr”, “it”, “pl”, “pt”, “ru”, “ua”, “kz”. |
»» X-UNIONE-Template-Engine | Optional string |
The template engine for handling the substitutions(merge tags), “simple”, “velocity” or “none”. Default value is “simple”. Has a priority over the value allowed in the “template_engine” parameter. |
» attachments | Optional array |
Optional array of attachments |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment name in the format: “name.extension”. When multiple attachments are passed, their names must be unique. The symbol ‘/’ is not allowed in attachment names. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
» inline_attachments | Optional array |
Optional array of inline attachments, e.g. for including images in email instead of loading them from external URL. |
»» type | Required string |
Attachment type, see MIME. If unsure, use “application/octet-stream”. |
»» name | Required string |
Attachment content id. For example, “name”=“IMAGECID1” should be referenced in HTML like <img src=“cid:IMAGECID1”>. |
»» content | Required string(byte) |
File contents in base64. Maximum file size 7MB (9786710 bytes in base64). |
» created | Required string(utc-date-time) |
Template creation date and time in UTC timezone in format “YYYY-MM-DD hh:mm:ss” |
» user_id | Required integer |
Unique user identifier. |
» project_id | Optional string |
Unqiue project identifier, ASCII string up to 36 characters long. |
» project_name | Optional string |
Project name, unique for user account. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
template-delete
POST https://us1.unione.io/en/transactional/api/v1/template/delete.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"id": "string"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"id" => "string"
];
try {
$response = $client->request('POST','template/delete.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"id": "string"
}
r = requests.post(base_url+'/template/delete.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"id" => "string"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/template/delete.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"id\": \"string\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("template/delete.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/template/delete.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"id\": \"string\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"id": "string"
};
fetch('https://us1.unione.io/en/transactional/api/v1/template/delete.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/template/delete.json
Deletes a template by id.
Parameters
Name | Type | Description |
---|---|---|
id | Required string(uuid) |
Template id. |
200 Response
{
"status": "success"
}
Response Schema
HTTP Code 200:
Template deleted successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Webhook Methods
UniOne lets you recieve notifications about email status changes or spam blocks. You provide an URL and every time a watched event occurs we will notify you by submitting a request with JSON data to this URL.
You can configure the format of webhook calls (JSON or gzipped JSON), which events you want to be notified of, whether or not you let us groups several events in one request, do you want to receive extra details like SMTP answer or recipient’s user agent, etc.
Please note that your webhook handler should be able to process at least 5 parallel requests, up to 100 events each (but you can configure the maximum number of parallel connections up to 100, which is recommended).
If the URL of your webhook handler is not available (the response is not HTTP 200 OK within 3 seconds timeout), the system will repeat requests each 10 minutes during 24 hours, passing extra parameter retry_count. If there were at least 10 events during last 24 hours and all the webhook requests about these events have failed then we consider webhook handler broken and change it’s status to inactive automatically. A notification about that is sent to an email configured in control panel.
The format of webhook request and details of each event are described here.
webhook-set
POST https://us1.unione.io/en/transactional/api/v1/webhook/set.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"url": "https://yourhost.example.com/unione-webhook",
"status": "active",
"event_format": "json_post",
"delivery_info": 0,
"single_event": 0,
"max_parallel": 10,
"events": {
"spam_block": [
"*"
],
"email_status": [
"delivered",
"opened",
"clicked",
"unsubscribed",
"subscribed",
"soft_bounced",
"hard_bounced",
"spam"
]
}
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"url" => "https://yourhost.example.com/unione-webhook",
"status" => "active",
"event_format" => "json_post",
"delivery_info" => 0,
"single_event" => 0,
"max_parallel" => 10,
"events" => [
"spam_block" => [
"*"
],
"email_status" => [
"delivered",
"opened",
"clicked",
"unsubscribed",
"subscribed",
"soft_bounced",
"hard_bounced",
"spam"
]
]
];
try {
$response = $client->request('POST','webhook/set.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"url": "https://yourhost.example.com/unione-webhook",
"status": "active",
"event_format": "json_post",
"delivery_info": 0,
"single_event": 0,
"max_parallel": 10,
"events": {
"spam_block": [
"*"
],
"email_status": [
"delivered",
"opened",
"clicked",
"unsubscribed",
"subscribed",
"soft_bounced",
"hard_bounced",
"spam"
]
}
}
r = requests.post(base_url+'/webhook/set.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"url" => "https://yourhost.example.com/unione-webhook",
"status" => "active",
"event_format" => "json_post",
"delivery_info" => 0,
"single_event" => 0,
"max_parallel" => 10,
"events" => {
"spam_block" => [
"*"
],
"email_status" => [
"delivered",
"opened",
"clicked",
"unsubscribed",
"subscribed",
"soft_bounced",
"hard_bounced",
"spam"
]
}
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/webhook/set.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"url\": \"https://yourhost.example.com/unione-webhook\","
+" \"status\": \"active\","
+" \"event_format\": \"json_post\","
+" \"delivery_info\": 0,"
+" \"single_event\": 0,"
+" \"max_parallel\": 10,"
+" \"events\": {"
+" \"spam_block\": ["
+" \"*\""
+" ],"
+" \"email_status\": ["
+" \"delivered\","
+" \"opened\","
+" \"clicked\","
+" \"unsubscribed\","
+" \"subscribed\","
+" \"soft_bounced\","
+" \"hard_bounced\","
+" \"spam\""
+" ]"
+" }"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("webhook/set.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/webhook/set.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"url\": \"https://yourhost.example.com/unione-webhook\","
+" \"status\": \"active\","
+" \"event_format\": \"json_post\","
+" \"delivery_info\": 0,"
+" \"single_event\": 0,"
+" \"max_parallel\": 10,"
+" \"events\": {"
+" \"spam_block\": ["
+" \"*\""
+" ],"
+" \"email_status\": ["
+" \"delivered\","
+" \"opened\","
+" \"clicked\","
+" \"unsubscribed\","
+" \"subscribed\","
+" \"soft_bounced\","
+" \"hard_bounced\","
+" \"spam\""
+" ]"
+" }"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"url": "https://yourhost.example.com/unione-webhook",
"status": "active",
"event_format": "json_post",
"delivery_info": 0,
"single_event": 0,
"max_parallel": 10,
"events": {
"spam_block": [
"*"
],
"email_status": [
"delivered",
"opened",
"clicked",
"unsubscribed",
"subscribed",
"soft_bounced",
"hard_bounced",
"spam"
]
}
};
fetch('https://us1.unione.io/en/transactional/api/v1/webhook/set.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/webhook/set.json
Sets or edits a webhook, i.e. an event notification handler.
Parameters
Name | Type | Description |
---|---|---|
url | Required string(uri) |
URL that will receive the notification when an event occurs. The URL should be unique for a user or a project. Only ASCII characters are supported for now in URL, please convert to Punycode if you need to use non-ASCII characters. |
status | Optional string |
Webhook status, “active” by default. “disabled” means that webhook has been disabled by the user, “stopped” means that webhook has been stopped by the system after 24h of failed calls (with minimum of 10 distinct events). |
event_format | Optional string |
Notification format. “json_post”(default) or “json_post_gzip”. |
delivery_info | Optional integer |
Shall detailed delivery info be returned(1) or not(0). When it’s 1, the information about SMTP response and internal delivery status is returned for “hard_bounced” and “soft_bounced” email statuses; the user agent is returned for “opened” and “clicked” statuses and URL for “clicked” status. |
single_event | Optional integer |
0=several event notifications can be reported in single webhook call, 1=only single event can be reported in one call (not recommended). |
max_parallel | Optional integer |
Maximum quantity of permitted parallel queries to your server. The more your server can handle - the better. |
events | Optional object |
Object containing events to notify of. |
» spam_block | Optional array |
If present then spam block events will be reported. Should contain single array element with “*” string. |
» email_status | Optional array |
If present then email status change events will be reported. Contains names of statuses to notify of. |
200 Response
{
"status": "success",
"object": {
"id": 0,
"url": "http://example.com",
"status": "active",
"event_format": "json_post",
"delivery_info": 0,
"single_event": 0,
"max_parallel": 10,
"updated_at": "string",
"events": {
"spam_block": [
"*"
],
"email_status": [
"delivered",
"opened",
"clicked",
"unsubscribed",
"subscribed",
"soft_bounced",
"hard_bounced",
"spam"
]
}
}
}
Response Schema
HTTP Code 200:
Webhook set successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
object | Required object |
Object with all the webhook properties. |
» id | Required integer |
Webhook unique identifier. |
» url | Required string(uri) |
Webhook URL. |
» status | Required string |
Webhook status, “active” by default. “disabled” means that webhook has been disabled by the user, “stopped” means that webhook has been stopped by the system after 24h of failed calls (with minimum of 10 distinct events). |
» event_format | Required string |
Notification format. “json_post”(default) or “json_post_gzip”. |
» delivery_info | Required integer |
Shall detailed delivery info be returned(1) or not(0). When it’s 1, the information about SMTP response and internal delivery status is returned for “hard_bounced” and “soft_bounced” email statuses; the user agent is returned for “opened” and “clicked” statuses and URL for “clicked” status. |
» single_event | Required integer |
0=several event notifications can be reported in single webhook call, 1=only single event can be reported in one call (not recommended). |
» max_parallel | Required integer |
Maximum quantity of permitted parallel queries to your server. The more your server can handle - the better. |
» updated_at | Optional string(utc-date-time) |
Webhook properties last update date and time in UTC timezone in “YYYY-MM-DD hh:mm:ss” format. |
» events | Optional object |
Object containing events to notify of. |
»» spam_block | Optional array |
If present then spam block events will be reported. Should contain single array element with “*” string. |
»» email_status | Optional array |
If present then email status change events will be reported. Contains names of statuses to notify of. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
callback-format
Here you can see description of JSON parameters which will be sent to the URL you provide in webhook/set. Your server should response with 200 OK during 3 seconds or webhook call will be retried later. Read more about webhook concept here.
UniOne generates two types of events that have distinct event_name field and event_data structures:
- transactional_email_status - email delivery status change event. You can subscribe to selected statuses only.
- transactional_spam_block - event of activating/deactivating a spam block for single or multiple SMTP servers.
See HTTP sample
See HTTP sample
See HTTP sample
See HTTP sample
See HTTP sample
See HTTP sample
POST https://yourhost.example.com/unione-webhook HTTP/1.1
Host: yourhost.example.com
Content-Type: application/json
{
"auth":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"events_by_user":
[
{
"user_id":456,
"project_id":"6432890213745872",
"project_name":"MyProject",
"events":
[
{
"event_name":"transactional_email_status",
"event_data":
{
"job_id":"1a3Q2V-0000OZ-S0",
"metadata":
{
"key1":"val1",
"key2":"val2"
},
"email":"recipient.email@example.com",
"status":"sent",
"event_time":"2015-11-30 15:09:42",
"url":"http://some.url.com",
"delivery_info":
{
"delivery_status": "err_delivery_failed",
"destination_response": "550 Spam rejected",
"user_agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36",
"ip":"111.111.111.111"
}
}
},
{
"event_name":"transactional_spam_block",
"event_data":
{
"block_time":"YYYY-MM-DD HH:MM:SS",
"block_type":"one_smtp",
"domain":"domain_name",
"SMTP_blocks_count":8,
"domain_status":"blocked"
}
}
]
}
]
}
Parameters
Name | Type | Description |
---|---|---|
auth | Required string |
MD5-hash of the message body, in which the value “auth” is replaced by api key of the user/project; with this field the recipient of the notification can both authenticate and verify the notification integrity |
events_by_user | Required array |
Array with only one element, containing events of a user/project. |
» user_id | Required integer |
Unique user identifier. |
» project_id | Optional string |
Project identifier, present only if webhook was registered for the project using project API key. |
» project_name | Optional string |
Project name, present only if webhook was registered for the project using project API key. |
» events | Required array |
Array of events reported by webhook. |
»» event_name | Optional string |
Type of event data contained in event_data field, either “transactional_email_status” or “transactional_spam_block”. |
»» event_data | Optional object |
Object with different event properties depending on “event_name”. Below you can see all the properties, “transactional_email_status”-related first and then “transactional_spam_block”-related. |
»»» job_id | Optional string |
Job identifier returned earlier by email/send method. Property exists only if event_name=“transactional_email_status”. |
»»» metadata | Optional object |
Metadata passed in email/send method in recipients.metadata or global_metadata properties. This property exists only if event_name=“transactional_email_status”. |
Optional string(email) |
Recipient’s email. This property exists only if event_name=“transactional_email_status”. | |
»»» status | Optional string |
Email delivery status. This property exists only if event_name=“transactional_email_status”. Possible values are: sent — the message has been sent, but not delivered yet. delivered — the message has been delivered. It can be changed to “opened”, “clicked”, “unsubscribed”, “subscribed” or “spam”. opened — the message has been delivered and read. It can be changed to “clicked”, “unsubscribed”, “subscribed” or “spam”. clicked — the message has been delivered, read, and at least one of the links in email has been clicked. It can be changed to “unsubscribed”, “subscribed” or “spam”. unsubscribed — the message has been delivered to the recipient and read, but then the recipient unsubscribed. It can be changed to “subscribed”. subscribed — the message has been delivered to the recipient and read, but then the recipient unsubscribed and subscribed again. It can be changed to “unsubscribed”. soft_bounced — temporary delivery failure. UniOne will try to deliver the message during 48 hours. In case of success the status changes to “delivered”, in case of failure to deliver during 48 hours message status changes to “hard_bounced”. hard_bounced — failed to deliver the message, there will be no delivery attempts. It’s a final status. There are a lot of possible reasons, you can use SMTP response from delivery_info.destination_response field or UniOne internal reason classification from delivery_info.delivery_status field to analyze the reason. spam — the message has been delivered, but it was reported as spam by the recipient. UniOne can receive and process the spam complaint from several domains, including msn.com, outlook.com, hotmail.com, live.com, ukr.net, yahoo.com, aol.com using FBL. |
»»» event_time | Optional string(utc-date-time) |
Event date & time in UTC time zone in “YYYY-MM-DD hh:mm:ss” format. This property exists only if event_name=“transactional_email_status”. |
»»» url | Optional string(uri) |
URL for “opened” and “clicked” statuses. This property exists only if event_name=“transactional_email_status”. |
»»» delivery_info | Optional object |
Object with detailed delivery info.Event date & time in UTC time zone in “YYYY-MM-DD hh:mm:ss” format. This property exists only if webhook has delivery_info proeprty set to 1 and event_name=“transactional_email_status”. |
»»»» delivery_status | Optional string |
UniOne internal detailed delivery status. Some possible values are: err_user_unknown – email address doesn’t exist; err_user_inactive – email address isn’t used anymore; err_will_retry – email was temporary rejected, delivery will be retried later; err_mailbox_discarded – email address was active earlier, but now it’s deleted; err_mailbox_full – mailbox is full; err_spam_rejected – email was rejected as a spam; err_blacklisted – email was rejected because sender IP or sender domain is found in a black list; err_too_large – email size is over limit, according to recipient’s server; err_unsubscribed – email was unsubscribed; err_unreachable – numerous delivery failures lead to mark this email address as permanently unavailable; err_skip_letter – sending has been canceled because the email address is temporarily unavailable; err_domain_inactive – the domain does not accept mail or does not exist; err_destination_misconfigured – the domain does not accept mail due to incorrect settings on the recipient’s side, and the server’s response contains information about a cause that can be fixed (for example, an inoperative blacklist is used, etc.); err_delivery_failed – delivery failed due to other reasons; err_spam_skipped – sending has been canceled because the campaign has been blocked as a spam; err_lost – the message was not sent due to inconsistency of its parts or it has been lost because of the failure on our side. The sender needs to re-send the letter on his own, since the original has not been saved; We reserve the right to change or add internal delivery statuses as we need, so the following list is provided as an example only, without any description: ok_sent, ok_delivered, ok_read, ok_link_visited, ok_unsubscribed, ok_resubscribed, ok_spam_folder, ok_fbl, not_sent, skip_dup_unreachable, skip_dup_temp_unreachable, skip_dup_mailbox_full, err_spam_removed, err_resend, err_unknown, err_retry_letter, err_src_invalid, err_dest_invalid, err_not_available, err_internal, err_no_dns, err_no_smtp, err_giveup. |
»»»» destination_response | Optional string |
SMTP response. |
»»»» user_agent | Optional string |
User agent of recipient. Present only if detected for “clicked” and “opened” statuses. |
»»»» ip | Optional string |
Recipient’s IP address. Present only if detected for “clicked” and “opened” statuses. |
»»» block_time | Optional string(utc-date-time) |
Spam block date & time in UTC time zone in “YYYY-MM-DD hh:mm:ss” format. This property exists only if event_name=“transactional_spam_block”. |
»»» block_type | Optional string |
Spam block type, either single or multiple sending SMTP. For single sending SMTP block in common pool UniOne retries several other SMTPs. This property exists only if event_name=“transactional_spam_block”. |
»»» domain | Optional string |
Domain that blocked sending. This property exists only if event_name=“transactional_spam_block”. |
»»» SMTP_blocks_count | Optional integer |
Number of sending SMTPs blocked. This property exists only if event_name=“transactional_spam_block”. |
»»» domain_status | Optional string |
Whether it’s a block or unblock event. This property exists only if event_name=“transactional_spam_block”. |
webhook-get
POST https://us1.unione.io/en/transactional/api/v1/webhook/get.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"url": "http://example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"url" => "http://example.com"
];
try {
$response = $client->request('POST','webhook/get.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"url": "http://example.com"
}
r = requests.post(base_url+'/webhook/get.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"url" => "http://example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/webhook/get.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"url\": \"http://example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("webhook/get.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/webhook/get.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"url\": \"http://example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"url": "http://example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/webhook/get.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/webhook/get.json
Gets properties of a webhook.
Parameters
Name | Type | Description |
---|---|---|
url | Required string(uri) |
Webhook URL. |
200 Response
{
"status": "success",
"object": {
"id": 0,
"url": "http://example.com",
"status": "active",
"event_format": "json_post",
"delivery_info": 0,
"single_event": 0,
"max_parallel": 10,
"updated_at": "string",
"events": {
"spam_block": [
"*"
],
"email_status": [
"delivered",
"opened",
"clicked",
"unsubscribed",
"subscribed",
"soft_bounced",
"hard_bounced",
"spam"
]
}
}
}
Response Schema
HTTP Code 200:
Webhook returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
object | Required object |
Object with all the webhook properties. |
» id | Required integer |
Webhook unique identifier. |
» url | Required string(uri) |
Webhook URL. |
» status | Required string |
Webhook status, “active” by default. “disabled” means that webhook has been disabled by the user, “stopped” means that webhook has been stopped by the system after 24h of failed calls (with minimum of 10 distinct events). |
» event_format | Required string |
Notification format. “json_post”(default) or “json_post_gzip”. |
» delivery_info | Required integer |
Shall detailed delivery info be returned(1) or not(0). When it’s 1, the information about SMTP response and internal delivery status is returned for “hard_bounced” and “soft_bounced” email statuses; the user agent is returned for “opened” and “clicked” statuses and URL for “clicked” status. |
» single_event | Required integer |
0=several event notifications can be reported in single webhook call, 1=only single event can be reported in one call (not recommended). |
» max_parallel | Required integer |
Maximum quantity of permitted parallel queries to your server. The more your server can handle - the better. |
» updated_at | Optional string(utc-date-time) |
Webhook properties last update date and time in UTC timezone in “YYYY-MM-DD hh:mm:ss” format. |
» events | Optional object |
Object containing events to notify of. |
»» spam_block | Optional array |
If present then spam block events will be reported. Should contain single array element with “*” string. |
»» email_status | Optional array |
If present then email status change events will be reported. Contains names of statuses to notify of. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
webhook-list
POST https://us1.unione.io/en/transactional/api/v1/webhook/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"limit": 0,
"offset": 0
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"limit" => 0,
"offset" => 0
];
try {
$response = $client->request('POST','webhook/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"limit": 0,
"offset": 0
}
r = requests.post(base_url+'/webhook/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"limit" => 0,
"offset" => 0
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/webhook/list.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"limit\": 0,"
+" \"offset\": 0"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("webhook/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/webhook/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"limit\": 0,"
+" \"offset\": 0"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"limit": 0,
"offset": 0
};
fetch('https://us1.unione.io/en/transactional/api/v1/webhook/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/webhook/list.json
List all or some webhooks (event notification handlers) of a user or a project.
Parameters
Name | Type | Description |
---|---|---|
limit | Optional integer |
Limits the number of webhooks returned. 50 is recommended. |
offset | Optional integer |
Index of the first webhook in the list, starting with 0. |
200 Response
{
"status": "success",
"objects": [
{
"id": 0,
"url": "http://example.com",
"status": "active",
"event_format": "json_post",
"delivery_info": 0,
"single_event": 0,
"max_parallel": 10,
"updated_at": "string",
"events": {
"spam_block": [
"*"
],
"email_status": [
"delivered",
"opened",
"clicked",
"unsubscribed",
"subscribed",
"soft_bounced",
"hard_bounced",
"spam"
]
}
}
]
}
Response Schema
HTTP Code 200:
Webhook list returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
objects | Optional array |
Array of webhooks objects. |
» id | Required integer |
Webhook unique identifier. |
» url | Required string(uri) |
Webhook URL. |
» status | Required string |
Webhook status, “active” by default. “disabled” means that webhook has been disabled by the user, “stopped” means that webhook has been stopped by the system after 24h of failed calls (with minimum of 10 distinct events). |
» event_format | Required string |
Notification format. “json_post”(default) or “json_post_gzip”. |
» delivery_info | Required integer |
Shall detailed delivery info be returned(1) or not(0). When it’s 1, the information about SMTP response and internal delivery status is returned for “hard_bounced” and “soft_bounced” email statuses; the user agent is returned for “opened” and “clicked” statuses and URL for “clicked” status. |
» single_event | Required integer |
0=several event notifications can be reported in single webhook call, 1=only single event can be reported in one call (not recommended). |
» max_parallel | Required integer |
Maximum quantity of permitted parallel queries to your server. The more your server can handle - the better. |
» updated_at | Optional string(utc-date-time) |
Webhook properties last update date and time in UTC timezone in “YYYY-MM-DD hh:mm:ss” format. |
» events | Optional object |
Object containing events to notify of. |
»» spam_block | Optional array |
If present then spam block events will be reported. Should contain single array element with “*” string. |
»» email_status | Optional array |
If present then email status change events will be reported. Contains names of statuses to notify of. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
webhook-delete
POST https://us1.unione.io/en/transactional/api/v1/webhook/delete.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"url": "http://example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"url" => "http://example.com"
];
try {
$response = $client->request('POST','webhook/delete.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"url": "http://example.com"
}
r = requests.post(base_url+'/webhook/delete.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"url" => "http://example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/webhook/delete.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"url\": \"http://example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("webhook/delete.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/webhook/delete.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"url\": \"http://example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"url": "http://example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/webhook/delete.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/webhook/delete.json
Deletes an event notification handler
You can also temporarily deactivate webhook without deleting it by setting it’s status to “disabled” in webhook/set method.
Parameters
Name | Type | Description |
---|---|---|
url | Required string(uri) |
Webhook URL. |
200 Response
{
"status": "success"
}
Response Schema
HTTP Code 200:
Webhook deleted successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Suppression Methods
Methods for managing suppression lists. An email can be added to suppression list because of unsubscription, bounce or complain.
suppression-set
POST https://us1.unione.io/en/transactional/api/v1/suppression/set.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"email": "user@example.com",
"cause": "unsubscribed",
"created": "2021-12-19 10:15:49"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"email" => "user@example.com",
"cause" => "unsubscribed",
"created" => "2021-12-19 10:15:49"
];
try {
$response = $client->request('POST','suppression/set.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"email": "user@example.com",
"cause": "unsubscribed",
"created": "2021-12-19 10:15:49"
}
r = requests.post(base_url+'/suppression/set.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"email" => "user@example.com",
"cause" => "unsubscribed",
"created" => "2021-12-19 10:15:49"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/suppression/set.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"email\": \"user@example.com\","
+" \"cause\": \"unsubscribed\","
+" \"created\": \"2021-12-19 10:15:49\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("suppression/set.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/suppression/set.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"email\": \"user@example.com\","
+" \"cause\": \"unsubscribed\","
+" \"created\": \"2021-12-19 10:15:49\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"email": "user@example.com",
"cause": "unsubscribed",
"created": "2021-12-19 10:15:49"
};
fetch('https://us1.unione.io/en/transactional/api/v1/suppression/set.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/suppression/set.json
Adds an email address to the suppression list. You can always remove this address from the suppression list later using the suppression/delete method.
Parameters
Name | Type | Description |
---|---|---|
Required string(email) |
Email to add in suppression list. | |
cause | Required string |
Cause of email being suppressed. One of:
|
created | Optional string(utc-date-time) |
When suppression was created, in UTC timezone in “YYYY-MM-DD hh:mm:ss” format. |
200 Response
{
"status": "success"
}
Response Schema
HTTP Code 200:
Email has been added to the suppression list.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
suppression-get
POST https://us1.unione.io/en/transactional/api/v1/suppression/get.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"email": "user@example.com",
"all_projects": false
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"email" => "user@example.com",
"all_projects" => false
];
try {
$response = $client->request('POST','suppression/get.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"email": "user@example.com",
"all_projects": false
}
r = requests.post(base_url+'/suppression/get.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"email" => "user@example.com",
"all_projects" => false
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/suppression/get.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"email\": \"user@example.com\","
+" \"all_projects\": false"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("suppression/get.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/suppression/get.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"email\": \"user@example.com\","
+" \"all_projects\": false"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"email": "user@example.com",
"all_projects": false
};
fetch('https://us1.unione.io/en/transactional/api/v1/suppression/get.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/suppression/get.json
Gets a reason and date of email suppression.
Parameters
Name | Type | Description |
---|---|---|
Required string(email) |
Email to get suppression details for. | |
all_projects | Optional boolean |
If a user has projects functionality enabled, he/she can pass all_projects=true to search in all projects’ data. |
200 Response
{
"status": "success",
"email": "user@example.com",
"suppressions": [
{
"project_id": "6123462132634",
"cause": "unsubscribed",
"source": "user",
"is_deletable": true,
"created": "2021-12-19 10:15:49"
}
]
}
Response Schema
HTTP Code 200:
Method call has succeeded (but suppressions array can be empty if sending to email is not suppressed).
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
Required string(email) |
The email for which suppression details were requested. | |
suppressions | Required array |
Array of suppression objects. |
» project_id | Optional string |
Unqiue project identifier, ASCII string up to 36 characters long. |
» cause | Required string |
Cause of email being suppressed. One of:
|
» source | Required string |
Source of email being suppressed. One of:
|
» is_deletable | Required boolean |
Is it possible to delete this suppression by calling suppression/delete method. |
» created | Required string(utc-date-time) |
When suppression was created, in UTC timezone in “YYYY-MM-DD hh:mm:ss” format. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
suppression-list
POST https://us1.unione.io/en/transactional/api/v1/suppression/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"cause": "unsubscribed",
"source": "user",
"start_time": "2020-10-14 17:00:00",
"cursor": "Ajfb6Hvdkn3hdhhvG57xbdufhG5",
"limit": 50
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"cause" => "unsubscribed",
"source" => "user",
"start_time" => "2020-10-14 17:00:00",
"cursor" => "Ajfb6Hvdkn3hdhhvG57xbdufhG5",
"limit" => 50
];
try {
$response = $client->request('POST','suppression/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"cause": "unsubscribed",
"source": "user",
"start_time": "2020-10-14 17:00:00",
"cursor": "Ajfb6Hvdkn3hdhhvG57xbdufhG5",
"limit": 50
}
r = requests.post(base_url+'/suppression/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"cause" => "unsubscribed",
"source" => "user",
"start_time" => "2020-10-14 17:00:00",
"cursor" => "Ajfb6Hvdkn3hdhhvG57xbdufhG5",
"limit" => 50
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/suppression/list.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"cause\": \"unsubscribed\","
+" \"source\": \"user\","
+" \"start_time\": \"2020-10-14 17:00:00\","
+" \"cursor\": \"Ajfb6Hvdkn3hdhhvG57xbdufhG5\","
+" \"limit\": 50"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("suppression/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/suppression/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"cause\": \"unsubscribed\","
+" \"source\": \"user\","
+" \"start_time\": \"2020-10-14 17:00:00\","
+" \"cursor\": \"Ajfb6Hvdkn3hdhhvG57xbdufhG5\","
+" \"limit\": 50"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"cause": "unsubscribed",
"source": "user",
"start_time": "2020-10-14 17:00:00",
"cursor": "Ajfb6Hvdkn3hdhhvG57xbdufhG5",
"limit": 50
};
fetch('https://us1.unione.io/en/transactional/api/v1/suppression/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/suppression/list.json
Returns a suppression list since provided date.
Parameters
Name | Type | Description |
---|---|---|
cause | Optional string |
Cause of email being suppressed. One of:
|
source | Optional string |
Source of email being suppressed. One of:
|
start_time | Optional string(utc-date) |
Date in the format YYYY-MM-DD hh:mm:ss to get suppression list from the “start_time” to the present day. Ignored if “cursor” is not empty. |
cursor | Optional string |
The parameter indicates from which position the selection is to be started. Must be empty or omitted for the first data chunk. In order to get subsequent chunks, you must set the “cursor” parameter in your request, using the value received in response to the previous request. |
limit | Optional integer |
Limits the number of records to be returned at one time, default is 50. |
200 Response
{
"status": "success",
"suppressions": [
{
"email": "user@example.com",
"cause": "unsubscribed",
"source": "user",
"is_deletable": true,
"created": "2021-12-19 10:15:49"
}
],
"cursor": "Ajfb6Hvdkn3hdhhvG57xbdufhG5"
}
Response Schema
HTTP Code 200:
Returns a suppression list since provided date.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
suppressions | Required array |
Array of suppression objects. |
Optional string(email) |
Email to get suppression details for. | |
» cause | Required string |
Cause of email being suppressed. One of:
|
» source | Required string |
Source of email being suppressed. One of:
|
» is_deletable | Required boolean |
Is it possible to delete this suppression by calling suppression/delete method. |
» created | Required string(utc-date-time) |
When suppression was created, in UTC timezone in “YYYY-MM-DD hh:mm:ss” format. |
cursor | Required string |
The parameter indicates from which position the selection is to be started. Must be empty or omitted for the first data chunk. In order to get subsequent chunks, you must set the “cursor” parameter in your request, using the value received in response to the previous request. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
suppression-delete
POST https://us1.unione.io/en/transactional/api/v1/suppression/delete.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"email": "user@example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"email" => "user@example.com"
];
try {
$response = $client->request('POST','suppression/delete.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"email": "user@example.com"
}
r = requests.post(base_url+'/suppression/delete.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"email" => "user@example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/suppression/delete.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"email\": \"user@example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("suppression/delete.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/suppression/delete.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"email\": \"user@example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"email": "user@example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/suppression/delete.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/suppression/delete.json
Deletes an email from suppression list (only records with is_deletable=true). If there are no entries of this email in the suppression list, API error 3003 is returned. If such entries exist but no one can be deleted, API error 3004 is returned. If daily limit of deletes exceeded, API error 906 is returned.
Parameters
Name | Type | Description |
---|---|---|
Required string(email) |
An email to delete from suppression list. |
200 Response
{
"status": "success"
}
Response Schema
HTTP Code 200:
Email has been deleted from the suppression list.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Domain Methods
You can use these methods to setup sender domains and check their statuses. They might be useful in case you want to automate adding domains for your own clients.
To add new sender domain thru API you should take following steps:
- Get DNS records with domain/get-dns-records method and add them to your DNS provider.
- Every 5-10 minutes call domain/list method for your domain (or several domains) and check verification-record.status and dkim.status in the response. You can call it more often if you like, but please not more than once per minute.
- If verification-record.status=“unconfirmed” then you should call domain/validate-verification-record to trigger verification record validation.
- If dkim.status=“inactive” then start DKIM checking by calling domain/validate-dkim (UniOne itself checks DKIM every 30 minutes also)
- When you get verification-record.status=“confirmed” and dkim.status=“active” for the domain then you can stop checking it’s status with domain/list and start using it as a sender domain.
domain-get-dns-records
POST https://us1.unione.io/en/transactional/api/v1/domain/get-dns-records.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"domain": "example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"domain" => "example.com"
];
try {
$response = $client->request('POST','domain/get-dns-records.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"domain": "example.com"
}
r = requests.post(base_url+'/domain/get-dns-records.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"domain" => "example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/domain/get-dns-records.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"domain\": \"example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("domain/get-dns-records.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/domain/get-dns-records.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"domain\": \"example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"domain": "example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/domain/get-dns-records.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/domain/get-dns-records.json
Returns info on domain DNS setup for using with UniOne.
In order to send emails you have to confirm that you own the domain that you are going to send emails from and setup DKIM signature for the domain. This method allows you to register your domain in UniOne and generate verification record and DKIM key, or return previously generated ones if domain is already registered. You should add then DNS records like this to all of the domains you want to confirm:
@ IN TXT "unione-validate-hash=483bb362ebdbeedd755cfb1d4d661"
us._domainkey IN TXT "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo7"
@ IN TXT "v=spf1 include:spf.unione.io ~all"
- First record value should contain “verification-record” field returned by get-dns-records method “as is”.
- Second record value should contain “dkim” field value after “p=”. Mind the name of this record! “us._domainkey.” prefix is important for DKIM selector of UniOne to work properly.
- Third record contains optional, but very recommended SPF entry. Probably you already have one, then just add append include:spf.unione.io right after v=spf1.
Syntax requirements of different DNS providers may differ:
- sometimes it’s necesarry to put full domain name instead of @ sign.
- some providers require add TTL value (like 3600)
- some providers don’t require quotes for enclosing values Please check requirements of your provider and advice your users to do it.
Parameters
Name | Type | Description |
---|---|---|
domain | Required string |
Domain to get DNS records for. |
200 Response
{
"status": "success",
"domain": "example.com",
"verification-record": "unione-validate-hash=483bb362ebdbeedd755cfb1d4d661",
"dkim": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo7"
}
Response Schema
HTTP Code 200:
Domain DNS info returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
domain | Required string |
Domain to get DNS records for. |
verification-record | Required string |
Record to be added “as is” to verify ownership of this domain. |
dkim | Required string |
DKIM signature for the domain. This property contains only the key part, you should prepend it with “k=rsa, p=” part for the record to be valid (see example). |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
domain-validate-verification-record
POST https://us1.unione.io/en/transactional/api/v1/domain/validate-verification-record.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"domain": "example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"domain" => "example.com"
];
try {
$response = $client->request('POST','domain/validate-verification-record.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"domain": "example.com"
}
r = requests.post(base_url+'/domain/validate-verification-record.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"domain" => "example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/domain/validate-verification-record.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"domain\": \"example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("domain/validate-verification-record.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/domain/validate-verification-record.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"domain\": \"example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"domain": "example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/domain/validate-verification-record.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/domain/validate-verification-record.json
Triggers verification record validation for domain.
If you get 200 OK then it means the validation process started succesfully, but it doesn’t mean the verification record is valid. You should check later verification-record.status field returned by domain/list method to get the result. Please read more here.
Parameters
Name | Type | Description |
---|---|---|
domain | Required string |
Domain to validate verification record for. |
200 Response
{
"status": "success",
"message": "Record updated"
}
Response Schema
HTTP Code 200:
Verification record is valid.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
message | Required string |
Debug message. |
HTTP Code default:
Error occured or record is invalid.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
domain-validate-dkim
POST https://us1.unione.io/en/transactional/api/v1/domain/validate-dkim.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"domain": "example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"domain" => "example.com"
];
try {
$response = $client->request('POST','domain/validate-dkim.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"domain": "example.com"
}
r = requests.post(base_url+'/domain/validate-dkim.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"domain" => "example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/domain/validate-dkim.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"domain\": \"example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("domain/validate-dkim.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/domain/validate-dkim.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"domain\": \"example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"domain": "example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/domain/validate-dkim.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/domain/validate-dkim.json
Validates DKIM record for domain.
If you get 200 OK then it means the validation process started succesfully, but it doesn’t mean the DKIM record is valid. You should check later dkim.status field returned by domain/list method to get the result. Please read more here.
Parameters
Name | Type | Description |
---|---|---|
domain | Required string |
Domain to validate DKIM record for. |
200 Response
{
"status": "success",
"message": "Record updated"
}
Response Schema
HTTP Code 200:
DKIM record validation has started successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
message | Required string |
Debug message. |
HTTP Code default:
Error occured or record is invalid.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
domain-list
POST https://us1.unione.io/en/transactional/api/v1/domain/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"domain": "example.com",
"limit": 50,
"offset": 0
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"domain" => "example.com",
"limit" => 50,
"offset" => 0
];
try {
$response = $client->request('POST','domain/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"domain": "example.com",
"limit": 50,
"offset": 0
}
r = requests.post(base_url+'/domain/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"domain" => "example.com",
"limit" => 50,
"offset" => 0
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/domain/list.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"domain\": \"example.com\","
+" \"limit\": 50,"
+" \"offset\": 0"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("domain/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/domain/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"domain\": \"example.com\","
+" \"limit\": 50,"
+" \"offset\": 0"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"domain": "example.com",
"limit": 50,
"offset": 0
};
fetch('https://us1.unione.io/en/transactional/api/v1/domain/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/domain/list.json
Returns a list of all registered domains for user or project, together with statuses of last validations.
Returns last status of ownership validation and DKIM validation for each domain. Read more here.
Parameters
Name | Type | Description |
---|---|---|
domain | Optional string |
Optional domain name if you want to get the status of single domain only. |
limit | Optional integer |
Limits the number of domains returned. Default is 50. |
offset | Optional integer |
Index of the first domain in the list, starting with 0. |
200 Response
{
"status": "success",
"domains": [
{
"domain": "example.com",
"verification-record": {
"value": "unione-validate-hash=483bb362ebdbeedd755cfb1d4d661",
"status": "confirmed"
},
"dkim": {
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo7",
"status": "active"
}
}
]
}
Response Schema
HTTP Code 200:
The list of the registered domains returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
domains | Required array |
Array of objects describing domains. |
» domain | Required string |
Domain name. |
» verification-record | Required object |
Object describing verification record value and status. |
»» value | Optional string |
Record to be added “as is” to verify ownership of this domain. |
»» status | Optional string |
Only domains with “confirmed” verification record are allowed as sender domains. |
» dkim | Required object |
Object describing DKIM record value and status. |
»» key | Optional string |
DKIM signature for the domain. This property contains only the key part, you should prepend it with “k=rsa, p=” part for the record to be valid (see domain/get-dns-records). |
»» status | Optional string |
Only domains with “active” DKIM record are allowed as sender domains. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
domain-delete
POST https://us1.unione.io/en/transactional/api/v1/domain/delete.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"domain": "example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"domain" => "example.com"
];
try {
$response = $client->request('POST','domain/delete.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"domain": "example.com"
}
r = requests.post(base_url+'/domain/delete.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"domain" => "example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/domain/delete.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"domain\": \"example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("domain/delete.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/domain/delete.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"domain\": \"example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"domain": "example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/domain/delete.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/domain/delete.json
Deletes a domain. Attention: you should use project’s API key to delete a project’s domain.
Deletes a domain.
Parameters
Name | Type | Description |
---|---|---|
domain | Optional string |
Domain name to delete. |
200 Response
{
"status": "success",
"message": "Domain deleted"
}
Response Schema
HTTP Code 200:
Domain has been successfully deleted.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
message | Required string |
Domain deleted |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Event-dump Methods
These methods are used to obtain a list of events for a given period of time. The data is stored for up to 45 days, depending on your tariff, i. e. you may fetch all event data starting from 00:00:00 31 days ago and up to current time. For custom tarifs with big sending volumes event dumps are available only for the last 7 days.
event-dump-create
POST https://us1.unione.io/en/transactional/api/v1/event-dump/create.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"start_time": "2022-07-20 00:00:00",
"end_time": "2022-07-21 00:00:00",
"limit": 50,
"all_projects": false,
"filter": {
"job_id": "1ZymBc-00041N-9X",
"status": "sent",
"delivery_status": "string",
"email": "david@example.org",
"email_from": "sender@example.com",
"domain": "example.org",
"campaign_id": "c77f4f4e-3561-49f7-9f07-c35be01b4f43"
},
"dump_fields": [
"string1"
],
"aggregate": "day_status",
"delimiter": ";",
"format": "csv"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"start_time" => "2022-07-20 00:00:00",
"end_time" => "2022-07-21 00:00:00",
"limit" => 50,
"all_projects" => false,
"filter" => [
"job_id" => "1ZymBc-00041N-9X",
"status" => "sent",
"delivery_status" => "string",
"email" => "david@example.org",
"email_from" => "sender@example.com",
"domain" => "example.org",
"campaign_id" => "c77f4f4e-3561-49f7-9f07-c35be01b4f43"
],
"dump_fields" => [
"string1"
],
"aggregate" => "day_status",
"delimiter" => ";",
"format" => "csv"
];
try {
$response = $client->request('POST','event-dump/create.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"start_time": "2022-07-20 00:00:00",
"end_time": "2022-07-21 00:00:00",
"limit": 50,
"all_projects": false,
"filter": {
"job_id": "1ZymBc-00041N-9X",
"status": "sent",
"delivery_status": "string",
"email": "david@example.org",
"email_from": "sender@example.com",
"domain": "example.org",
"campaign_id": "c77f4f4e-3561-49f7-9f07-c35be01b4f43"
},
"dump_fields": [
"string1"
],
"aggregate": "day_status",
"delimiter": ";",
"format": "csv"
}
r = requests.post(base_url+'/event-dump/create.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"start_time" => "2022-07-20 00:00:00",
"end_time" => "2022-07-21 00:00:00",
"limit" => 50,
"all_projects" => false,
"filter" => {
"job_id" => "1ZymBc-00041N-9X",
"status" => "sent",
"delivery_status" => "string",
"email" => "david@example.org",
"email_from" => "sender@example.com",
"domain" => "example.org",
"campaign_id" => "c77f4f4e-3561-49f7-9f07-c35be01b4f43"
},
"dump_fields" => [
"string1"
],
"aggregate" => "day_status",
"delimiter" => ";",
"format" => "csv"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/event-dump/create.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"start_time\": \"2022-07-20 00:00:00\","
+" \"end_time\": \"2022-07-21 00:00:00\","
+" \"limit\": 50,"
+" \"all_projects\": false,"
+" \"filter\": {"
+" \"job_id\": \"1ZymBc-00041N-9X\","
+" \"status\": \"sent\","
+" \"delivery_status\": \"string\","
+" \"email\": \"david@example.org\","
+" \"email_from\": \"sender@example.com\","
+" \"domain\": \"example.org\","
+" \"campaign_id\": \"c77f4f4e-3561-49f7-9f07-c35be01b4f43\""
+" },"
+" \"dump_fields\": ["
+" \"string1\""
+" ],"
+" \"aggregate\": \"day_status\","
+" \"delimiter\": \";\","
+" \"format\": \"csv\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("event-dump/create.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/event-dump/create.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"start_time\": \"2022-07-20 00:00:00\","
+" \"end_time\": \"2022-07-21 00:00:00\","
+" \"limit\": 50,"
+" \"all_projects\": false,"
+" \"filter\": {"
+" \"job_id\": \"1ZymBc-00041N-9X\","
+" \"status\": \"sent\","
+" \"delivery_status\": \"string\","
+" \"email\": \"david@example.org\","
+" \"email_from\": \"sender@example.com\","
+" \"domain\": \"example.org\","
+" \"campaign_id\": \"c77f4f4e-3561-49f7-9f07-c35be01b4f43\""
+" },"
+" \"dump_fields\": ["
+" \"string1\""
+" ],"
+" \"aggregate\": \"day_status\","
+" \"delimiter\": \";\","
+" \"format\": \"csv\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"start_time": "2022-07-20 00:00:00",
"end_time": "2022-07-21 00:00:00",
"limit": 50,
"all_projects": false,
"filter": {
"job_id": "1ZymBc-00041N-9X",
"status": "sent",
"delivery_status": "string",
"email": "david@example.org",
"email_from": "sender@example.com",
"domain": "example.org",
"campaign_id": "c77f4f4e-3561-49f7-9f07-c35be01b4f43"
},
"dump_fields": [
"string1"
],
"aggregate": "day_status",
"delimiter": ";",
"format": "csv"
};
fetch('https://us1.unione.io/en/transactional/api/v1/event-dump/create.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/event-dump/create.json
This asynchronous method initiates the preparation of data dump in CSV format. The number of dump files created or stored is limited to 10; to order more files, you have to delete one of the previous ones or wait until they will be deleted automatically. A newly created dump file is kept for 8 hours. If the request period is more than a day or there are too many events then several files will be generated and each file will contain no more than 100,000 events. File contains columns with the following information - ‘event_time’, ‘job_id’, ‘from_email’, ‘email’, ‘status’, ‘delivery_status’, ‘metadata’, ‘destination_response’, ‘user_agent’, ‘url’, ‘ip’, ‘tags’ and ‘project_id’ (for accounts with projects enabled). You can change the fields and include ‘subject’ field using ‘dump_fileds’ parameter.
Parameters
Name | Type | Description |
---|---|---|
start_time | Required string(utc-date-time) |
Date and time in YYYY-MM-DD hh:mm:ss format, specifying period start time. Data is stored for up to 32 days, depending on your tariff. |
end_time | Optional string(utc-date-time) |
Date and time in YYYY-MM-DD hh:mm:ss format, specifying period end time (non-inclusive). |
limit | Optional integer |
Maximum number of events returned (default is 50). If this value is over 100 000, several files will be created, each having 100 000 events maximum. |
all_projects | Optional boolean |
For accounts with projects enabled, the value all_projects=true allows to fetch data for all existing projects. |
filter | Optional object |
An object with the properties of the event dump filter. |
» job_id | Optional string |
Job identifier returned earlier by email/send method. |
» status | Optional string |
Email status. Possible values are: sent — the message has been sent, but not delivered yet. delivered — the message has been delivered. opened — the message has been delivered and read. clicked — the message has been delivered, read, and at least one of the links in email has been clicked. unsubscribed — the message has been delivered to the recipient and read, but then the recipient unsubscribed. subscribed — the message has been delivered to the recipient and read, but then the recipient unsubscribed and subscribed again. soft_bounced — temporary delivery failure. UniOne will try to deliver the message during 48 hours. hard_bounced — failed to deliver the message, there will be no delivery attempts. spam — the message has been delivered, but it was reported as spam by the recipient. |
» delivery_status | Optional string |
UniOne internal detailed delivery status, you can pass several values at once, comma-separated. Some possible values are: err_user_unknown – email address doesn’t exist; err_user_inactive – email address isn’t used anymore; err_will_retry – email was temporary rejected, delivery will be retried later; err_mailbox_discarded – email address was active earlier, but now it’s deleted; err_mailbox_full – mailbox is full; err_spam_rejected – email was rejected as a spam; err_blacklisted – email was rejected because sender IP or sender domain is found in a black list; err_too_large – email size is over limit, according to recipient’s server; err_unsubscribed – email was unsubscribed; err_unreachable – numerous delivery failures lead to mark this email address as permanently unavailable; err_skip_letter – sending has been canceled because the email address is temporarily unavailable; err_domain_inactive – the domain does not accept mail or does not exist; err_destination_misconfigured – the domain does not accept mail due to incorrect settings on the recipient’s side, and the server’s response contains information about a cause that can be fixed (for example, an inoperative blacklist is used, etc.); err_delivery_failed – delivery failed due to other reasons; err_spam_skipped – sending has been canceled because the campaign has been blocked as a spam; err_lost – the message was not sent due to inconsistency of its parts or it has been lost because of the failure on our side. The sender needs to re-send the letter on his own, since the original has not been saved; We reserve the right to change or add internal delivery statuses as we need, so the following list is provided as an example only, without any description: ok_sent, ok_delivered, ok_read, ok_link_visited, ok_unsubscribed, ok_resubscribed, ok_spam_folder, ok_fbl, not_sent, skip_dup_unreachable, skip_dup_temp_unreachable, skip_dup_mailbox_full, err_spam_removed, err_resend, err_unknown, err_retry_letter, err_src_invalid, err_dest_invalid, err_not_available, err_internal, err_no_dns, err_no_smtp, err_giveup. |
Optional string(email) |
Recipient email address | |
» email_from | Optional string(email) |
Sender email address |
» domain | Optional string |
Recipient domain |
» campaign_id | Optional string |
Campaign identifier, unsigned decimal integer or UUID up to 128-bit, passed in metadata with name “campaign_id” (name is configurable thru support). |
dump_fields | Optional array |
An array of strings containing the names of columns you need in your report, in your preferred order. If the ‘dump_fields’ array is missing or empty, a default field list and order will be applied. Allowed values, in their default order, are - ‘project_id’, ‘event_time’, ‘job_id’, ‘from_email’, ‘email’, ‘status’, ‘delivery_status’, ‘metadata’, ‘destination_response’, ‘user_agent’, ‘url’, ‘ip’, ‘tags’. For maximum security, the ‘subject’ field is not included by default, but you can add it by explicitly including in the ‘dump_fields’ array. |
aggregate | Optional string |
Allows you to obtain aggregated statistics for a given time period. The two allowed values are:
|
delimiter | Optional string |
Field delimiter, can be set to either ‘,’ or ‘;’, defaults to ‘,’. |
format | Optional string |
File format, either “csv” (default) or “csv_gzip”. |
200 Response
{
"status": "success",
"dump_id": "string"
}
Response Schema
HTTP Code 200:
Method call has succeeded.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
dump_id | Required string |
Dump identifier, used to call the event-dump/get method. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
event-dump-get
POST https://us1.unione.io/en/transactional/api/v1/event-dump/get.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"dump_id": "Gqfasjh34tlasd"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"dump_id" => "Gqfasjh34tlasd"
];
try {
$response = $client->request('POST','event-dump/get.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"dump_id": "Gqfasjh34tlasd"
}
r = requests.post(base_url+'/event-dump/get.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"dump_id" => "Gqfasjh34tlasd"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/event-dump/get.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"dump_id\": \"Gqfasjh34tlasd\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("event-dump/get.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/event-dump/get.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"dump_id\": \"Gqfasjh34tlasd\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"dump_id": "Gqfasjh34tlasd"
};
fetch('https://us1.unione.io/en/transactional/api/v1/event-dump/get.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/event-dump/get.json
Returns dump properties for a given identifier
Parameters
Name | Type | Description |
---|---|---|
dump_id | Required string |
Dump identifier received by the method event-dump/create. |
200 Response
{
"status": "success",
"event_dump": {
"dump_id": "Gqfasjh34tlasd",
"dump_status": "in_process",
"files": [
{
"url": "https://eu1.unione.io/event-dump/Agejmh63Efmngaow4tDFGqwqt-1.csv",
"size": 512345
}
]
}
}
Response Schema
HTTP Code 200:
Dump information returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
event_dump | Required object |
An object with the properties of the event dump. |
» dump_id | Required string |
Dump ID received by the method event-dump/create. |
» dump_status | Required string |
Task status, possible values are:
|
» files | Optional array |
An array of objects, each representing a file, ready for download. You may start downloading everything listed in “files” even if “dump_status” is still “in_process”. If there are no events, according to the specified parameters, an empty array will be returned. |
»» url | Required string |
Use this unique URL to download the requested dump file (either .csv or .csv.gz, depending on your request). |
»» size | Required integer |
File size. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
event-dump-list
POST https://us1.unione.io/en/transactional/api/v1/event-dump/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [];
try {
$response = $client->request('POST','event-dump/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {}
r = requests.post(base_url+'/event-dump/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/event-dump/list.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("event-dump/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/event-dump/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {};
fetch('https://us1.unione.io/en/transactional/api/v1/event-dump/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/event-dump/list.json
This method does not require any parameters; returns the full list of existing dumps.
200 Response
{
"status": "success",
"event_dumps": [
{
"dump_id": "Gqfasjh34tlasd",
"dump_status": "in_process",
"files": [
{
"url": "https://eu1.unione.io/event-dump/Agejmh63Efmngaow4tDFGqwqt-1.csv",
"size": 512345
}
]
}
]
}
Response Schema
HTTP Code 200:
List returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
event_dumps | Required array |
An array of objects describing event dumps. Each object is similar to ‘event_dump’ object returned by the event-dump/get method. |
» dump_id | Required string |
Dump ID received by the method event-dump/create. |
» dump_status | Required string |
Task status, possible values are:
|
» files | Optional array |
An array of objects, each representing a file, ready for download. You may start downloading everything listed in “files” even if “dump_status” is still “in_process”. If there are no events, according to the specified parameters, an empty array will be returned. |
»» url | Required string |
Use this unique URL to download the requested dump file (either .csv or .csv.gz, depending on your request). |
»» size | Required integer |
File size. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
event-dump-delete
POST https://us1.unione.io/en/transactional/api/v1/event-dump/delete.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"dump_id": "Gqfasjh34tlasd"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"dump_id" => "Gqfasjh34tlasd"
];
try {
$response = $client->request('POST','event-dump/delete.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"dump_id": "Gqfasjh34tlasd"
}
r = requests.post(base_url+'/event-dump/delete.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"dump_id" => "Gqfasjh34tlasd"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/event-dump/delete.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"dump_id\": \"Gqfasjh34tlasd\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("event-dump/delete.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/event-dump/delete.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"dump_id\": \"Gqfasjh34tlasd\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"dump_id": "Gqfasjh34tlasd"
};
fetch('https://us1.unione.io/en/transactional/api/v1/event-dump/delete.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/event-dump/delete.json
Removes dump from queue or storage.
Parameters
Name | Type | Description |
---|---|---|
dump_id | Required string |
Dump identifier, obtained via the event-dump/create method. |
200 Response
{
"status": "success"
}
Response Schema
HTTP Code 200:
Dump deleted successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Tag Methods
This family of methods is used to manage user-defined tags. Tags are used to categorize letters based on your own criteria, e. g. to create a distinction between marketing and transactional letters or group together all notifications for a particular order type. UniOne allows you to assign tags to all outgoing emails, and the tags you’ve set may then be used to filter and analyze delivery statistics.
tag-list
POST https://us1.unione.io/en/transactional/api/v1/tag/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [];
try {
$response = $client->request('POST','tag/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {}
r = requests.post(base_url+'/tag/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/tag/list.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("tag/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/tag/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {};
fetch('https://us1.unione.io/en/transactional/api/v1/tag/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/tag/list.json
This method returns the full list of user-defined tags. Does not receive any parameters.
200 Response
{
"status": "success",
"tags": [
{
"tag_id": 54,
"tag": "example-tag1"
}
]
}
Response Schema
HTTP Code 200:
List returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
tags | Required array |
An array of objects containing data for user-defined tags. |
» tag_id | Required integer |
Unique tag id. |
» tag | Required string |
Tag name. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
tag-delete
POST https://us1.unione.io/en/transactional/api/v1/tag/delete.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"tag_id": 54
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"tag_id" => 54
];
try {
$response = $client->request('POST','tag/delete.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"tag_id": 54
}
r = requests.post(base_url+'/tag/delete.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"tag_id" => 54
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/tag/delete.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"tag_id\": 54"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("tag/delete.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/tag/delete.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"tag_id\": 54"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"tag_id": 54
};
fetch('https://us1.unione.io/en/transactional/api/v1/tag/delete.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/tag/delete.json
Removes tag.
Parameters
Name | Type | Description |
---|---|---|
tag_id | Required integer |
Unique tag id. |
200 Response
{
"status": "success"
}
Response Schema
HTTP Code 200:
Tag deleted successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Project Methods
Projects allow you to group several independent domains, webhooks, templates, and unsubscription lists together. It’s very useful if you have your own clients and manage their data from a single UniOne account. Each project receives its own API key, and all API calls with that API key only deal with the data of that project. This way, you can assign a separate project for each client and be sure that they won’t conflict; e.g. unsubscribing from one project won’t affect another.
Projects methods are disabled by default due to antispam measures. To enable them, contact support.
Please note that sending domains are confirmed and used on per-project basis by default. But it’s possible to allow projects to send emails from domains confirmed for main account - just ask support to enable it.
project-create
POST https://us1.unione.io/en/transactional/api/v1/project/create.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true,
"backend_domain_id": 1234,
"unsubscribe_page_id": 1
}
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"project" => [
"name" => "Project 1A",
"country" => "ES",
"send_enabled" => true,
"custom_unsubscribe_url_enabled" => true,
"backend_domain_id" => 1234,
"unsubscribe_page_id" => 1
]
];
try {
$response = $client->request('POST','project/create.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true,
"backend_domain_id": 1234,
"unsubscribe_page_id": 1
}
}
r = requests.post(base_url+'/project/create.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"project" => {
"name" => "Project 1A",
"country" => "ES",
"send_enabled" => true,
"custom_unsubscribe_url_enabled" => true,
"backend_domain_id" => 1234,
"unsubscribe_page_id" => 1
}
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/project/create.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"project\": {"
+" \"name\": \"Project 1A\","
+" \"country\": \"ES\","
+" \"send_enabled\": true,"
+" \"custom_unsubscribe_url_enabled\": true,"
+" \"backend_domain_id\": 1234,"
+" \"unsubscribe_page_id\": 1"
+" }"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("project/create.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/project/create.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"project\": {"
+" \"name\": \"Project 1A\","
+" \"country\": \"ES\","
+" \"send_enabled\": true,"
+" \"custom_unsubscribe_url_enabled\": true,"
+" \"backend_domain_id\": 1234,"
+" \"unsubscribe_page_id\": 1"
+" }"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true,
"backend_domain_id": 1234,
"unsubscribe_page_id": 1
}
};
fetch('https://us1.unione.io/en/transactional/api/v1/project/create.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/project/create.json
Creates a new project.
Parameters
Name | Type | Description |
---|---|---|
project | Required object |
Object with project properties. |
» name | Required string |
Project name, unique for user account. |
» country | Optional string |
ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country laws, e.g. GDPR for european countries. |
» send_enabled | Optional boolean |
Whether email sending is enabled for this project or not. |
» custom_unsubscribe_url_enabled | Optional boolean |
If it’s false then UniOne adds default unsubscribe footer to each email sent with API key of the project. If it’s true then appending default unsubscribe footer for this project is avoided and sending with custom unsubscribe url or even without unsubscribe url is permitted for the project. Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link is approved for the user account by support. More on this here. When custom_unsubscribe_url_enabled is skipped on creating a project, it’s value is taken from user |
» backend_domain_id | Optional integer |
A unique domain identifier which will determine the tracking domain or dedicated IP pool to be used by default. If the value is not specified, a default backend domain will be assigned for your account or project instead. |
» unsubscribe_page_id | Optional integer |
A unique identifier that defines the default unsubscribe page. If absent, the account/project will be assigned the system default unsubscribe page. |
200 Response
{
"status": "success",
"project_id": "6123462132634",
"project_api_key": "string"
}
Response Schema
HTTP Code 200:
Project created successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
project_id | Required string |
Unqiue project identifier, ASCII string up to 36 characters long. |
project_api_key | Required string |
API key of the project. You can use it instead of the user API key parameter in all methods except project/* methods. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
project-update
POST https://us1.unione.io/en/transactional/api/v1/project/update.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"project_id": "string",
"project_api_key": "string",
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true,
"backend_domain_id": 1234,
"unsubscribe_page_id": 1,
"email_counter": 0,
"email_counter_limit": 0,
"email_counter_mode": "default"
}
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"project_id" => "string",
"project_api_key" => "string",
"project" => [
"name" => "Project 1A",
"country" => "ES",
"send_enabled" => true,
"custom_unsubscribe_url_enabled" => true,
"backend_domain_id" => 1234,
"unsubscribe_page_id" => 1,
"email_counter" => 0,
"email_counter_limit" => 0,
"email_counter_mode" => "default"
]
];
try {
$response = $client->request('POST','project/update.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"project_id": "string",
"project_api_key": "string",
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true,
"backend_domain_id": 1234,
"unsubscribe_page_id": 1,
"email_counter": 0,
"email_counter_limit": 0,
"email_counter_mode": "default"
}
}
r = requests.post(base_url+'/project/update.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"project_id" => "string",
"project_api_key" => "string",
"project" => {
"name" => "Project 1A",
"country" => "ES",
"send_enabled" => true,
"custom_unsubscribe_url_enabled" => true,
"backend_domain_id" => 1234,
"unsubscribe_page_id" => 1,
"email_counter" => 0,
"email_counter_limit" => 0,
"email_counter_mode" => "default"
}
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/project/update.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\","
+" \"project\": {"
+" \"name\": \"Project 1A\","
+" \"country\": \"ES\","
+" \"send_enabled\": true,"
+" \"custom_unsubscribe_url_enabled\": true,"
+" \"backend_domain_id\": 1234,"
+" \"unsubscribe_page_id\": 1,"
+" \"email_counter\": 0,"
+" \"email_counter_limit\": 0,"
+" \"email_counter_mode\": \"default\""
+" }"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("project/update.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/project/update.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\","
+" \"project\": {"
+" \"name\": \"Project 1A\","
+" \"country\": \"ES\","
+" \"send_enabled\": true,"
+" \"custom_unsubscribe_url_enabled\": true,"
+" \"backend_domain_id\": 1234,"
+" \"unsubscribe_page_id\": 1,"
+" \"email_counter\": 0,"
+" \"email_counter_limit\": 0,"
+" \"email_counter_mode\": \"default\""
+" }"
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"project_id": "string",
"project_api_key": "string",
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true,
"backend_domain_id": 1234,
"unsubscribe_page_id": 1,
"email_counter": 0,
"email_counter_limit": 0,
"email_counter_mode": "default"
}
};
fetch('https://us1.unione.io/en/transactional/api/v1/project/update.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/project/update.json
Updates a project.
Parameters
Name | Type | Description |
---|---|---|
project_id | Optional string |
Unique project identifier. You should identify project to update either with project_id or with project_api_key field. But we recommend usage of project_id as a more secure option. |
project_api_key | Optional string |
Optional project API key. You should identify project to update either with project_id or with project_api_key field. But we recommend usage of project_id as a more secure option. |
project | Required object |
Object with project properties. |
» name | Required string |
Project name, unique for user account. |
» country | Optional string |
ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country laws, e.g. GDPR for european countries. |
» send_enabled | Optional boolean |
Whether email sending is enabled for this project or not. |
» custom_unsubscribe_url_enabled | Optional boolean |
If it’s false then UniOne adds default unsubscribe footer to each email sent with API key of the project. If it’s true then appending default unsubscribe footer for this project is avoided and sending with custom unsubscribe url or even without unsubscribe url is permitted for the project. Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link is approved for the user account by support. More on this here. When custom_unsubscribe_url_enabled is skipped on creating a project, it’s value is taken from user |
» backend_domain_id | Optional integer |
A unique domain identifier which will determine the tracking domain or dedicated IP pool to be used by default. If the value is not specified, a default backend domain will be assigned for your account or project instead. |
» unsubscribe_page_id | Optional integer |
A unique identifier that defines the default unsubscribe page. If absent, the account/project will be assigned the system default unsubscribe page. |
» email_counter | Optional integer |
Project’s email counter value. 0 value only is accepted (which means resetting the counter to zero), or refreshes automatically depending on the counter mode set with the ‘email_counter_mode’ parameter. If the request doesn’t contain the field or contains null, the limit value doesn’t change. |
» email_counter_limit | Optional integer |
Allows you to limit the number of emails sent by the project. The sending stops when the limit is reached. Any non-negative 64-bit integer is acceptable. Setting to 0 means no limit. If the request doesn’t contain the field or contains null, the limit value doesn’t change. |
» email_counter_mode | Optional any |
Sets the email counter mode. It allows you to choose whether the counter should reset automatically, or remain permanent. The following values are acceptable: ‘default’ - the counter resets to zero automatically at the beginning of each accounting period, ‘permanent’ - the counter never resets automatically. The reset can be done only manually by the user in the request with the passes 0 value in the email_counter field. If the request doesn’t contain the field or contains a null value, the limit value doesn’t change. |
200 Response
{
"status": "success",
"project_api_key": "string"
}
Response Schema
HTTP Code 200:
Project updated successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
project_api_key | Optional string |
API key of the project. Returned only if the project to update was identified by project_api_key. Not returned in case of updating by project_id. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
project-list
POST https://us1.unione.io/en/transactional/api/v1/project/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"project_id": "string",
"project_api_key": "string"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"project_id" => "string",
"project_api_key" => "string"
];
try {
$response = $client->request('POST','project/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"project_id": "string",
"project_api_key": "string"
}
r = requests.post(base_url+'/project/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"project_id" => "string",
"project_api_key" => "string"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/project/list.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("project/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/project/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"project_id": "string",
"project_api_key": "string"
};
fetch('https://us1.unione.io/en/transactional/api/v1/project/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/project/list.json
Lists projects.
Parameters
Name | Type | Description |
---|---|---|
project_id | Optional string |
Optional possibility to specify project_id to include only this project to list. |
project_api_key | Optional string |
Optional possibility to specify project_api_key to include only this project to list. |
200 Response
{
"status": "success",
"projects": [
{
"id": "6123462132634",
"api_key": "string",
"name": "Project 1A",
"country": "ES",
"reg_time": "2020-12-28 17:15:45",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true,
"backend_domain_id": 1234,
"email_counter": 0,
"email_counter_limit": 0,
"email_counter_mode": "default",
"unsubscribe_page_id": 1
}
]
}
Response Schema
HTTP Code 200:
Projects returned successfully.
Name | Type | Description |
---|---|---|
status | Optional string |
“success” string |
projects | Optional array |
Array of objects where each object represents one project. |
» id | Required string |
Unqiue project identifier, ASCII string up to 36 characters long. |
» api_key | Required string |
API key of the project. You can use it instead of the user API key parameter in all methods except project/* methods. |
» name | Required string |
Project name, unique for user account. |
» country | Required string |
ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country laws, e.g. GDPR for european countries. |
» reg_time | Required string(utc-date-time) |
Date and time of project creation in UTC timezone in “YYYY-MM-DD hh:mm:ss” format. |
» send_enabled | Required boolean |
Whether email sending is enabled for this project or not. |
» custom_unsubscribe_url_enabled | Required boolean |
If it’s false then UniOne adds default unsubscribe footer to each email sent with API key of the project. If it’s true then appending default unsubscribe footer for this project is avoided and sending with custom unsubscribe url or even without unsubscribe url is permitted for the project. Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link is approved for the user account by support. More on this here. When custom_unsubscribe_url_enabled is skipped on creating a project, it’s value is taken from user |
» backend_domain_id | Required integer |
A unique domain identifier which will determine the tracking domain or dedicated IP pool to be used by default. If the value is not specified, a default backend domain will be assigned for your account or project instead. |
» email_counter | Required integer |
Project’s email counter value. It increases on every email sent. |
» email_counter_limit | Required integer |
Allows you to limit the number of emails sent by the project. The sending stops when the limit is reached. Any non-negative 64-bit integer is acceptable. 0 means no limit. |
» email_counter_mode | Required any |
‘default’ - the counter resets to zero automatically at the beginning of each accounting period. ‘permanent’ - the counter never resets automatically. |
» unsubscribe_page_id | Required integer |
A unique identifier that defines the default unsubscribe page. If absent, the account/project will be assigned the system default unsubscribe page. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
project-delete
POST https://us1.unione.io/en/transactional/api/v1/project/delete.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"project_id": "string",
"project_api_key": "string"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"project_id" => "string",
"project_api_key" => "string"
];
try {
$response = $client->request('POST','project/delete.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"project_id": "string",
"project_api_key": "string"
}
r = requests.post(base_url+'/project/delete.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"project_id" => "string",
"project_api_key" => "string"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/project/delete.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("project/delete.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/project/delete.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"project_id": "string",
"project_api_key": "string"
};
fetch('https://us1.unione.io/en/transactional/api/v1/project/delete.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/project/delete.json
Deletes a project.
The project will be moved to the “trash bin” before being permanently deleted. You can restore the project by contacting support.
Parameters
Name | Type | Description |
---|---|---|
project_id | Optional string |
Unique project identifier. You should identify project to delete either with project_id or with project_api_key field. We recommend usage of project_id as a more secure option. |
project_api_key | Optional string |
Optional project API key. You should identify project to delete either with project_id or with project_api_key field. We recommend usage of project_id as a more secure option. |
200 Response
{
"status": "success"
}
Response Schema
HTTP Code 200:
Project deleted successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
System Methods
System operations.
system-info
POST https://us1.unione.io/en/transactional/api/v1/system/info.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [];
try {
$response = $client->request('POST','system/info.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {}
r = requests.post(base_url+'/system/info.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/system/info.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("system/info.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/system/info.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {};
fetch('https://us1.unione.io/en/transactional/api/v1/system/info.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/system/info.json
Gets user or project info by API key.
200 Response
{
"status": "success",
"user_id": 11344,
"email": "user@example.com",
"project_id": "6123462132634",
"project_name": "Project 1A",
"project_accounting": {
"email_counter": 0,
"email_counter_limit": 0,
"email_counter_mode": "default"
},
"accounting": {
"period_start": "2016-08-29 09:12:33",
"period_end": "2016-09-29 09:12:33",
"emails_included": 0,
"emails_sent": 0
}
}
Response Schema
HTTP Code 200:
User or project info successfully returned.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
user_id | Required integer |
Unique user identifier. |
Required string(email) |
Email of the user. | |
project_id | Optional string |
Unqiue project identifier, ASCII string up to 36 characters long. Present only if the API key used for request is the project API key. |
project_name | Optional string |
Project name, unique for user account. Present only if the API key used for request is the project API key. |
project_accounting | Optional object |
Object with email counter properties. Present only if the API key used for request is the user API key. |
» email_counter | Required integer |
Project’s email counter value. It increases on every email sent. |
» email_counter_limit | Required integer |
Allows you to limit the number of emails sent by the project. The sending stops when the limit is reached. Any non-negative 64-bit integer is acceptable. 0 means no limit. |
» email_counter_mode | Required any |
‘default’ - the counter resets to zero automatically at the beginning of each accounting period. ‘permanent’ - the counter never resets automatically. |
accounting | Optional object |
Object with accounting period properties. Present only if the API key used for request is the user API key. |
» period_start | Required string(utc-date-time) |
Date and time of accounting period start in UTC in “YYYY-MM-DD hh:mm:ss” format. |
» period_end | Required string(utc-date-time) |
Date and time of accounting period end in UTC in “YYYY-MM-DD hh:mm:ss” format. |
» emails_included | Required integer(int64) |
Number of emails included into accounting period. |
» emails_sent | Required integer(int64) |
Number of emails sent during accounting period. Can be bigger than emails_included in case of overage. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
Obsolete Methods
Obsolete methods dealing with unsubscribes. We recommend using the more flexible suppression methods instead. Note that you can’t resubscribe an unsubscribed recipient using WebAPI, but you can send him an email with subscription link using email/subscribe method.
unsubscribed-set
POST https://us1.unione.io/en/transactional/api/v1/unsubscribed/set.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"address": "user@example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"address" => "user@example.com"
];
try {
$response = $client->request('POST','unsubscribed/set.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"address": "user@example.com"
}
r = requests.post(base_url+'/unsubscribed/set.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"address" => "user@example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/unsubscribed/set.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"address\": \"user@example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("unsubscribed/set.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/unsubscribed/set.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"address\": \"user@example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"address": "user@example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/unsubscribed/set.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/unsubscribed/set.json
Registers a new unsubscribed email.
After registering an email as unsubscribed all future attempts to send a message to this email will be rejected. Please note that there’s no way to remove an email from unsubscribed thru the API. But you can send an email with a link to resubscribe using email/subscribe method or remove “unsubscribed” status manually on Email Search page in control panel (but only a limited number of unsubscribed email per day can be removed).
Parameters
Name | Type | Description |
---|---|---|
address | Required string(email) |
Email to be unsubscribed. |
200 Response
{
"status": "success",
"address": "user@example.com",
"message": "unsubscribed"
}
Response Schema
HTTP Code 200:
Email has been unsubscribed successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
address | Required string(email) |
The unsubscribed email. |
message | Required string |
Unsubscription process details:
|
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
unsubscribed-check
POST https://us1.unione.io/en/transactional/api/v1/unsubscribed/check.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"address": "user@example.com"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"address" => "user@example.com"
];
try {
$response = $client->request('POST','unsubscribed/check.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"address": "user@example.com"
}
r = requests.post(base_url+'/unsubscribed/check.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"address" => "user@example.com"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/unsubscribed/check.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"address\": \"user@example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("unsubscribed/check.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/unsubscribed/check.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"address\": \"user@example.com\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"address": "user@example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/unsubscribed/check.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/unsubscribed/check.json
Checks if an email is unsubscribed.
Parameters
Name | Type | Description |
---|---|---|
address | Required string(email) |
Email to check. |
200 Response
{
"status": "success",
"address": "user@example.com",
"is_unsubscribed": true
}
Response Schema
HTTP Code 200:
Email unsubscription status successfully returned.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
address | Required string(email) |
Email that was checked. |
is_unsubscribed | Required boolean |
true if unsubscribed, false if not. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
unsubscribed-list
POST https://us1.unione.io/en/transactional/api/v1/unsubscribed/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json
{
"date_from": "2020-10-14"
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);
$requestBody = [
"date_from" => "2020-10-14"
];
try {
$response = $client->request('POST','unsubscribed/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
import requests
base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}
request_body = {
"date_from": "2020-10-14"
}
r = requests.post(base_url+'/unsubscribed/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}
params = {
"date_from" => "2020-10-14"
}
begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/unsubscribed/list.json',
params.to_json,
headers
)
p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
class Program {
static HttpClient client;
public static void Main(string[] args) {
client = new HttpClient();
client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string requestBody = "{"
+" \"date_from\": \"2020-10-14\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
var response = client.PostAsync("unsubscribed/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/unsubscribed/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"date_from\": \"2020-10-14\""
+"}";
try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};
const inputBody = {
"date_from": "2020-10-14"
};
fetch('https://us1.unione.io/en/transactional/api/v1/unsubscribed/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /en/transactional/api/v1/unsubscribed/list.json
Returns a list of all unsubscribed emails since provided date.
Parameters
Name | Type | Description |
---|---|---|
date_from | Optional string(utc-date) |
Date in the format YYYY-MM-DD to get all unsubscribed emails from the “date_from” to the present day. If the parameter is not specified, the default period is today (from 00:00 UTC). |
200 Response
{
"status": "success",
"unsubscribed": [
{
"address": "user@example.com",
"unsubscribed_on": "2020-10-15 22:14:59"
}
]
}
Response Schema
HTTP Code 200:
The list of unsubscribed emails returned successfully.
Name | Type | Description |
---|---|---|
status | Required string |
“success” string |
unsubscribed | Required array |
Array of object describing unsubscribed emails. |
» address | Optional string(email) |
Unsubscribed email. |
» unsubscribed_on | Optional string(utc-date-time) |
Date and time when a recipient unsubscribed, in UTC timezone and “YYYY-MM-DD hh:mm:ss” format. |
HTTP Code default:
Error occured.
Name | Type | Description |
---|---|---|
status | Required string |
“error” string |
message | Required string |
Human-readable error message in English. |
code | Required integer |
API Error code. |
API Errors
HTTP/1.1 500 Internal Server Error
Content-Length: 90
Content-Type: application/json
Connection: Closed
{
"status": "error",
"code": 150,
"message": "Аn unknown internal error occurred"
}
When method call fails with HTTP code other than 200, usually a JSON object is returned also with more details:
Field | Type | Description |
---|---|---|
status | string | Always contains “error” string. |
code | integer | API error code (don’t confuse with HTTP code) |
message | string | Human-readable error message in English. |
Below you will find a list of almost all API error codes.
HTTP Code | API Code | Meaning and how to fix |
---|---|---|
401 | 101 | API key is not passed or empty. Make sure you have passed correct X-API-KEY header or ‘api_key’ JSON parameter. |
401 | 102 | Invalid key ‘$apiKey’. Use correct user API-key or project API key. |
403 | 105 | API is turned OFF. You can turn API on here. |
403 | 106 | User is inactive. To solve this problem, contact support. |
400 | 111 | JSON parsing error. Check your JSON request syntax. |
401 | 114 | The user has not been found. Please send the request to the host you have been registered at, us1.unione.io or eu1.unione.io. |
400 | 118 | No DNS TXT records found. Add a DNS verification record to your domain with values returned by domain/get-dns-records. |
500 | 120 | Internal DKIM validation error. Please contact support. |
400 | 121 | Timeout searching domain. DNS request has timed out. Please make sure your DNS provider is online and try again later. |
400 | 122 | DKIM record not found (almost the same as 120). Please add to your domain a DKIM record with key returned by domain/get-dns-records method. |
400 | 123 | DKIM record malformed. You should properly setup DKIM for your domain. |
400 | 124 | DKIM record does not match expected. Seems like you have changed the record. While it’s technically correct, it doesn’t match the one we expect. You should use DKIM key returned by domain/get-dns-records method. |
400 | 125 | There are several different DKIM keys in the DNS entry. Please setup the DKIM record for your domain properly. |
400 | 126 | There are other non-DKIM record types present in the DNS record. Please add a DKIM record for your domain with a key returned by domain/get-dns-records API method. |
400 | 127 | Main domain DKIM record limit reached. >A maximum of 10 DKIM records are allowed per primary domain. |
400 | 129 | Unknown DKIM validation error with reason distinct to the ones from 120-124 errors. Please check that you have correctly added a DKIM record with key returned by domain/get-dns-records method and try again. Please contact support if the error still occurs. |
400 | 130 | The domain is not allowed according to Registry policy. Please use another domain. |
500 | 150 | Аn unknown internal error occurred. Unknown error occurred. Please try again later or contact support. |
413 | 199 | Request is too large. The data in request should be no more than 10 MB. |
400 | 201 | The message body is missing. Check that your message body is being passed properly. |
400 | 202 | Sender email is missing. Enter the sender email. |
400 | 203 | Email subject is missing. Enter the subject. |
400 | 204 | Email recipients are passed improperly. Make sure that the recipient’s list is passed as an array where each recipient is an array with obligatory ‘email’ parameter. |
400 | 205 | Invalid sender email. Make sure the parameter is passed properly. |
400 | 206 | Sender email is not verified. To avoid this error please use an email on a verified domain. |
400 | 207 | MIME file type is incorrect. Check the file and the file type again. |
400 | 208 | Invalid attachment filename. Forbidden symbol ‘$symbol’. Rename files with the forbidden symbols. |
400 | 209 | The attached file names are duplicated. Rename files with the same names. |
400 | 210 | Inline attachment names are duplicated. Rename files with the same names. |
400 | 211 | Invalid inline attachment filename. Forbidden symbol ‘$symbol’. Rename files with the forbidden symbols. |
400 | 212 | Recipients passed improperly (‘substitutions’ array is not set). The possible maximum substitutions number has been exceeded or substitutions have incorrect filetype (string/integer is allowed). |
400 | 213 | Invalid or non-existent custom_backend_id. Please enter a valid ‘custom_backend_id’ parameter. |
403 | 215 | The user is not allowed to send. Try contacting support. |
400 | 216 | Recipients passed improperly. ‘Metadata’ value should be a string or integer. Array for ‘metadata’ key is expected. |
400 | 217 | Too many metadata fields passed. Maximum 10 metadata fields allowed. |
400 | 218 | Recipients passed improperly. Metadata key length should be less than 64. |
400 | 219 | Recipients passed improperly. Metadata value length should less than 1024. |
400 | 220 | Metadata key should not be blank. Make sure the metadata key is passed. |
400 | 221 | Thetag does not exist in the request or is invalid. Add the html <body> tag inside the <html> tag. The <body> tag is required to display HTML content. |
400 | 223 | The body is missing in the attachments ‘content’ or the void is transferred. Add the ‘content’ and specify a value for it. |
400 | 224 | Substitution name should contain only latin characters, numbers, “_” character and start with a letter. Make sure the substitution name is passed correctly. |
400 | 228 | Passing ‘smtp_pool_id’ requires passing ‘custom_backend_id’ also. Make sure the ‘custom_backend_id’ is passed. |
400 | 229 | Custom backend domain or tracking domain required for sending. Make sure the custom backend domain or tracking domain is passed. |
400 | 230 | Only default backend or tracking domain required for sending. Make sure the default backend or tracking domain is passed. |
400 | 227 | Invalid or non-existent ‘smtp_pool_id’. Please enter a valid ‘smtp_pool_id’ parameter. |
400 | 303 | Events list contains an unsupported value or the event is not supported. Verify that the event list is entered correctly. |
400 | 304 | Webhook with the specified URL has not been found. Make sure the URL is passed correctly. |
400 | 305 | URL is not passed. Make sure the URL is passed correctly. |
400 | 601 | Template has not been found. Check the passed template id. |
400 | 602 | The template name is missing. Check the passed template name. |
400 | 603 | Template name passed in the request already belongs to another template. Use another name for this template. |
400 | 604 | Maximum number of templates has been reached. Delete already created templates to create new ones. The number of templates is limited to 10000. |
400 | 701 | Cause not found. Invalid reason for blocking email. Please contact support. |
403 | 901 | Sending is blocked because limit is reached. Each user has a maximum daily limit for sending to prevent abuse. This limit increases automatically in case of good delivery and is reset each night. You can smoothly increase amount of daily sending or you can conact support and ask for manual limit increase. |
403 | 902 | Sending limit for free tariff is reached. Wait till next day or switch to paid tariff. |
403 | 903 | On free tariff you can send only to your own domains with confirmed verification record. Please confirm ownership of all domains you want to send emails to or switch tariff to the paid one. |
403 | 904 | Insufficient funds. Credit card transaction failure. Please try another card or contact support to resolve the situation. |
403 | 905 | You have reached the limit of emails included in your subscription plan. Usually tariff allows paid overage. In this case it’s prohibited, possibly due to unpaid invoice. Please check that all invoices are paid or contact support to solve the problem. |
400 | 906 | Exceeded the daily email reset limit. You have used the entire available block reset limit. Try it tomorrow or contact support to increase the limit. |
500 | 908 | Internal error, project owner not found. Please contact support. |
400 | 1000 | Missing recipient address. Specify the recipient address. |
400 | 1001 | Invalid recipient address value. Please enter a valid recipient address. |
400 | 1002 | Missing sender address. Specify the sender address. |
400 | 1003 | Sender address not verified. Verify the sender domain address. |
400 | 1004 | Invalid sender address value. Please enter a valid sender address. |
400 | 1005 | Sender name is too long. The sender name must be shorter. Please correct this value. |
400 | 1006 | Exceeded the daily limit of the email/subscribe method call. Try to repeat the call the next day. |
400 | 1100 | Missing domain name. Specify the domain to be verified. |
400 | 1101 | Invalid domain value. Please enter a valid domain value. |
400 | 1102 | Error in ‘domain’ field. Sending emails from the domain example.ru is prohibited. Please use another domain. |
400 | 1103 | Error in ‘domain’ field. Public free domains are not allowed. Use only your own domains. |
400 | 1200 | Missing domain name. Specify the domain for validating. |
400 | 1201 | Invalid domain value. Please enter a valid domain value. |
400 | 1202 | Domain is not registered in UniOne. Make a domain/get-dns-records method call. |
400 | 1301 | Invalid domain value. Specify the domain to be verified. |
400 | 1302 | Invalid limit value. The value of limit must be an integer in the range of 1 - 100. |
400 | 1303 | Invalid offset value. The value of offset must be greater than or equal to 0. |
400 | 1304 | Invalid offset value type. The value of offset must be an integer. |
400 | 1305 | Invalid limit value type. The value of limit must be an integer. |
400 | 1350 | Error in ‘domain’ field. This value should not be blank. Make sure the ‘domain’ is passed. |
400 | 1351 | Error in ‘domain’ field. This value ‘XXXXX’ is not a valid domain. Please enter a valid domain value. |
400 | 1352 | Error in ‘domain’ field. You don’t have domain ‘gmail.com’ added. Make sure the ‘domain’ is passed. |
400 | 1400 | Missing domain name. Specify the domain for validating. |
400 | 1401 | Invalid or non-existent domain. Either you have mistyped the domain name and should correct it or DNS changes have not yet propagated through DNS and you should wait a couple of hours and try again. There should be A, AAAA or MX record for domain. |
400 | 1402 | Domain is not registered in UniOne. Please call domain/get-dns-records method for domain to be registered. |
400 | 1506 | Error in ‘headers’ field. This value should have object type. Please check your JSON and use object for ‘headers’ field, not array or string or whatever. |
400 | 1507 | Error in ‘headers’ field. This container should contain over 50 elements. Please limit ‘headers’ to no more than 50 elements. |
400 | 1508 | Error in ‘template_id’ field. There is no template with this ID. Make sure the template ID is correct. |
400 | 1510 | Error in ‘body.html’ field. The value should have a string type. Use string type for ‘body.html’ parameter. |
400 | 1511 | Error in ‘body.plaintext’ field. The value should have a string type. Use string type for ‘body.plaintext’ parameter. |
400 | 1512 | Error in ‘body.amp’ field. The value should have a string type. Use string type for ‘body.amp’ parameter. |
400 | 1516 | Error in ‘body.html’ field. Substitutions contain invalid values. Check the correct substitutions in the ‘body.html’ field. |
400 | 1517 | Error in ‘body.plaintext’ field. Substitutions contain invalid values. Check the correct substitutions in the ‘body.plaintext’ field. |
400 | 1518 | Error in ‘body.amp’ field. Substitutions contain invalid values. Check the correct substitutions in the ‘body.amp’ field. |
400 | 1519 | Error in ‘reply_to’ field. The value should have a string type. Use string type for ‘reply_to’ parameter. |
400 | 1520 | Error in ‘reply_to’ field. Invalid email. Check if the email is correct. |
400 | 1521 | Error in ‘from_name’ field. The value should have a string type. Use string type for ‘from_name’ parameter. |
400 | 1522 | Error in ‘subject’ field. The value should have a string type. Use string type for ‘subject’ parameter. |
400 | 1523 | Error in ‘template_engine’ field. One of the two properties [‘velocity’ or ‘simple’] is required. Please pass only one of the two parameters: either ‘velocity’ or ‘simple’. |
400 | 1524 | Error in ‘recipients’ field. This container should contain over 500 elements. Please limit ‘recipients’ to no more than 500 elements. |
400 | 1525 | Error in ‘options.send_at’ field. Make sure the date and time of the scheduled sending is no more than 24 hours in advance. |
400 | 1526 | Error in ‘headers[“X-UNIONE-Template-Engine”]’ field. Invalid value, headers[“X-UNIONE-Template-Engine”] could be one of ‘velocity’ or ‘simple’. Please pass only one of the two parameters: either ‘velocity’ or ‘simple’. |
400 | 1527 | Error in ‘headers[“X-UNIONE-Global-Language”]’ field. Language is not allowed. Please pass only one of ‘ru’, ‘en’, ‘ua’, ‘be’, ‘es’, ‘fr’, ‘pl’, ‘de’, ‘pt’, ‘it’ values. |
400 | 1528 | Error in ‘global_language’ field. Language is not allowed. Please pass only one of ‘ru’, ‘en’, ‘ua’, ‘be’, ‘es’, ‘fr’, ‘pl’, ‘de’, ‘pt’, ‘it’ values. |
400 | 1529 | Error in ‘options.send_at’ field. This value should be greater than Aug NN, 2023, 3:10 PM. Make sure the datetime is passed correctly. |
400 | 1530 | Error in ‘options.send_at’ field. This value should be of type string or this value is not a valid datetime. Use string type for ‘options.send_at’ parameter. Make sure the datetime is passed correctly. |
400 | 1532 | This collection should contain 4 elements or less. Please limit tags to no more than 4 elements. |
400 | 1533 | Error in ‘tags’ field. You can not create any more tags. Max tags number is 10000 Delete already created tags to create new ones. The number of tags is limited to 10000. |
400 | 1534 | One or more tags is too long, max. 50 characters. The tags must be shorter. Please correct this value. |
400 | 1535 | One or more tags contains invalid symbols. Make sure the tags is passed correctly. |
400 | 1537 | Error in ‘bypass_global’ field. ‘bypass_global’ should be equal to 1. Set parameter value to 1. |
400 | 1538 | Error in ‘bypass_unsubscribed’ field. ‘bypass_unsubscribed’ usage is prohibited without ‘allow_skip_unsubscribe’ flag. contact support to set the flag. |
400 | 1539 | Error in ‘bypass_complained’ field. ‘bypass_complained’ usage is prohibited without ‘allow_skip_unsubscribe’ flag. contact support to set the flag. |
400 | 1540 | Error in ‘metadata’ field. The maximum allowable ‘metadata’ size is 4000 bytes. Metadata value size should less than 4000 bytes. |
400 | 1541 | Error in ‘global_metadata’ field. The maximum allowable ‘global_metadata’ size is 4000 bytes. Metadata value size should less than 4000 bytes. |
400 | 1542 | Error in ‘metadata and global_metadata’ field. The maximum allowable ‘global_metadata’ and ‘metadata’ size is 4000 bytes. Metadata value size should less than 4000 bytes. |
400 | 1543 | Error in ‘global_metadata.campaign_id’ field. This value should be of type string. Use string type for ‘global_metadata.campaign_id’ parameter. |
400 | 1544 | Error in ‘metadata.campaign_id’ field. This value should be of type string. Use string type for ‘metadata.campaign_id’ parameter. |
400 | 1545 | Error in ‘metadata.campaign_id’ field. Value ’ ’ is not a valid number or uuid Make sure the ‘metadata.campaign_id’ is passed correctly. |
400 | 1546 | Error in ‘subject’ field. Substitutions contain invalid values. Check the correct substitutions in the ‘subject’ field. |
400 | 1547 | Error in ‘from_name’ field. Substitutions contain invalid values. Check the correct substitutions in the ‘from_name’ field. |
400 | 1548, 2527 | Error in ‘options.unsubscribe_url’ field. This value should be of type object. Use object type for the ‘options.unsubscribe_url’ parameter. |
400 | 1549 | Error in ‘options.unsubscribe_url’ field. Invalid substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 1550 | Error in ‘options’ field. The value should have an object type. Use object type for the ‘options’ parameter. |
400 | 1551 | Error in ‘metadata or global_metadata collection’ field. The value parameter must be a string. Use string type for ‘metadata’ and ‘global_metadata’ parameters. |
400 | 1554 | Error in ‘headers[‘Cc’]’ field. The number of emails in “Cc” must not exceed ‘N’. Make sure that the number of emails in ‘headers[‘Cc’]’ is not exceeded. |
400 | 1555 | Error in ‘headers[‘Cc’]’ field. Email in “Cc” must not differ from recipient emails. Use only emails from the ‘recipient’ parameter. |
400 | 1556 | Error in ‘headers[‘Cc’]’ field. “Cc” header allows only with non empty “To” header. Make sure that the ‘headers[‘To’]’ is passed. |
400 | 1557 | Error in ‘headers[‘To’]’ field. The number of emails in “To” must not exceed %d. Make sure that the number of emails in ‘headers[‘To’]’ is not exceeded. |
400 | 1558 | Error in ‘headers[‘To’]’ field. Email in “To” must not differ from recipient emails. Use only emails from the ‘recipient’ parameter. |
400 | 1559 | Error in ‘recipients’ field. Email not exist in headers “To” or “Cc” or email domain is not confirmed BCC may contain only addresses on your verified domain. |
400 | 1560 | Error in ‘recipients’ field. Limit of ‘recipients’ must not be more then limit of sum of “To” and “Cc” emails. Make sure that the number of emails in “To” and “Cc” headers is not exceeded. |
400 | 1561 | Error in ‘headers[‘Cc’]’ field. Header ‘example’ is not valid Сc. Make sure the headers is passed correctly. |
400 | 1562 | Error in ‘headers[‘To’]’ field. Header ‘example’ is not valid To. Make sure the headers is passed correctly. |
400 | 1565 | Error in ‘body.html’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 1566 | Error in ‘subject’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 1567 | Error in ‘from_name’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 1568 | Error in ‘reply_to_name’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 1569 | Error in ‘body.plaintext’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 1570 | Error in ‘body.amp’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 1571 | Error in ‘options.unsubscribe_url’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 1572 | Error in ‘idempotence_key’ field. This value is too long. It should have 64 characters or less. The key must be shorter. Please correct this value. |
400 | 1573 | Error in ‘idempotence_key’ field. Error sending duplicate message with the same idempotence_key=‘xxxxxxxxxx’. Make sure the key is correct. |
400 | 1574 | Error in ‘from_email’ field. Denied ‘from_email’: example.com - use address from a confirmed domain. To avoid this error please use an email on a verified domain. |
400 | 1575 | User is not allowed to send. Try contacting support. |
400 | 1576 | Error in ‘subject’ field. This value should not be blank. Enter the subject. |
400 | 1577 | Error in ‘body’ field. No message body passed. Check that your message body is being passed properly. |
400 | 1578 | Error in ‘body.html’ field. No validtag format: tag is not valid or do not exist. Add the html <body> tag inside the <html> tag. The <body> tag is required to display HTML content. |
400 | 1579 | Error in ‘global_substitutions’ field. Maximum 2 substitutions allowed. The possible maximum substitutions number has been exceeded. |
400 | 1580 | Error in ‘global_substitutions’ field. Substitution name should contain latin characters, numbers or ‘_’ character and start with a letter. Make sure the substitution name is passed correctly. |
400 | 1581 | Error in ‘globalSubstitutions[CompanyRef]’ field. This value should satisfy at least one of the following constraints: [1] This value should be of type integer. [2] This value should be of type string. This value should be a string or integer. |
400 | 1582 | Error in ‘global_metadata’ field. This collection should contain 10 elements or less. Maximum 10 metadata fields allowed. |
400 | 1583 | Error in ‘global_substitutions’ field. Recipients passed improperly. ‘Metadata’ value should be a string or integer. |
400 | 1584 | Error in ‘global_metadata’ field. Global metadata key should not be blank. Make sure the metadata key is passed. |
400 | 1585 | Error in ‘global_metadata’ field. Global metadata key length should less than 64. Make sure the metadata key is passed correctly. |
400 | 1586 | Error in ‘global_metadata’ field. This value is too long. It should have 1024 characters or less. |
400 | 1587 | Error in ‘force_send’ field. No rights to use ‘force_send’ option. Try contacting support. |
400 | 1588 | **Error in ‘skip_unsubscribe’ field. No right for ‘skip_unsubscribe = 1’. ** Try contacting support. |
400 | 1590 | Error in ‘attachments.name’ field. Invalid filename: ‘IMG/1’. Forbidden symbol ‘/’. Rename files with the forbidden symbols. |
400 | 1591 | Error in ‘attachments’ field. Duplicated filename: ‘IMG1’. Rename files with the same names. |
400 | 1592 | Error in ‘attachments.content’ field. No attachment content passed, attachment filename: IMG1. Add the ‘content’ and specify a value for it. |
400 | 1593 | Error in ‘attachments.type’ field. Mime type of file IMG1 is skipped or empty. Check the file and the file type again. |
400 | 1594 | Error in ‘inline_attachments.name’ field. Invalid filename: ‘IMG/1’. Forbidden symbol ‘/’. Rename files with the forbidden symbols. |
400 | 1595 | Error in ‘inline_attachments’ field. Duplicated filename: ‘IMG1’. Rename files with the same names. |
400 | 1596 | Error in ‘inline_attachments.content’ field. No attachment content passed, attachment filename: IMG1. Add the ‘content’ and specify a value for it. |
400 | 1597 | Error in ‘inline_attachments.type’ field. Mime type of file IMG1 is skipped or empty. Check the file and the file type again. |
400 | 1601, 1701 | Error in the ‘project’ field. Project section is absent. Correct JSON structure. |
400 | 1602, 1702 | Error in the ‘name’ field. This value should not be blank. Use non-blank name. |
400 | 1603, 1703 | Error in the ‘name’ field. It should have ‘string’ type. Use string type for ‘name’ parameter. |
400 | 1604, 1704 | Error in the ‘name’ field. This value is too long. It should have 255 characters or less. Use shorter name. |
400 | 1605, 1705 | Error in the ‘name’ field. Project with such a name already exists. Use unique project name or delete existing project first. |
400 | 1606 | Error in the ‘send_enabled’ field. This value should be of type bool. Set parameter value to true or false only. |
400 | 1607 | Error in ‘custom_unsubscribe_url_enabled’ field. This value should be of type bool. Set parameter value to true or false only. |
400 | 1608, 1711 | Forbidden to use field ‘custom_unsubscribe_url_enabled’. Please contact support. |
400 | 1609, 1716 | Error in ‘country’ field. This value should be of type string. Use string type for ‘country’ parameter. |
400 | 1610, 1717 | Error in ‘country’ field. This value is not a valid country. Make sure the ISO-3166 alpha-2 country code is passed correctly. |
400 | 1611, 1718 | Error in ‘backend_domain_id’ field. This value should be of type int. Use int type for ‘backend_domain_id’ parameter. |
400 | 1612, 1719 | Error in ‘backend_domain_id’ field. The backend domain does not belong to the user. Please enter a valid ‘backend_domain_id’ parameter. |
400 | 1613, 1720 | Error in ‘backend_domain_id’ field. Backend domain is not active. Please enter a valid ‘backend_domain_id’ parameter. |
400 | 1614, 1726 | Error in ‘unsubscribe_page_id’ field. This value should be of type int. Use int type for ‘unsubscribe_page_id’ parameter. |
400 | 1706 | Error in ‘project_api_key’ field. One of the two properties [‘project_api_key’ or ‘project_id’] is required. Don’t forget to send either project_id or project_api_key. |
400 | 1707, 1802 | Error in the ‘project_api_key’ field. Project not found. Use correct project_api_key. You can get a list of projects with their keys with project/list method. |
400 | 1708 | Error in the ‘project_api_key’ field. The value should have a string type. Use string type for ‘project_api_key’. |
400 | 1709 | Error in the ‘send_enabled’ field. The value should have a bool type. Set parameter value to true or false only. |
400 | 1710 | Error in ‘custom_unsubscribe_url_enabled’ field. The value should have a bool type. Set parameter value to true or false only. |
400 | 1712, 1805, 1905 | Error in ‘project_id’ field. This value should be of type string. Please use string type for project_id field. |
400 | 1713, 1804 | Error in ‘project_api_key’ field. One of the two properties [‘project_api_key’ or ‘project_id’] must be empty Please pass only one of the two parameters: either project_id or project_api_key, not both. |
400 | 1714, 1806 | Error in ‘project_id’ field. Project with ID:‘NNNN’ not exists. Project id is invalid. Maybe it was deleted or never existed? |
400 | 1715, 1807 | Error in ‘project_id’ field. This value is not valid. Please check that you pass the project_id you have received by calling project/create method. |
400 | 1721 | Error in ‘email_counter’ field. This value should be of type int. Use int type for ‘email_counter’ parameter. |
400 | 1722 | Error in ‘email_counter’ field. This value should be equal to 0. Set parameter value equal to 0. |
400 | 1723 | Error in ‘email_counter_limit’ field. This value should be of type int. Use int type for ‘email_counter_limit’ parameter. |
400 | 1724 | Error in ‘email_counter_limit’ field. This value should be greater than or equal to 0. Set parameter value greater than or equal to 0. |
400 | 1725 | Error in ‘email_counter_mode’ field. This value should be of type bool. Set parameter value to default or permanent only. |
400 | 1801 | Error in ‘project_api_key’ field. One of the two properties [‘project_api_key’ or ‘project_id’] is required. Don’t forget to send either project_id or project_api_key. |
400 | 1803, 1902 | Error in the ‘project_api_key’ field. The value should have a string type. Use string type for ‘project_api_key’. |
400 | 1904 | Error in ‘project_id’ field. This value is not valid. The value should contain digits only. Use correct numbers-only format for ‘project_id’. |
400 | 2306 | Error in ‘recipients’ field. This value should not be blank. Make sure the ‘recipients’ is passed. |
400 | 2307 | Error in ‘recipients’ field. This value should be of type string. Use string type for ‘recipients’ parameter. |
400 | 2500 | Error in ‘editor_type’ field. ‘html’ is required. Make sure the ‘editor_type’ field is passed ‘html’. |
400 | 2501 | The template was created in a visual editor. Make sure the template is created in HTML editor. |
400 | 2502 | Error in ‘editor_type’ field. This value should not be blank. Pass ‘html’ in ‘editor_type’ field. |
400 | 2503 | Error in ‘id’ field. There is no template with this ID. Make sure the template ID is correct. |
400 | 2504 | Error in ‘headers’ field. This value should have object type. Please check your JSON and use object for ‘headers’ field, not array or string or whatever. |
400 | 2505 | Error in ‘headers’ field. This container should contain 50 elements or less. Please limit headers to no more than 50 elements. |
400 | 2514 | Error in ‘reply_to’ field. This value should be of type string. Use string type for ‘reply_to’ parameter. |
400 | 2515 | Error in ‘reply_to’ field. This value is not a valid email address. Check if the email is correct. |
400 | 2516 | Error in ‘template_engine’ field. One of the two properties [‘velocity’ or ‘simple’] is required. Please pass only one of the two parameters: either ‘velocity’ or ‘simple’. |
400 | 2517 | Error in ‘subject’ field. This value should be of type string. Use string type for ‘subject’ parameter. |
400 | 2518 | Error in ‘subject’ field. Substitutions contain invalid values. Check the correct substitutions in the ‘subject’ field. |
400 | 2519 | Error in ‘from_name’ field. This value should be of type string. Use string type for ‘from_name’ parameter. |
400 | 2520 | Error in ‘from_name’ field. Substitutions contain invalid values. Check the correct substitutions in the ‘from_name’ field. |
400 | 2521 | Error in ‘from_name’ field. Invalid velocity substitution format . Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 2522 | Error in ‘subject’ field. Invalid velocity substitution format . Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 2523 | Error in ‘reply_to_name’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 2524 | Error in ‘options’ field. This value should be of type string. Use string type for ‘options’ parameter. |
400 | 2525 | Error in ‘options.unsubscribe_url’ field. Invalid substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 2526 | Error in ‘options.unsubscribe_url’ field. Invalid velocity substitution format. Substitution name in body should contain latin characters, numbers or ‘_’ character and start with a letter". Make sure the substitution name is passed correctly. |
400 | 2600 | Error in ‘limit’ field. This value should be greater than or equal to 0. Set parameter value greater than or equal to 0. |
400 | 2601 | Error in ‘limit’ field. This value should be of type int. Use int type for ‘limit’ parameter. |
400 | 2602 | Error in ‘offset’ field. This value should be greater than or equal to 0. Set parameter value greater than or equal to 0. |
400 | 2603 | Error in ‘offset’ field. This value should be of type int. Use int type for ‘offset’ parameter. |
400 | 2700 | Error in ‘url’ field. This value should be of type string. Use string type for ‘url’ parameter. |
400 | 2701 | Error in ‘url’ field. This value should not be blank. Make sure the URL is passed. |
400 | 2702 | Error in ‘offset’ field. This value should be greater than or equal to 0. Set parameter value greater than or equal to 0. |
400 | 2703 | Error in ‘eventFormat’ field. The value you selected is not a valid choice. Use format ‘json_post’ or ‘json_post_gzip’ only. |
400 | 2704 | Error in ‘deliveryInfo’ field. ‘delivery_info’ value should be 1\0 either true\false. Set parameter ‘delivery_info’ value to 1\0 either true\false. |
400 | 2705 | Error in ‘singleEvent’ field. ‘single_event’ value should be 1\0 either true\false. Set parameter ‘single_event’ value to 1\0 either true\false. |
400 | 2706 | Error in ‘maxParallel’ field. This value should be of type int. Use int type for ‘maxParallel’ parameter. |
400 | 2707 | Error in ‘maxParallel’ field. This value should be between 5 and 100. Use a valid value of 5 to 100. |
400 | 2708 | Error in ‘events’ field. This value should be of type array. Use array type for ‘events’ parameter. |
400 | 2709 | Error in ‘events’ field. This value should not be blank. Use non-blank events. |
400 | 2710 | Error in ‘events’ field. Field ‘email_status’ is required. Add ‘email_status’ parameter. |
400 | 2711 | Error in ‘email_status’ field. This value ‘test’ is not a valid email_status. Add valid email statuses in the value. |
400 | 2712 | Error in ‘spam_block’ field. This value ‘test’ is not a valid spam_block. Add valid spam blocking events in the value. |
400 | 2713 | Error in ‘url’ field. Webhook domain name not found. Make sure the domain is passed correctly. |
400 | 2714 | Error in ‘status’ field. Invalid value, status could be one of ‘active’ or ‘disabled’. Set status ‘active’ or ‘disabled’. |
400 | 2715 | Error in ‘status’ field. This value should be of type string. Use string type for ‘status’ parameter. |
400 | 2800 | Error in ‘name’ field. This value should not be blank. Make sure the ‘name’ is passed. |
400 | 2801 | Error in ‘name’ field. The value should have a string type. Use string type for ‘name’ parameter. |
400 | 2802 | Error in ‘type’ field. The value should have a string type. Use string type for ‘type’ parameter. |
400 | 2803 | Error in ‘content’ field. The value should have a string type. Use string type for ‘content’ parameter. |
400 | 2804 | The size of the ‘content’ field must not exceed 7MB. Reduce the size of the ‘content’ field to 7MB (9786710 bytes in base64). |
400 | 2900, 3000, 3100 | Error in ‘email’ field. This value should not be blank. Make sure the email is passed. |
400 | 2901, 3001, 3101 | Error in ‘email’ field. This value should be of type string. Use string type for ‘email’ parameter. |
400 | 2902, 3002, 3102 | Error in ‘email’ field. This value is not a valid email address. Verify that email is entered correctly. |
400 | 2903 | Error in ‘all_projects’ field. This value should be of type bool. Set parameter value to true or false only. |
400 | 3003 | Error in ‘email’ field. Email doesn’t exist. Email was not found in the suppression list. |
400 | 3004 | Error in ‘email’ field. Email cannot be deleted. Email cannot be removed from the suppression list. Probably because of the severe reason like ‘blocked’. |
400 | 3103 | Error in ‘cause’ field. This value should not be blank. Make sure the ‘cause’ is passed. |
400 | 3104, 3200 | Error in ‘cause’ field. This value should be of type string. Use string type for ‘country’ parameter. |
400 | 3105, 3201 | Error in ‘cause’ field. Cause ‘test’ not allowed. Please pass only one of the available values. |
400 | 3106 | Error in ‘created’ field. This value should be of type string. Use string type for ‘created’ parameter. |
400 | 3107 | Error in ‘created’ field. This value is not a valid datetime. Make sure the datetime is passed correctly. |
400 | 3202 | Error in ‘source’ field. This value should be of type string. Use string type for ‘source’ parameter. |
400 | 3203 | Error in ‘source’ field. Source ‘test’ not allowed. Please pass only one of the available values. |
400 | 3204 | Error in ‘start_time’ field. This value should be of type string. Use string type for ‘start_time’ parameter. |
400 | 3205 | Error in ‘start_time’ field. This value is not a valid datetime. Make sure the datetime is passed correctly. |
400 | 3206 | Error in ‘cursor’ field. This value should be of type string. Use string type for ‘cursor’ parameter. |
400 | 3207 | Error in ‘cursor’ field. Cursor ‘test’ not allowed. Please pass only one of the available values. |
400 | 3208 | Error in ‘limit’ field. This value should be of type int. Use int type for ‘limit’ parameter. |
400 | 3209 | Error in ‘limit’ field. This value should be greater than or equal to 0. Set parameter value greater than or equal to 0. |
400 | 3300 | Error in ‘start_time’ field. This value should not be blank. Make sure the ‘start_time’ is passed. |
400 | 3301 | Error in ‘start_time’ field. This value is not a valid datetime. Make sure the datetime is passed correctly. |
400 | 3302 | Error in ‘end_time’ field. This value is not a valid datetime. Make sure the datetime is passed correctly. |
400 | 3303 | Error in ‘limit’ field. This value should be positive. Set parameter value greater than or equal to 0. |
400 | 3304 | Error in ‘format’ field. Incorrect value of the event dump file format. Use ‘csv’ or ‘csv_gzip’ format only. |
400 | 3305 | Error in ‘delimiter’ field. Incorrect value of the event dump file delimiter. Use ‘delimiter’ ‘;’ or ‘,’ only. |
400 | 3308 | Error in ‘all_projects’ field. The user does not have the required roles. Projects methods are disabled by default. To enable them,contact support. |
400 | 3309 | User can have no more than 10 event dumps at a time. Delete already created dumps to create new ones. The number of dumps is limited to 10. |
400 | 3310 | Error in ‘start_time’ field. The interval start date cannot be earlier than ‘$time’. Make sure ‘start_time’ is in the allowed range. |
400 | 3311 | Error in ‘limit’ field. This value should be of type integer. Use int type for ‘limit’ parameter. |
400 | 3312 | Error in ‘delimiter’ field. This value should be of type string. Use string type for ‘delimiter’ parameter. |
400 | 3313 | Error in ‘format’ field. This value should be of type string. Use string type for ‘format’ parameter. |
400 | 3315 | Error in ‘aggregate’ field. This value should be of type string. Use string type for ‘aggregate’ parameter. |
400 | 3316 | **Error in ‘filter’ field. Can not use filter with “aggregate” parameter. Please pass only one of the available parameter. |
400 | 3317 | Error in ‘dumpFields’ field. This value should be of type array. Use array type for ‘dumpFields’ parameter. |
400 | 3318 | Error in ‘dumpFields’ field. Incorrect fields of the event dump. Please pass only one of the available values. |
400 | 3319 | **Error in ‘aggregate’ field. Invalid value, aggregate could be only ‘day_status’ or empty. Please pass only one of the available values. |
400 | 3400 | Error in ‘filter’ field. This value should be of type object. Please check your JSON and use object for ‘filter’ field, not array or string or whatever. |
400 | 3401 | Error in ‘filter.job_id’ field. This value should be of type string. Use string type for ‘filter.job_id’ parameter. |
400 | 3402 | Error in ‘filter.status’ field. This value should be of type string. Use string type for ‘filter.status’ parameter. |
400 | 3403 | Error in ‘filter.status’ field. Status ‘dfdfs’ is invalid. Please enter a valid ‘filter.status’ parameter. |
400 | 3404 | Error in ‘filter.email’ field. This value should be of type string. Use string type for ‘filter.email’ parameter. |
400 | 3405 | Error in ‘filter.email’ field. This value ‘ewrewrew@dsfdfdds’ is not a valid email address. Check if the email is correct. |
400 | 3406 | Error in ‘filter.email_from’ field. This value should be of type string. Use string type for ‘filter.email_from’ parameter. |
400 | 3407 | Error in ‘filter.email_from’ field. This value ‘bitko82@gmailcom’ is not a valid email address. Check if the email is correct. |
400 | 3408 | Error in ‘filter.domain’ field. This value should be of type string. Use string type for ‘filter.domain’ parameter. |
400 | 3409 | Error in ‘filter.domain’ field. This value ‘test’ is not a valid domain. Please enter a valid domain value. |
400 | 3410 | Error in ‘filter.domain’ field. Domain ‘gmail.com’ different from the domain in the email. Make sure the domain is passed correctly. |
400 | 3411 | Error in ‘filter.delivery_status’ field. This value should be of type string. Use string type for ‘filter.delivery_status’ parameter. |
400 | 3412 | Error in ‘filter.delivery_status’ field. Status ‘63’ is invalid. Please enter a valid ‘filter.delivery_status’ parameter. |
400 | 3413 | Error in ‘filter.campaign_id’ field. This value should be of type string. Use string type for ‘filter.campaign_id’ parameter. |
400 | 3414 | Error in ‘filter.campaign_id’ field. Value ‘340282366920938463463374607431768211255999’ is invalid number. The data in request should be no more than 128 bit. |
400 | 3500, 3600 | Error in ‘dump_id’ field. This value should not be blank. Make sure the ‘dump_id’ is passed. |
400 | 3501, 3601 | Error in ‘dump_id’ field. This is not a valid UUID. Make sure the ‘dump_id’ is passed correctly. |
400 | 3502, 3602 | Error in ‘dump_id’ field. Event dump with ID ‘NNNN’ does not exist. Dump ID is invalid. Maybe it was deleted or never existed? |
400 | 3700 | This value should not be blank. Make sure the ‘tag_id’ is passed. |
400 | 3701 | This value should be of type int. Use int type for ‘tag_id’ parameter. |
400 | 3800 | Error in ‘email’ field. The maximum number of concurrent requests should not exceed 4. Reduce the the numbers of concurrent requests to 4. |
400 | 3801 | Error in ‘email’ field. This value should not be blank. Make sure the email is passed. |
400 | 3802 | Error in ‘email’ field. This value should be of type string. Use string type for ‘email’ parameter. |
400 | 3803 | Error in ‘email’ field. Exceeded the daily limit of the email-validation/single method call. Try to repeat the call the next day. |
400 | 3900 | Error in ‘idempotence_key’ field. This value should be of type string. Use string type for ‘idempotence_key’ parameter. |