The Email API & Integration

Flexible Integration for Any Product, Website, or App

Free Email API Integration For Every Application

Building email functionality is a surprisingly complex and specialized task. SparkPost’s
robust email API makes it simple to embed email into any app or website.

curl -XPOST \
  https://api.sparkpost.com/api/v1/transmissions \
  -H "Authorization: <YOUR API KEY>" \
  -H "Content-Type: application/json" \
  -d '{"options": {"sandbox": true}, "content": {"from": "testing@sparkpostbox.com", "subject": "Oh hey", "text":"Testing SparkPost - the most awesomest email service in the world"}, "recipients": [{"address": "developers+curl@sparkpost.com"}]}'
const SparkPost = require('sparkpost');
const sparky = new SparkPost('<YOUR API KEY>');

sparky.transmissions.send({
    options: {
      sandbox: true
    },
    content: {
      from: 'testing@sparkpostbox.com',
      subject: 'Oh hey!',
      html:'<html><body><p>Testing SparkPost - the world\'s most awesomest email service!</p></body></html>'
    },
    recipients: [
      {address: 'developers+nodejs@sparkpost.com'}
    ]
  })
  .then(data => {
    console.log('Woohoo! You just sent your first mailing!');
    console.log(data);
  })
  .catch(err => {
    console.log('Whoops! Something went wrong');
    console.log(err);
  });
from sparkpost import SparkPost

sparky = SparkPost('<YOUR API KEY>')

response = sparky.transmissions.send(
    use_sandbox=True,
    recipients=['developers+python@sparkpost.com'],
    html='<html><body><p>Testing SparkPost - the world\'s most awesomest email service!</p></body></html>',
    from_email='testing@sparkpostbox.com',
    subject='Oh hey!')
<?php
use SparkPost\SparkPost;
use GuzzleHttp\Client;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;

$httpClient = new GuzzleAdapter(new Client());
$sparky = new SparkPost($httpClient, ['key' => '<YOUR API KEY>']);

$sparky->setOptions(['async' => false]);
$results = $sparky->transmissions->post([
  'options' => [
    'sandbox' => true
  ],
  'content' => [
    'from' => 'testing@sparkpostbox.com',
    'subject' => 'Oh hey!',
    'html' => '<html><body><p>Testing SparkPost - the world\'s most awesomest email service!</p></body></html>'
  ],
  'recipients' => [
    ['address' => ['email'=>'developers+php@sparkpost.com']]
  ]
]);
?>
package com.sparkpost;

import com.sparkpost.exception.SparkPostException;

public class SparkPost {

    public static void main(String[] args) throws SparkPostException {
        String API_KEY = "<YOUR API KEY>";
        Client sparky = new Client(API_KEY);

        sparky.sendMessage(
                "testing@sparkpostbox.com",
                "developers+java@sparkpost.com",
                "Oh hey!",
                "Testing SparkPost - the world's most awesomest email service!",
                "<p>Testing SparkPost - the world's most awesomest email service!</p>");
    }
}
var transmission = new Transmission();
transmission.Content.From.Email = "testing@sparkpostbox.com";
transmission.Content.Subject = "Oh hey!";
transmission.Content.Text = "Testing SparkPost - the world\'s most awesomest email service!";
transmission.Content.Html = "<html><body><p>Testing SparkPost - the world\'s most awesomest email service!</p></body></html>";

var recipient = new Recipient
{
    Address = new Address { Email = "my@email.com" }
};
transmission.Recipients.Add(recipient);

var client = new Client("<YOUR API KEY>");
client.Transmissions.Send(transmission);
// or client.Transmissions.Send(transmission).Wait();
package main

import (
    sp "github.com/SparkPost/gosparkpost"
    "log"
)

func main() {
    var sparky sp.Client
    err := sparky.Init(&sp.Config{ApiKey: "<YOUR API KEY>"})
    if err != nil {
        log.Fatalf("SparkPost client init failed: %s\n", err)
    }

    tx := &sp.Transmission{
        Recipients: []string{"developers+go@sparkpost.com"},
        Options:    &sp.TxOptions{Sandbox: true},
        Content: sp.Content{
            HTML:    "<p>Testing SparkPost - the world's most awesomest email service!</p>",
            From:    "test@sparkpostbox.com",
            Subject: "Oh hey!",
        },
    }
    id, _, err := sparky.Send(tx)
    if err != nil {
        log.Fatal(err)
    }

    log.Printf("Transmission sent with id [%s]\n", id)
}
alias SparkPost.{Content, Transmission}

defmodule MyApp do
  def main(args) do
    Transmission.send(%Transmission{
      recipients: ["developers+elixir@sparkpost.com"],
      content: %Content.Inline{
        from: "test@sparkpostbox.com",
        subject: "Oh hey!",
        html: "<p>Testing SparkPost - the world's most awesomest email service!</p>",
      },
      options: %Transmission.Options{sandbox: true}
    })
  end
end

With SparkPost’s robust REST email API, your application can take control of every SparkPost feature, including:

  • Manipulating templates
  • Generating messages
  • Sending emails
  • Reporting performance data

Full Featured Email API

Simple, Flexible SMTP Injection

If your app sends email with SMTP, it takes just a few configuration settings to start sending with SparkPost. Nearly every email API feature can be invoked via SMTP, so even legacy apps can leverage our robust delivery, analytics, and more.

SPARKPOST POWERS THE WORLD’S LARGEST BRANDS

The New York Times
Pinterest
Booking dot com
Twitter
Airbnb
Zillow

Build Powerful Apps With Real-Time Data

Real-time webhooks (HTTP callbacks) can trigger actions in your app when an email is opened, clicked-through, or bounced. Create as many different webhooks as your business needs, solving problems as diverse as product workflow and data warehouse ETL.

Security screens illustration
API Integration Languages

We Speak Your (Coding) Language

Use SparkPost with the language of your choice and help your developers hit the ground running. Client libraries for popular languages like Node.jsC#PythonJavaPHPGo, and others mean SparkPost is an easy fit for every product.

What Is an Email API Service?

Every email you send is a valuable opportunity to connect with customers and build your brand loyalty. Email APIs, or Application Programming Interfaces, streamline your email delivery and let you send your emails to a larger group of contacts in less time. APIs take the guesswork out of setting up an SMTP server by letting you use theirs. Make your programming more effective with templates and analytical tools for the following:

  • Advertising campaigns
  • Personalized suggestions
  • Transactional emails and notifications

Common Email API Features

Email APIs typically have the following features.

Sending Emails API

API software allows your business to create stunning campaigns using templates and send them out programmatically. Many companies use APIs to send transactional messages and notifications to boost user engagement. These notifications work best when used for time-sensitive applications and notices.

When emails aren’t sending, APIs allow you to troubleshoot diagnostics and identify the root of delivery issues. You’ll see who received each email, those whose address is unusable, who blocked the email and whose email servers block your deliveries as spam.

Tracking and Analytics

APIs let you manage your inbound traffic and use parsing software to sync data from your emails with your system’s existing tools. Your tracking analytics should provide you with information regarding your email’s blocks, bounces and delays.

APIs allow you to understand exactly where your emails are going and see why emails are bouncing, so you can tackle the issue head-on. A good API can show you if your emails are getting blacklisted and give you the right advice and next steps for solving the issue.

How SparkPost’s Email API = Better Email Campaign Performance

At SparkPost, we deliver more than 40% of the world’s B2C and B2B emails. We understand the industry inside and out and can ensure the campaigns you design with hard work get exactly where they need to go. Our website email client has the following advantages:

  • Deliverability: More than 1.8 billion users around the world trust SparkPost to deliver their email campaigns and notifications. We help businesses send thousands of emails every month and keep their customers engaged. We also go the extra mile and look for your emails on spam blacklists and even solve the problem for you.
  • Regulations and compliance: One of SparkPost’s greatest advantages is our dedication to regulations and compliance. We’re always staying on top of SOC2 Type II and GDPR requirements and can ensure your email stays off of blacklists and ends up in inboxes.
  • Trend analysis: SparkPost allows you to analyze key performance trends and uplevel your performance by implementing new strategies.
  • Flexibility: SparkPost gives your business the flexible architecture necessary to keep up with the evolving marketing landscape.

Choose SparkPost for the Best Email API in the Industry

Schedule a demo with us and try SparkPost Email API today to see the difference we can make for your organization. You can also reach out to us online to connect with one of our expert team members!

Learn More about Email APIs and Integration

Develop your email expertise and master best practices with these practical resources.

Email APIs

Email API Use Cases

Access the SparkPost Academy to learn why Email APIs are the most performant way to send and manage email notifications and other transactional email messages.

Tools

Email Tools for Developers

These free tools from the email experts at SparkPost make it easy to build and check your app’s emails.