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

Web API v1.36

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": "email61324",
"customer_hash": "b253ac7"
}
}
],
"template_id": "string",
"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",
"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=="
}
],
"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" => "email61324",
"customer_hash" => "b253ac7"
]
]
],
"template_id" => "string",
"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",
"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=="
]
],
"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": "email61324",
"customer_hash": "b253ac7"
}
}
],
"template_id": "string",
"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",
"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=="
}
],
"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" => "email61324",
"customer_hash" => "b253ac7"
}
}
],
"template_id" => "string",
"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",
"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=="
}
],
"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\": \"email61324\","
+" \"customer_hash\": \"b253ac7\""
+" }"
+" }"
+" ],"
+" \"template_id\": \"string\","
+" \"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\","
+" \"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==\""
+" }"
+" ],"
+" \"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\": \"email61324\","
+" \"customer_hash\": \"b253ac7\""
+" }"
+" }"
+" ],"
+" \"template_id\": \"string\","
+" \"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\","
+" \"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==\""
+" }"
+" ],"
+" \"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": "email61324",
"customer_hash": "b253ac7"
}
}
],
"template_id": "string",
"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",
"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=="
}
],
"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 “_” or “-” symbols, 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.
» 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.
» 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”.
» template_engine Optional
string
The template engine for handling the substitutions(merge tags), “simple” or “velocity”. Default value is “simple”.
» global_substitutions Optional
object
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” or “-” symbols, 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 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)
» 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. 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”.
»» 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”
»» 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. Contact support to get the right for the account or project to use this option and the IDs of your backend-domains.
»» smtp_pool_id Optional
string(uuid)
SMTP pool identifier to send message with. If smtp_pool_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 to choose sending using dedicated IP or common pool. Contact support to get SMTP identifiers of common pool and your dedicated SMTP.

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.

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

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.

Restrictions:

Parameters

Name Type Description
template Required
object
Object with all the template properties.
» 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” or “velocity”. Default value is “simple”.
» global_substitutions Optional
object
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” or “-” symbols, 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)
» 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. 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”.
»» 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”
»» 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",
"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 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” or “velocity”. Default value is “simple”.
» global_substitutions Optional
object
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” or “-” symbols, 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)
» 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. 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”.
»» 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”
»» 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",
"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 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” or “velocity”. Default value is “simple”.
» global_substitutions Optional
object
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” or “-” symbols, 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)
» 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. 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”.
»» 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”
»» 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",
"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” or “velocity”. Default value is “simple”.
» global_substitutions Optional
object
Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in object “substitutions”, the values of the variables will be taken from the object “substitutions”. The substitutions can be used in the following parameters:
  • body.html
  • body.plaintext
  • body.amp
  • subject
  • from_name
  • options.unsubscribe_url
A substitution name can consist from latin characeters, numbers and “_” or “-” symbols, 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)
» 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. 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”.
»» 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”
»» 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 (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",
"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",
"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",
"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",
"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\","
+" \"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\","
+" \"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",
"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",
"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” or “spam”.
opened — the message has been delivered and read. It can be changed to “clicked”, “unsubscribed” 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” or “spam”.
unsubscribed — the message has been delivered to the recipient and read, but then the recipient unsubscribed. The status is final.
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 Required
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_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",
"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",
"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.

Unsubscribed Methods

Methods dealing with unsubscribes. Note that you can’t resubscribe an unsubcribed recipient using WebAPI, but you can send him an email with subscription link using email/subscribe method. The unsubscribe methods are outdate, we recommend using the more flexible suppression methods instead.

unsubscribed-set

POST https://us1.unione.io/en/transactional/api/v1/unsubscribed/set.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json

{
"address": "user@example.com"
}
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);

$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);

$requestBody = [
"address" => "user@example.com"
];

try {
$response = $client->request('POST','unsubscribed/set.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
import requests

base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}

request_body = {
"address": "user@example.com"
}
r = requests.post(base_url+'/unsubscribed/set.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}

params = {
"address" => "user@example.com"
}

begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/unsubscribed/set.json',
params.to_json,
headers
)

p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

class Program {
static HttpClient client;

public static void Main(string[] args) {
client = new HttpClient();

client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));

string requestBody = "{"
+" \"address\": \"user@example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");

var response = client.PostAsync("unsubscribed/set.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/unsubscribed/set.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"address\": \"user@example.com\""
+"}";

try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};

const inputBody = {
"address": "user@example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/unsubscribed/set.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

POST /en/transactional/api/v1/unsubscribed/set.json

Registers a new unsubscribed email.

After registering an email as unsubscribed all future attempts to send a message to this email will be rejected. Please note that there’s no way to remove an email from unsubscribed thru the API. But you can send an email with a link to resubscribe using email/subscribe method or remove “unsubscribed” status manually on Email Search page in control panel (but only a limited number of unsubscribed email per day can be removed).

Parameters

Name Type Description
address Required
string(email)
Email to be unsubscribed.

200 Response

{
"status": "success",
"address": "user@example.com",
"message": "unsubscribed"
}

Response Schema

HTTP Code 200:

Email has been unsubscribed successfully.

Name Type Description
status Required
string
“success” string
address Required
string(email)
The unsubscribed email.
message Required
string
Unsubscription process details:
  • “unsubscribed” if email has just been unsubscribed,
  • “was inactive” if it was inactive due some reason,
  • “was unsubscribed” if it already was unsubscribed before the call,
  • “added and unsubscribed” if it’s a new email without status history and it was added and then unsubscribed immediately.

HTTP Code default:

Error occured.

Name Type Description
status Required
string
“error” string
message Required
string
Human-readable error message in English.
code Required
integer
API Error code.

unsubscribed-check

POST https://us1.unione.io/en/transactional/api/v1/unsubscribed/check.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json

{
"address": "user@example.com"
}
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);

$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);

$requestBody = [
"address" => "user@example.com"
];

try {
$response = $client->request('POST','unsubscribed/check.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
import requests

base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}

request_body = {
"address": "user@example.com"
}
r = requests.post(base_url+'/unsubscribed/check.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}

params = {
"address" => "user@example.com"
}

begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/unsubscribed/check.json',
params.to_json,
headers
)

p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

class Program {
static HttpClient client;

public static void Main(string[] args) {
client = new HttpClient();

client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));

string requestBody = "{"
+" \"address\": \"user@example.com\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");

var response = client.PostAsync("unsubscribed/check.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/unsubscribed/check.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"address\": \"user@example.com\""
+"}";

try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};

const inputBody = {
"address": "user@example.com"
};
fetch('https://us1.unione.io/en/transactional/api/v1/unsubscribed/check.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

POST /en/transactional/api/v1/unsubscribed/check.json

Checks if an email is unsubscribed.

Parameters

Name Type Description
address Required
string(email)
Email to check.

200 Response

{
"status": "success",
"address": "user@example.com",
"is_unsubscribed": true
}

Response Schema

HTTP Code 200:

Email unsubscription status successfully returned.

Name Type Description
status Required
string
“success” string
address Required
string(email)
Email that was checked.
is_unsubscribed Required
boolean
true if unsubscribed, false if not.

HTTP Code default:

Error occured.

Name Type Description
status Required
string
“error” string
message Required
string
Human-readable error message in English.
code Required
integer
API Error code.

unsubscribed-list

POST https://us1.unione.io/en/transactional/api/v1/unsubscribed/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json

{
"date_from": "2020-10-14"
}
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);

$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);

$requestBody = [
"date_from" => "2020-10-14"
];

try {
$response = $client->request('POST','unsubscribed/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
import requests

base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}

request_body = {
"date_from": "2020-10-14"
}
r = requests.post(base_url+'/unsubscribed/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}

params = {
"date_from" => "2020-10-14"
}

begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/unsubscribed/list.json',
params.to_json,
headers
)

p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

class Program {
static HttpClient client;

public static void Main(string[] args) {
client = new HttpClient();

client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));

string requestBody = "{"
+" \"date_from\": \"2020-10-14\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");

var response = client.PostAsync("unsubscribed/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/unsubscribed/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"date_from\": \"2020-10-14\""
+"}";

try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};

const inputBody = {
"date_from": "2020-10-14"
};
fetch('https://us1.unione.io/en/transactional/api/v1/unsubscribed/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

POST /en/transactional/api/v1/unsubscribed/list.json

Returns a list of all unsubscribed emails since provided date.

Parameters

Name Type Description
date_from Optional
string(utc-date)
Date in the format YYYY-MM-DD to get all unsubscribed emails from the “date_from” to the present day. If the parameter is not specified, the default period is today (from 00:00 UTC).

200 Response

{
"status": "success",
"unsubscribed": [
{
"address": "user@example.com",
"unsubscribed_on": "2020-10-15 22:14:59"
}
]
}

Response Schema

HTTP Code 200:

The list of unsubscribed emails returned successfully.

Name Type Description
status Required
string
“success” string
unsubscribed Required
array
Array of object describing unsubscribed emails.
» address Optional
string(email)
Unsubscribed email.
» unsubscribed_on Optional
string(utc-date-time)
Date and time when a recipient unsubscribed, in UTC timezone and “YYYY-MM-DD hh:mm:ss” format.

HTTP Code default:

Error occured.

Name Type Description
status Required
string
“error” string
message Required
string
Human-readable error message in English.
code Required
integer
API Error code.

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": [
{
"project_id": "6123462132634",
"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.
» 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.
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.

Project Methods

Projects allow you to group several independent domains, webhooks, templates, and unsubscription lists together. It’s very useful if you have your own clients and manage their data from a single UniOne account. Each project receives its own API key, and all API calls with that API key only deal with the data of that project. This way, you can assign a separate project for each client and be sure that they won’t conflict; e.g. unsubscribing from one project won’t affect another.

Projects methods are disabled by default due to antispam measures. To enable them, contact support.

Please note that sending domains are confirmed and used on per-project basis by default. But it’s possible to allow projects to send emails from domains confirmed for main account - just ask support to enable it.

project-create

POST https://us1.unione.io/en/transactional/api/v1/project/create.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json

{
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true
}
}
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);

$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);

$requestBody = [
"project" => [
"name" => "Project 1A",
"country" => "ES",
"send_enabled" => true,
"custom_unsubscribe_url_enabled" => true
]
];

try {
$response = $client->request('POST','project/create.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
import requests

base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}

request_body = {
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true
}
}
r = requests.post(base_url+'/project/create.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}

params = {
"project" => {
"name" => "Project 1A",
"country" => "ES",
"send_enabled" => true,
"custom_unsubscribe_url_enabled" => true
}
}

begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/project/create.json',
params.to_json,
headers
)

p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

class Program {
static HttpClient client;

public static void Main(string[] args) {
client = new HttpClient();

client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));

string requestBody = "{"
+" \"project\": {"
+" \"name\": \"Project 1A\","
+" \"country\": \"ES\","
+" \"send_enabled\": true,"
+" \"custom_unsubscribe_url_enabled\": true"
+" }"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");

var response = client.PostAsync("project/create.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/project/create.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"project\": {"
+" \"name\": \"Project 1A\","
+" \"country\": \"ES\","
+" \"send_enabled\": true,"
+" \"custom_unsubscribe_url_enabled\": true"
+" }"
+"}";

try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};

const inputBody = {
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true
}
};
fetch('https://us1.unione.io/en/transactional/api/v1/project/create.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

POST /en/transactional/api/v1/project/create.json

Creates a new project.

Parameters

Name Type Description
project Required
object
Object with project properties.
» name Required
string
Project name, unique for user account.
» country Optional
string
ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country laws, e.g. GDPR for european countries.
» send_enabled Optional
boolean
Whether email sending is enabled for this project or not.
» custom_unsubscribe_url_enabled Optional
boolean
If it’s false then UniOne adds default unsubscribe footer to each email sent with API key of the project. If it’s true then appending default unsubscribe footer for this project is avoided and sending with custom unsubscribe url or even without unsubscribe url is permitted for the project. Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link is approved for the user account by support. More on this here. When custom_unsubscribe_url_enabled is skipped on creating a project, it’s value is taken from user

200 Response

{
"status": "success",
"project_id": "6123462132634",
"project_api_key": "string"
}

Response Schema

HTTP Code 200:

Project created successfully.

Name Type Description
status Required
string
“success” string
project_id Required
string
Unqiue project identifier, ASCII string up to 36 characters long.
project_api_key Required
string
API key of the project. You can use it instead of the user API key parameter in all methods except project/* methods.

HTTP Code default:

Error occured.

Name Type Description
status Required
string
“error” string
message Required
string
Human-readable error message in English.
code Required
integer
API Error code.

project-update

POST https://us1.unione.io/en/transactional/api/v1/project/update.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json

{
"project_id": "string",
"project_api_key": "string",
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true
}
}
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);

$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);

$requestBody = [
"project_id" => "string",
"project_api_key" => "string",
"project" => [
"name" => "Project 1A",
"country" => "ES",
"send_enabled" => true,
"custom_unsubscribe_url_enabled" => true
]
];

try {
$response = $client->request('POST','project/update.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
import requests

base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}

request_body = {
"project_id": "string",
"project_api_key": "string",
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true
}
}
r = requests.post(base_url+'/project/update.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}

params = {
"project_id" => "string",
"project_api_key" => "string",
"project" => {
"name" => "Project 1A",
"country" => "ES",
"send_enabled" => true,
"custom_unsubscribe_url_enabled" => true
}
}

begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/project/update.json',
params.to_json,
headers
)

p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

class Program {
static HttpClient client;

public static void Main(string[] args) {
client = new HttpClient();

client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));

string requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\","
+" \"project\": {"
+" \"name\": \"Project 1A\","
+" \"country\": \"ES\","
+" \"send_enabled\": true,"
+" \"custom_unsubscribe_url_enabled\": true"
+" }"
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");

var response = client.PostAsync("project/update.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/project/update.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\","
+" \"project\": {"
+" \"name\": \"Project 1A\","
+" \"country\": \"ES\","
+" \"send_enabled\": true,"
+" \"custom_unsubscribe_url_enabled\": true"
+" }"
+"}";

try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};

const inputBody = {
"project_id": "string",
"project_api_key": "string",
"project": {
"name": "Project 1A",
"country": "ES",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true
}
};
fetch('https://us1.unione.io/en/transactional/api/v1/project/update.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

POST /en/transactional/api/v1/project/update.json

Updates a project.

Parameters

Name Type Description
project_id Optional
string
Unique project identifier. You should identify project to update either with project_id or with project_api_key field. But we recommend usage of project_id as a more secure option.
project_api_key Optional
string
Optiona project API key. You should identify project to update either with project_id or with project_api_key field. But we recommend usage of project_id as a more secure option.
project Required
object
Object with project properties.
» name Required
string
Project name, unique for user account.
» country Optional
string
ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country laws, e.g. GDPR for european countries.
» send_enabled Optional
boolean
Whether email sending is enabled for this project or not.
» custom_unsubscribe_url_enabled Optional
boolean
If it’s false then UniOne adds default unsubscribe footer to each email sent with API key of the project. If it’s true then appending default unsubscribe footer for this project is avoided and sending with custom unsubscribe url or even without unsubscribe url is permitted for the project. Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link is approved for the user account by support. More on this here. When custom_unsubscribe_url_enabled is skipped on creating a project, it’s value is taken from user

200 Response

{
"status": "success",
"project_api_key": "string"
}

Response Schema

HTTP Code 200:

Project updated successfully.

Name Type Description
status Required
string
“success” string
project_api_key Optional
string
API key of the project. Returned only if the project to update was identified by project_api_key. Not returned in case of updating by project_id.

HTTP Code default:

Error occured.

Name Type Description
status Required
string
“error” string
message Required
string
Human-readable error message in English.
code Required
integer
API Error code.

project-list

POST https://us1.unione.io/en/transactional/api/v1/project/list.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json

{
"project_id": "string",
"project_api_key": "string"
}
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);

$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);

$requestBody = [
"project_id" => "string",
"project_api_key" => "string"
];

try {
$response = $client->request('POST','project/list.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
import requests

base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}

request_body = {
"project_id": "string",
"project_api_key": "string"
}
r = requests.post(base_url+'/project/list.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}

params = {
"project_id" => "string",
"project_api_key" => "string"
}

begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/project/list.json',
params.to_json,
headers
)

p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

class Program {
static HttpClient client;

public static void Main(string[] args) {
client = new HttpClient();

client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));

string requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");

var response = client.PostAsync("project/list.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/project/list.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\""
+"}";

try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};

const inputBody = {
"project_id": "string",
"project_api_key": "string"
};
fetch('https://us1.unione.io/en/transactional/api/v1/project/list.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

POST /en/transactional/api/v1/project/list.json

Lists projects.

Parameters

Name Type Description
project_id Optional
string
Optional possibility to specify project_id to include only this project to list.
project_api_key Optional
string
Optional possibility to specify project_api_key to include only this project to list.

200 Response

{
"status": "success",
"projects": [
{
"id": "6123462132634",
"api_key": "string",
"name": "Project 1A",
"country": "ES",
"reg_time": "2020-12-28 17:15:45",
"send_enabled": true,
"custom_unsubscribe_url_enabled": true
}
]
}

Response Schema

HTTP Code 200:

Projects returned successfully.

Name Type Description
status Optional
string
“success” string
projects Optional
array
Array of objects where each object represents one project.
» id Required
string
Unqiue project identifier, ASCII string up to 36 characters long.
» api_key Required
string
API key of the project. You can use it instead of the user API key parameter in all methods except project/* methods.
» name Optional
string
Project name, unique for user account.
» country Optional
string
ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country laws, e.g. GDPR for european countries.
» reg_time Required
string(utc-date-time)
Date and time of project creation in UTC timezone in “YYYY-MM-DD hh:mm:ss” format.
» send_enabled Optional
boolean
Whether email sending is enabled for this project or not.
» custom_unsubscribe_url_enabled Optional
boolean
If it’s false then UniOne adds default unsubscribe footer to each email sent with API key of the project. If it’s true then appending default unsubscribe footer for this project is avoided and sending with custom unsubscribe url or even without unsubscribe url is permitted for the project. Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link is approved for the user account by support. More on this here. When custom_unsubscribe_url_enabled is skipped on creating a project, it’s value is taken from user

HTTP Code default:

Error occured.

Name Type Description
status Required
string
“error” string
message Required
string
Human-readable error message in English.
code Required
integer
API Error code.

project-delete

POST https://us1.unione.io/en/transactional/api/v1/project/delete.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json

{
"project_id": "string",
"project_api_key": "string"
}
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);

$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);

$requestBody = [
"project_id" => "string",
"project_api_key" => "string"
];

try {
$response = $client->request('POST','project/delete.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
import requests

base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}

request_body = {
"project_id": "string",
"project_api_key": "string"
}
r = requests.post(base_url+'/project/delete.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}

params = {
"project_id" => "string",
"project_api_key" => "string"
}

begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/project/delete.json',
params.to_json,
headers
)

p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

class Program {
static HttpClient client;

public static void Main(string[] args) {
client = new HttpClient();

client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));

string requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\""
+"}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");

var response = client.PostAsync("project/delete.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/project/delete.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{"
+" \"project_id\": \"string\","
+" \"project_api_key\": \"string\""
+"}";

try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(responseCode);
System.out.println(response.toString());
const fetch = require('node-fetch');
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-API-KEY':'API_KEY'
};

const inputBody = {
"project_id": "string",
"project_api_key": "string"
};
fetch('https://us1.unione.io/en/transactional/api/v1/project/delete.json',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

POST /en/transactional/api/v1/project/delete.json

Deletes a project.

The project will be moved to the “trash bin” before being permanently deleted. You can restore the project by contacting support.

Parameters

Name Type Description
project_id Optional
string
Unique project identifier. You should identify project to delete either with project_id or with project_api_key field. We recommend usage of project_id as a more secure option.
project_api_key Optional
string
Optional project API key. You should identify project to delete either with project_id or with project_api_key field. We recommend usage of project_id as a more secure option.

200 Response

{
"status": "success"
}

Response Schema

HTTP Code 200:

Project deleted successfully.

Name Type Description
status Required
string
“success” string

HTTP Code default:

Error occured.

Name Type Description
status Required
string
“error” string
message Required
string
Human-readable error message in English.
code Required
integer
API Error code.

System Methods

System operations.

system-info

POST https://us1.unione.io/en/transactional/api/v1/system/info.json HTTP/1.1
Host: us1.unione.io
Content-Type: application/json
Accept: application/json

{}
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY',
);

$client = new \GuzzleHttp\Client([
'base_uri' => 'https://us1.unione.io/en/transactional/api/v1/'
]);

$requestBody = [];

try {
$response = $client->request('POST','system/info.json', array(
'headers' => $headers,
'json' => $requestBody,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
import requests

base_url = 'https://us1.unione.io/en/transactional/api/v1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-API-KEY': 'API_KEY'
}

request_body = {}
r = requests.post(base_url+'/system/info.json', json=request_body, headers=headers)
r.raise_for_status() # throw an exception in case of error
print(r.json())
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-API-KEY' => 'API_KEY'
}

params = {}

begin
result = RestClient.post(
'https://us1.unione.io/en/transactional/api/v1/system/info.json',
params.to_json,
headers
)

p JSON.parse(result)
rescue RestClient::ExceptionWithResponse => e
puts e.response.code
puts e.response.body
end
using System;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

class Program {
static HttpClient client;

public static void Main(string[] args) {
client = new HttpClient();

client.BaseAddress = new Uri("https://us1.unione.io/en/transactional/api/v1/");
client.DefaultRequestHeaders.Add("X-API-KEY", "API_KEY");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));

string requestBody = "{}";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");

var response = client.PostAsync("system/info.json", content).Result;
var responseBody = response.Content.ReadAsStringAsync().Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(responseBody);
}
else {
Console.WriteLine(String.Format("UniOne request failed (HTTP {0}): {1}",
(int)response.StatusCode, responseBody));
}
}
}
URL obj = new URL("https://us1.unione.io/en/transactional/api/v1/system/info.json");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("X-API-KEY", "API_KEY");
con.setDoOutput(true);
String requestBody = "{}";

try (OutputStream out = con.getOutputStream()) {
out.write(requestBody.getBytes());
out.flush();
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null