NAV Navigation
UniOne Documentation
HTTP PHP Python Ruby C# Java Node.JS
 

Web API v1.64

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.

Authentication

Every method call requires authentication by providing user API key or project API key in either of two places:

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,
"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,
"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,
"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,
"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,"
+" \"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,"
+" \"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,
"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:

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.
»» email 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:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • headers[“List-Unsubscribe”]
  • options.unsubscribe_url
A substitution name can consist from latin characters, numbers and “_” symbol, and should start with the letter. There’s a special substitution “to_name” which is used to put recipent’s name like “Name Surname” to include it to SMTP header “To” in the form “Name Surname <email@example.com>”. The “to_name” length is limited to 78 symbols.
»» 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”. “none” is only available for emails with “track_links” and “track_read” equal to 0 and the unsubscription link turned off.
» 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:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” symbol, and should start with the letter.
» 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.
» 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
» track_read Optional
integer
1=read tracking is on (default), 0=read tracking is off.
» 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).
» 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” or “velocity”. 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:
  • unsubscribed - specified email is unsubscribed;
  • invalid - the email does not exist or has been entered incorrectly;
  • duplicate - the email already exists in the request, email duplicating is prevented;
  • temporary_unavailable - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
    1. a previous email has been rejected by the recipient’s server for spam;
    2. the recipient’s mailbox is full or is not used;
    3. recipient’s domain does not accept mail;
    4. sending server was rejected due to blacklisting;
  • permanent_unavailable - the email address is permanently unavailable or unsubscribed globally.
  • complained - the recipient reported spam in the previous emails;
  • blocked - sending to the email is prohibited by administration of UniOne.
We may added new statuses in the future.

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
email 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
email Required
string(email)
Email address to be checked.
result Required
string
Possible statuses:
  • “valid” - the address is valid,
  • “invalid” - the address is invalid,
  • “suspicious” - the address looks suspicious,
  • “unknown” - could not perform validation, the domain’s mail server has not responded within the time limit.
cause Required
string
Possible statuses:
  • “no_mx_record” - no MX record found for the target domain,
  • “syntax_error” - the address syntax is invalid,
  • “possible_typo” - the address is likely to have a typo,
  • “mailbox_not_found” - the address does not exist,
  • “global_suppression” - the address has been marked as unreachable due to multiple previous delivery errors,
  • “disposable” - this is a disposable one-time email address which is usually valid for a few minutes only,
  • “role” - the address is not likely to belong to an actual person, but rather to a certain business staff role,
  • “abuse” - the address is known to be a source of a large number of complaints, sometimes issued automatically,
  • “spamtrap” - this email is a spam trap, it is published openly but never used for actual emails. Sending messages to such addresses has a huge negative impact on reputation score,
  • “smtp_connection_failed” - the domain’s SMTP server does not respond; the address may contain a typo.
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:

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”. “none” is only available for emails with “track_links” and “track_read” equal to 0 and the unsubscription link turned off.
» 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:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” symbol, and should start with the letter.
» 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.
» 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
» track_read Optional
integer
1=read tracking is on (default), 0=read tracking is off.
» 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” or “velocity”. 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”. “none” is only available for emails with “track_links” and “track_read” equal to 0 and the unsubscription link turned off.
» 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:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” symbol, and should start with the letter.
» 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.
» 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
» track_read Optional
integer
1=read tracking is on (default), 0=read tracking is off.
» 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” or “velocity”. 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”. “none” is only available for emails with “track_links” and “track_read” equal to 0 and the unsubscription link turned off.
» 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:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” symbol, and should start with the letter.
» 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.
» 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
» track_read Optional
integer
1=read tracking is on (default), 0=read tracking is off.
» 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” or “velocity”. 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”. “none” is only available for emails with “track_links” and “track_read” equal to 0 and the unsubscription link turned off.
» 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:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” symbol, and should start with the letter.
» 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.
» 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
» track_read Optional
integer
1=read tracking is on (default), 0=read tracking is off.
» 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” or “velocity”. 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:

  1. transactional_email_status - email delivery status change event. You can subscribe to selected statuses only.
  2. 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”.
»»» email 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
email Required
string(email)
Email to add in suppression list.
cause Required
string
Cause of email being suppressed. One of:
  • unsubscribed - email is unsubscribed;
  • temporary_unavailable - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
    1. a previous email has been rejected by the recipient’s server for spam;
    2. the recipient’s mailbox is full or is not used;
    3. recipient’s domain does not accept mail;
    4. sending server was rejected due to blacklisting;
  • permanent_unavailable - the email address is permanently unavailable due to multiple hard bounces;
  • complained - the recipient reported spam in the previous emails;
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
email 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
email 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:
  • unsubscribed - email is unsubscribed;
  • temporary_unavailable - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
    1. a previous email has been rejected by the recipient’s server for spam;
    2. the recipient’s mailbox is full or is not used;
    3. recipient’s domain does not accept mail;
    4. sending server was rejected due to blacklisting;
  • permanent_unavailable - the email address is permanently unavailable due to multiple hard bounces;
  • complained - the recipient reported spam in the previous emails;
  • blocked - sending to the email is prohibited by administration of UniOne.
We may add some new causes in the future.
» source Required
string
Source of email being suppressed. One of:
  • user - suppressed by user with suppression/set;
  • system - sending to the email is prohibited by system, for example due to multiple hard bounces;
  • subscriber - the recipient reported spam or unsubscribed in the previous emails.
» 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:
  • unsubscribed - email is unsubscribed;
  • temporary_unavailable - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
    1. a previous email has been rejected by the recipient’s server for spam;
    2. the recipient’s mailbox is full or is not used;
    3. recipient’s domain does not accept mail;
    4. sending server was rejected due to blacklisting;
  • permanent_unavailable - the email address is permanently unavailable due to multiple hard bounces;
  • complained - the recipient reported spam in the previous emails;
  • blocked - sending to the email is prohibited by administration of UniOne.
We may add some new causes in the future.
source Optional
string
Source of email being suppressed. One of:
  • user - suppressed by user with suppression/set;
  • system - sending to the email is prohibited by system, for example due to multiple hard bounces;
  • subscriber - the recipient reported spam or unsubscribed in the previous emails.
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.
» email Optional
string(email)
Email to get suppression details for.
» cause Required
string
Cause of email being suppressed. One of:
  • unsubscribed - email is unsubscribed;
  • temporary_unavailable - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.:
    1. a previous email has been rejected by the recipient’s server for spam;
    2. the recipient’s mailbox is full or is not used;
    3. recipient’s domain does not accept mail;
    4. sending server was rejected due to blacklisting;
  • permanent_unavailable - the email address is permanently unavailable due to multiple hard bounces;
  • complained - the recipient reported spam in the previous emails;
  • blocked - sending to the email is prohibited by administration of UniOne.
We may add some new causes in the future.
» source Required
string
Source of email being suppressed. One of:
  • user - suppressed by user with suppression/set;
  • system - sending to the email is prohibited by system, for example due to multiple hard bounces;
  • subscriber - the recipient reported spam or unsubscribed in the previous emails.
» 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
email 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:

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"

Syntax requirements of different DNS providers may differ:

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.

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.
» email 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:
  • day_status - fetch aggregated statistics (the filter value must be missing or empty, as filters are not allowed with this option);
  • an empty string - used by default, event_dump/create works as if the aggregate parameter is omitted.
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:
  • queued - the task is in the queue, processing is not started yet;
  • in_process - the request is being processed;
  • ready - the task is finished, dump file is ready for download;
  • failed - processing failed due to an internal error.
» 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:
  • queued - the task is in the queue, processing is not started yet;
  • in_process - the request is being processed;
  • ready - the task is finished, dump file is ready for download;
  • failed - processing failed due to an internal error.
» 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