An email API is a web service that lets your application send email, and often receive it, by making HTTPS requests instead of speaking SMTP directly. You send JSON describing the message, the provider returns an id, and it takes care of signing, delivery, retries and bounce handling. Most modern transactional email is sent this way.
How an email API works
- Authenticate. Every request carries an API key, usually as
Authorization: Bearer <key>. - Send a request. You
POSTthe from address, recipients, subject and HTML or text body. - Get an id back. The API validates the request and queues the message. It answers in milliseconds, before delivery has happened.
- The provider delivers. It signs the message with DKIM and hands it to the recipient’s mail server over SMTP, retrying on temporary failures.
- Events come back. Delivered, bounced, complained, opened and clicked events arrive at your endpoint as webhooks.
Example request
curl https://api.mailcandor.com/v1/emails \
-H "Authorization: Bearer $MAILCANDOR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1042-receipt" \
-d '{
"from": "Acme <billing@acme.com>",
"to": "sam@example.com",
"subject": "Your receipt for order 1042",
"html": "<p>Thanks for your order.</p>"
}'
Response:
{ "id": "9f2c1e7a-...", "status": "queued" }
The Idempotency-Key header means a retry after a timeout returns the first response instead of sending a second receipt.
Email API vs SMTP
| Email API | SMTP | |
|---|---|---|
| Transport | HTTPS, JSON | SMTP commands over TCP |
| Errors | Structured JSON with a field name | Numeric reply codes |
| Per email cost | One request | Handshake, unless connections are pooled |
| Delivery events | Webhooks tied to an id | Usually none |
| Works with | Any HTTP client | Mail libraries, CMSs, devices |
Our SMTP vs API guide goes deeper. If your software only speaks SMTP, use an SMTP relay from the same provider.
Why it matters for app email
An API turns email into an ordinary HTTP call. It works from serverless functions, it fails fast with a readable error, and every message has an id you can store next to the order or user it belongs to. That id is what lets you show “email delivered” in your admin panel or explain a bounce to a customer.
Common mistakes
- Shipping the API key to the browser or a mobile app. Anyone can read it and send mail as you.
- Using a full-access key everywhere. Use a key that can only send, and limit it to one domain if the provider allows it.
- Treating 202 as delivered. Accepted means queued. Listen for delivery and bounce webhooks.
- Retrying without an idempotency key, which sends duplicates.
- Skipping domain verification. The API cannot fix missing SPF, DKIM and DMARC records.
How Mailcandor handles it
Mailcandor’s email API is POST /v1/emails with Bearer keys that can be full access or sending only, idempotency keys and up to 100 emails per batch request.