What Is an Email API? A Developer's Guide
What an email API is, how it works, REST vs SMTP, common use cases, and how to pick one. With code examples in TypeScript, Python, and Go.
An email API lets you send email with an HTTP request. No SMTP connections, no mail server configuration. You call an endpoint, pass a message, and the API handles delivery.
If you've ever set up Nodemailer with SMTP credentials and wondered why it needs to be this complicated — an email API is the simpler version of that.
Email API = HTTP endpoint for sending email. You send a POST request with from, to, subject, and html. The API handles SMTP, authentication, deliverability, and tracking.
curl -X POST https://api.sendpigeon.dev/emails \
-H "Authorization: Bearer sp_live_xxx" \
-d '{"from": "you@app.com", "to": ["user@example.com"], "subject": "Hello", "html": "<p>Hi</p>"}'
How an email API works
Without an API, sending email from your app requires:
- Configure an SMTP server (or use a provider like Gmail)
- Manage SMTP credentials
- Open a TCP connection to the server
- Authenticate via SMTP handshake
- Send the message using SMTP commands
- Handle connection errors, timeouts, and retries
- Set up DKIM, SPF, and DMARC yourself
With an email API, step 1–7 becomes:
- Make an HTTP POST request
The API provider runs the mail servers, manages DNS authentication, processes bounces, and tracks delivery. You get a single integration point.
Your App → HTTP POST → Email API → SMTP → Recipient's inbox
Code examples
TypeScript (Node.js)
import { SendPigeon } from "sendpigeon";
const pigeon = new SendPigeon(process.env.SENDPIGEON_API_KEY!);
const { data, error } = await pigeon.send({
from: "hello@yourdomain.com",
to: ["user@example.com"],
subject: "Your order shipped",
html: "<h1>Your order is on the way</h1>",
});
if (error) {
console.error("Send failed:", error.message);
} else {
console.log("Sent:", data.id);
}
Python
from sendpigeon import SendPigeon
pigeon = SendPigeon(api_key="sp_live_xxx")
result = pigeon.send(
from_="hello@yourdomain.com",
to=["user@example.com"],
subject="Your order shipped",
html="<h1>Your order is on the way</h1>",
)
Go
client := sendpigeon.New("sp_live_xxx")
resp, err := client.Send(ctx, &sendpigeon.SendEmailRequest{
From: "hello@yourdomain.com",
To: []string{"user@example.com"},
Subject: "Your order shipped",
HTML: "<h1>Your order is on the way</h1>",
})
Raw HTTP (any language)
curl -X POST https://api.sendpigeon.dev/emails \
-H "Authorization: Bearer sp_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"from": "hello@yourdomain.com",
"to": ["user@example.com"],
"subject": "Your order shipped",
"html": "<h1>Your order is on the way</h1>"
}'
Every language with HTTP support can use an email API. SDKs just make it cleaner.
Email API vs SMTP
| Email API | SMTP (e.g. Nodemailer) | |
|---|---|---|
| Protocol | HTTP/REST | SMTP (TCP) |
| Setup | API key | SMTP host, port, user, pass |
| Connection | Stateless (one request) | Stateful (open connection) |
| Serverless | Works everywhere | Blocked by some providers |
| Delivery tracking | Built-in | Build it yourself |
| Bounce handling | Automatic | Manual |
| Analytics | Opens, clicks, delivery | None |
| Authentication | Managed (DKIM, SPF) | Configure yourself |
When SMTP still makes sense
- You're sending between internal servers
- You need raw protocol control (custom SMTP extensions)
- You're building email infrastructure, not consuming it
- Your email volume is massive and you want AWS SES at $0.10/1K
For most application email — password resets, notifications, receipts, welcome emails — an API is simpler and more reliable.
What an email API handles for you
DNS authentication (DKIM, SPF, DMARC)
Email authentication prevents spoofing and improves deliverability. With SMTP, you generate DKIM keys, rotate them periodically, and manage DNS records yourself.
With an email API, you add a few DNS records during setup and the provider handles the rest — key rotation, alignment, and monitoring.
Bounce processing
When an email bounces (invalid address, full mailbox), the bounce notification goes to your sending server. With raw SMTP, you parse these notifications and maintain a suppression list yourself.
Email APIs process bounces automatically. Hard bounces are suppressed so you never send to them again.
Delivery webhooks
Know what happened to every email you send:
{
"event": "delivered",
"email_id": "em_abc123",
"to": "user@example.com",
"timestamp": "2026-03-11T14:30:00Z"
}
Events include: sent, delivered, opened, clicked, bounced, complained. Wire these into your app to trigger follow-up actions or alert on problems.
Rate limiting and queuing
Email providers have sending limits. An API manages queuing and rate limiting server-side, so you don't need to build that into your application.
Common use cases
| Use case | Example |
|---|---|
| Transactional | Password resets, order confirmations, receipts |
| Notifications | New message alerts, status updates, reminders |
| Welcome emails | Onboarding sequences after signup |
| Marketing | Newsletters, product announcements, campaigns |
| Triggered | Database change triggers email via webhook |
| Scheduled | Weekly digests, daily reports |
How to pick an email API
The right API depends on your priorities:
Simplest setup — Look for built-in sandbox/testing, CLI tools, and clear docs. SendPigeon includes a local dev server and cloud sandbox.
Cheapest at scale — Amazon SES at $0.10/1K emails is hard to beat, but you manage everything yourself.
Fastest delivery — Postmark is known for fast transactional delivery (avg ~1.2s to inbox).
Multi-language SDKs — Most providers offer TypeScript, Python, Go, PHP, and Ruby SDKs. Check that your stack is supported.
Marketing + transactional — If you need both, look for providers that support campaigns alongside API sending.
For a full comparison, see Best Email API for Developers in 2026.
Getting started
Most email APIs follow the same setup pattern:
- Create an account and get an API key
- Add your domain — the provider gives you DNS records (SPF, DKIM, DMARC)
- Verify DNS — add the records to your domain's DNS settings
- Send your first email — via SDK or raw HTTP
With SendPigeon, the full setup takes about 5 minutes:
npm install sendpigeon
import { SendPigeon } from "sendpigeon";
const pigeon = new SendPigeon("sp_live_xxx");
await pigeon.send({
from: "hello@yourdomain.com",
to: ["user@example.com"],
subject: "Welcome!",
html: "<h1>You're in.</h1>",
});
Start free — 3,000 emails/month, no credit card.
Next Steps
- Compare providers: Best Email API for Developers in 2026
- API vs Nodemailer: SendPigeon vs Nodemailer
- Set up authentication: DKIM, SPF, and DMARC Explained
- Queue your emails: How to Send Queued Email
- Pick your framework: Framework Guides