Email API for Developers

UniOne powers developers like you with a comprehensive Email API that seamlessly integrates email communication workflows and enhances user engagement in websites and applications.
PHP
Ruby
Python
C#
Node.js
curl
PHP
                                        // Send an email with the UniOne Email API PHP Library
// Learn more -> https://docs.unione.io/en/integrations
// First install with composer: composer require unione/unione-php
require 'vendor/autoload.php';

// Use eu1.unione.io for EU or us1.unione.io for US account
$client = new Unione\UnioneClient('YOUR-API-KEY', 'eu1.unione.io');
$recipients = [
    [
        "email" => 'john@example.com',
        "substitutions" => ["to_name" => 'John Smith']
    ]
];
$body = ["html" => "Hello, {{to_name}}!"];
$mail = new Unione\Model\Email($recipients, $body);
$mail->setFromEmail('user@example.com');
$mail->setSubject('Hello from UniOne');
$response = $client->emails()->send($mail->toArray());
if ($response['status'] == 'success') {
  echo 'Success, job_id='.$response['job_id']."\n";
}

                                        
Ruby
                                        # Send an email with the UniOne Email API Ruby gem
# Learn more -> https://docs.unione.io/en/integrations 
# First install the UniOne Ruby gem: gem install unione-ruby

require 'unione-ruby'
require 'json'

# Use eu1.unione.io for EU or us1.unione.io for US account
unione = UniOne::Client.new(
    hostname: 'eu1.unione.io', api_key: 'YOUR-API-KEY')

message = {}
message[:recipients] = []
message[:recipients] << {
    email: 'john@example.com',
    substitutions: { to_name: 'John Smith' }
}
message[:body] = { html: "Hello, {{to_name}}!" }
message[:from_email]  = 'user@example.com'
message[:subject]  = 'Hello from UniOne'

response = unione.send_email(message: message)

if response.success? && response.to_hash[:body][:status]=='success'
    puts "Success, job_id=" + response.to_hash[:body][:job_id]
end

                                        
Python
                                        # Send an email with the UniOne Web API
# Learn more -> https://docs.unione.io/en/web-api-ref#web-api 
# First install the requests module: pip install requests
import requests

# Use eu1.unione.io for EU or us1.unione.io for US account
base_url = 'https://eu1.unione.io/en/transactional/api/v1'
headers = {
  'Content-Type': 'application/json',
  'X-API-KEY': 'YOUR-API-KEY'
}

request_body = {
    "message": {
        "recipients": [
            {
                "email": "john@example.com",
                "substitutions": { "to_name": "John Smith" }
            }
        ],
        "body": {
            "html": "Hello, {{to_name}}!"
        },
        "subject": "Hello from UniOne",
        "from_email": "user@example.com"
    }
}
response = requests.post(base_url+'/email/send.json',
json=request_body, headers=headers)

if response.ok and response.json()["status"] == 'success':
    print("Success, job_id=" + response.json()["job_id"])

                                        
C#
                                        // Send an email with the UniOne Email API C# library
// Learn how to set up UniOne C# library:
// https://github.com/unione-repo/unione-csharp

using System.Text;
using Microsoft.Extensions.Configuration;
using UniOne.Models;

// Use eu1.unione.io for EU or us1.unione.io for US account
var json = "{\"UniOne\":{" +
    "\"ServerAddress\":\"https://eu1.unione.io/\"," +
    "\"X-API-KEY\":\"YOUR-API-KEY\"}}";

IConfiguration configuration = new ConfigurationBuilder()
    .AddJsonStream(new MemoryStream(Encoding.ASCII.GetBytes(json)))
    .Build();

var uniOne = new UniOne.UniOne(configuration);
var msg = new EmailMessageData {
    FromEmail = "user@example.com",
    Recipients = new List<EmailRecipientData> {
        new EmailRecipientData {
            EmailAddress = "john@example.com",
            Substitutions = new Dictionary<object, object> {
                {"to_name", "John Smith"}
            }
        }
    },
    Subject = "Hello from UniOne",
    Body = new Body { Html = "Hello, {{to_name}}!" }
};

var email = await uniOne.Email.Send(msg);
if (email != null) {
    Console.WriteLine("Success, job_id=" + email.JobId);
} else {
    Console.WriteLine(uniOne.Email.GetError()!.Details!.Message);
}
                                        
Node.js
                                        // Send an email with the UniOne Web API
// Learn more -> https://docs.unione.io/en/web-api-ref#web-api 
// First install node-fetch module: npm install node-fetch
import fetch from "node-fetch"

// Use eu1.unione.io for EU or us1.unione.io for US account
const base_url = 'https://eu1.unione.io/en/transactional/api/v1'
const headers = {
    'Content-Type':'application/json',
    'X-API-KEY':'YOUR-API-KEY'
};

const request = JSON.stringify({
    message: {
        recipients: [{
            email: 'john@example.com',
            substitutions: { to_name: 'John Smith' },
        }],
        body: { html: 'Hello, {{to_name}}!' },
        subject: 'Hello from UniOne',
        from_email: 'user@example.com',
    },
});
fetch(base_url + '/email/send.json', {
    method: 'POST',
    body: request,
    headers: headers
})
.then((response) => response.json())
.then(data => {
    if(data.status == "success") {
        console.log("Success, job_id=" + data.job_id);
    }
});

                                        
curl
                                        # Send an email with the UniOne Web API
# Learn more -> https://docs.unione.io/en/web-api-ref#web-api 

# Use eu1.unione.io for EU or us1.unione.io for US account
curl -X POST \
  https://eu1.unione.io/en/transactional/api/v1/email/send.json \
  -H 'Content-Type: application/json' \
  -H 'X-API-KEY: YOUR-API-KEY' \
  -d '{
  "message": {
    "recipients": [
      {
        "email": "john@example.com",
        "substitutions": {
          "to_name": "John Smith"
        }
      }
    ],
    "body": {
      "html": "Hello, {{to_name}}!"
    },
    "subject": "Hello from UniOne",
    "from_email": "user@example.com"
  }
}

                                        

UniOne's Email API is easy to integrate

Discover the simplicity of integrating UniOne's Email API into your workflow. Whether you opt for one of our existing integrations or craft your bespoke solution using our comprehensive Web API, rest assured, our dedicated 24/7 support team stands by to assist you every step of the way.

Maximize the Potential of Your Email Data

Unleash the power of your email data to personalize campaigns, refine targeting, and foster deeper engagement with your audience. With UniOne's intuitive visual dashboards or API-driven analytics, achieving superior results and cultivating robust customer connections has never been easier.

Diverse ways
to use our Email API

Sign-up Emails
Automate account registration confirmations, extend warm welcomes, and offer platform navigation guidance, backed by UniOne's attentive support.
Password Recovery Emails
Effortlessly dispatch automated messages for password resets, bolstering account security within seconds via UniOne's resilient API.
Purchase Confirmation Emails
Ensure seamless transactions by providing detailed receipts and invoices, with UniOne's instant webhooks keeping you informed of real-time status updates.
Accounts Email Alerts
Integrate UniOne seamlessly into your web ecosystem to streamline daily user communication, promptly delivering crucial notifications.
Newsletter Emails
Leverage UniOne's Email API to send out regular newsletters, keeping subscribers informed about the latest updates, promotions, and news pertinent to your platform or enterprise.
Feedback Request Emails
Automate insightful feedback collection by dispatching surveys post-interaction, all facilitated through UniOne's email API.
Log and data retention
Email analytics
Real-time webhooks
Delivery rates
Scalability
Log and data retention

Explore UniOne's logging and data retention functionalities tailored for comprehensive data visibility, precise control, and regulatory compliance over email deliveries. Prioritizing data security and privacy, UniOne ensures adherence to stringent compliance standards.

With UniOne, you keep track of all email-related activities, including sending, receiving, delivery statuses, bounce events, and other relevant interactions. Each single event is timestamped and associated with relevant metadata to provide detailed insights into the email lifecycle.

Email analytics

Harness UniOne's extensive email analytics to refine marketing strategies, enhance audience engagement, and achieve optimal campaign outcomes. Visualize campaign performance through intuitive dashboards, real-time event tracking, and convenient CSV data exports.

Real-time webhooks

Stay ahead with UniOne's real-time webhooks, providing instant updates and notifications on pertinent email events. Armed with timely status updates, optimize your email marketing strategies effectively.

Delivery rates

At UniOne, our highest priority is maintaining the highest email delivery rates. Real-time monitoring, dedicated email deliverability team, and an anti-spam department with over 15 years of experience ensure great results.

For our customers following the industry's best practices, we estimate a 99,88% email delivery rate, validated by our latest statistics.

Scalability

With UniOne's robust email infrastructure, we can process up to 60 million hourly API requests per user, ensuring seamless scalability to accommodate any email volume.

We deliver billions of emails annually, and the total number of messages we process increases by more than 10% each year.

Why businesses choose us?

UniOne has other useful tools for your business

UniOne is free and easy to start

Our users’ satisfaction is our primary value. Thus, we provide each newcomer with a 4-month free trial, including 6,000 monthly emails, to test our capabilities. Our round-the-clock customer care team is ready to assist you with any matters at each step of your journey with UniOne. When you feel ready to upgrade, choose any other tariff from the ones available or contact our sales manager to discuss a customized plan.