On this page
  1. What a transactional email API does
  2. What a transactional email API request contains
  3. The fields most requests share
  4. Authentication
  5. Content and tracking fields by service
  6. Delivery controls by service
  7. Send a transactional email: one request
  8. Send with curl
  9. Send with the Node.js SDK
  10. What a transactional email API returns
  11. Send from a template
  12. How to choose
  13. Before you go live: a short checklist
  14. FAQ

Transactional Email API: What a Request Contains and How to Choose One

A transactional email API is an HTTP endpoint from an email service that sends one message triggered by a user's action, such as a receipt or password reset: you POST the sender, recipient and content (or a template ID and variables) with an API key, and the service delivers it and reports what happened.

Written by Relay, the Email Stack Review teamPublished Updated No ads or affiliate links
Choosing one? See the best email APIs.

Key takeaways

  • A send request needs a sender on a verified domain, a recipient, a subject and a body, or a template ID with variables. Everything else (tags, headers, attachments, scheduling) is optional.
  • Field names differ per service. Of the seven services we compared, only Resend documents an idempotency key for sends (vendor docs, November 11, 2026).
  • A 200 or 202 response means the service accepted the message, not that it arrived. Keep the message ID and watch events.
  • Before real users get mail: verify the domain, test without delivering, store the key as a secret, handle bounce events and plan retries.

Most "how do I send an email from my app" searches end on one vendor's quickstart. That is fine until you have to compare two vendors. So here is the neutral version: what any send request contains, one real example from the vendor's own docs, what comes back when it works and when it doesn't, and what to do before launch.

What a transactional email API does

A transactional email API lets your code send one email per event, such as an order receipt or a password-reset link, with a single HTTPS request to a sending service. The service signs the message, delivers it, retries if the first attempt is deferred and reports the outcome. You don't run a mail server or build sender reputation yourself.

It differs from a marketing or campaign API in one way that matters here: it sends one message, triggered by your code, to one person. There are no lists or audiences to manage.

For what counts as transactional email and the types, read what is transactional email. For the general idea of an email API (types, ESPs, the five-step flow), read what is an email API. SMTP is the other way in; SMTP vs email API compares the two.

What a transactional email API request contains

A transactional email API request holds a sender, one or more recipients, a subject and a body, or a template ID with variables, plus optional fields for attachments, tags, headers and scheduling. Field names differ by service: the sender is from in Resend, From in Postmark and FromEmailAddress in Amazon SES (vendor API references, November 11, 2026).

The fields most requests share

Eleven fields cover almost every transactional send. The limits in the notes column come from each vendor's API reference, so they are not interchangeable.

Field What it is Notes
from Sender address, with an optional display name Must be on a domain or address you verified
to, cc, bcc Recipients Resend caps to at 50, Postmark caps To, Cc and Bcc together at 50, Mailtrap allows up to 1,000 per field
subject Subject line Optional when a stored template supplies it
html, text The body Send both: Resend builds a plain-text version from your HTML if you leave text out
template ID + variables A stored template and its values See Send from a template
reply-to Where replies go Postmark falls back to the Reply-To set on the sender signature
attachments Files, usually Base64 Mailgun accepts attachments only as multipart/form-data
headers Custom email headers Mailgun uses an h: prefix, the others a headers field
tags or metadata Labels you can filter stats and logs by Postmark allows one Tag per message
scheduled time Send later Limits run from 72 hours to 30 days, see below
idempotency key A unique key per send so a retry doesn't send twice Only Resend documents one

Authentication

A transactional email API authenticates every request with a key or token in a header. Resend and SendGrid take Authorization: Bearer <key>, Postmark takes X-Postmark-Server-Token, Mailtrap takes Api-Token (or a Bearer token) and Mailgun uses HTTP basic auth. Amazon SES has no SES-specific key: requests are signed with AWS credentials. Scoped keys are covered in the go-live checklist.

Content and tracking fields by service

All seven services we compared accept attachments, custom headers and some form of tag or metadata on a send. The names are what change (vendor API references, November 11, 2026).

Service Tags or metadata Custom headers Attachments
Mailtrap category, custom_variables headers attachments
Amazon SES EmailTags Headers Attachments
Mailgun o:tag, v: custom data h: prefix attachment, inline; multipart/form-data only
Resend tags (name/value pairs) headers attachments, 40 MB per email after Base64
SendGrid categories (up to 10), custom_args headers attachments
MailerSend tags (up to 5) headers, Professional and Enterprise plans only attachments, 25 MB combined
Postmark Tag (one), Metadata Headers Attachments

Delivery controls by service

Idempotency, scheduling and batch sending are where the services actually differ. Resend is the only one of the seven whose send docs describe an idempotency key; the other six don't (we searched each vendor's send reference, November 11, 2026).

Service Idempotency key Scheduling Batch endpoint
Mailtrap Not documented send_at not documented for transactional sending POST /api/batch, 500 messages per call; returns 200 even if single messages fail
Amazon SES Not documented No scheduled-send parameter in SendEmail SendBulkEmail, 50 destinations per call, templated
Mailgun Not documented o:deliverytime, up to 3 or 7 days by plan recipient-variables, up to 1,000 recipients per call
Resend Idempotency-Key header, 1 to 256 characters, kept 24 hours scheduledAt, up to 30 days ahead POST /emails/batch, 100 emails per call, no attachments
SendGrid Not documented send_at, up to 72 hours ahead; batch_id cancels Up to 1,000 personalizations per request
MailerSend Not documented send_at, up to 72 hours ahead, a minimum-time guarantee POST /v1/bulk-email, 500 per call, Hobby plan or higher
Postmark Not documented Not documented POST /email/batch, 500 messages per call

Why does idempotency matter? Without a key, a timeout followed by a retry can send the same receipt twice. Resend answers a repeat of the same key with the original response instead of a second email, and returns 409 if the key comes back with a different body (Resend docs). On the other six, avoiding duplicates is your job, which is where transactional email best practices picks up.

Send a transactional email: one request

A minimal transactional send is one POST with an API key, a sender, a recipient, a subject and a body. Below is Resend's, from its API reference. We picked it because both the curl and the Node.js example sit on one page and are the shortest official pair we found among the seven. The shape is similar at the others; only the names and the auth header change. Our Resend review covers the service itself.

Send with curl

curl -X POST 'https://api.resend.com/emails' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "from": "Acme <onboarding@resend.dev>",
  "to": ["delivered@resend.dev"],
  "subject": "hello world",
  "html": "<p>it works!</p>"
}'

From Resend's docs (Send Email), checked November 11, 2026. The resend.dev addresses are Resend's own onboarding sender and test recipient; use your verified domain in production.

Send with the Node.js SDK

import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.emails.send({
  from: 'Acme <onboarding@resend.dev>',
  to: ['delivered@resend.dev'],
  subject: 'hello world',
  html: '<p>it works!</p>',
});

From Resend's docs (Send Email), checked November 11, 2026. The SDK is a thin wrapper: the same fields, with the key passed to the constructor, and an error object instead of an HTTP status to check.

What a transactional email API returns

On success, a transactional email API returns an ID for the message you can look up later; on failure it returns an HTTP status and an error body. Resend answers with {"id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"} (Resend docs, checked November 11, 2026). The table shows what each service documents for the four failures you will meet first, plus the median time for the request to come back.

Service Success Bad or missing key Sender or domain not verified Bad payload Rate limit API response time (Knock, median, 12 Aug–10 Nov 2026)
Mailtrap 200, message_ids (one per recipient) 401 403 400, {"success": false, "errors": [...]} 429 (150 requests per 10 seconds per API token) 85 ms
Amazon SES 200, MessageId 403 AccessDenied (AWS common errors) 400 MailFromDomainNotVerifiedException 400 BadRequestException, MessageRejected 429 TooManyRequestsException 168 ms
Mailgun 200, id and "Queued. Thank you." 401 Not listed on the send page 400 429 121 ms
Resend 200, id 401 missing_api_key 403 validation_error 422 missing_required_field, 400 validation_error 429 rate_limit_exceeded (10 requests per second per team by default) 71 ms
SendGrid 202, no message ID in the documented response 401 403 400, errors array 429 14 ms
MailerSend 202, empty body, x-message-id header 401 422 (domain must be verified) 422, message and errors 429 269 ms
Postmark 200, MessageID and ErrorCode 0 401, ErrorCode 10 422 422, ErrorCode 300 or 403 429, no numeric limit published 59 ms

Sources: each vendor's send reference and error pages, checked November 11, 2026; Resend's rate limit is from its rate limit page, Mailtrap's from its rate limits page, and the response times are from Knock's email API benchmarks.

Two things to read carefully. First, codes are not portable: an unverified sender is a 403 at Resend and SendGrid, a 400 at Amazon SES and a 422 at Postmark and MailerSend, so match on the vendor's error name, not on the status alone. Second, a success code means "accepted", not "delivered". Amazon SES's own docs say it can accept a message without sending it, for example when a templated email contains invalid personalization content.

The last column is Knock's median API response time: how long the provider took to return a 200 acceptance on Knock's production traffic. Knock sells provider routing, and the metric says nothing about delivery. We found no independent send-to-inbox speed comparison across providers.

Send from a template

Sending from a template means storing the layout with the service and sending its ID plus a set of variables, instead of building the HTML in your code. All seven services we compared store templates and accept them on a send request (vendor docs, November 11, 2026).

Service Send with Notes
Mailtrap template_uuid + template_variables Handlebars syntax; templates on all plans
Amazon SES TemplateName + TemplateData Stored or inline templates; no localisation feature documented
Mailgun template + t:variables Versions; Handlebars-style variables
Resend template with id + variables Published templates only; can't be combined with html or text
SendGrid template_id + dynamic_template_data Dynamic Templates, Handlebars
MailerSend template_id + personalization Template translations, language parameter on send
Postmark TemplateId or TemplateAlias + TemplateModel Layouts; up to 100 templates per server

Which side should own the HTML? Stored templates let a non-developer edit copy without a deploy, and building HTML in code keeps it under version control. The full comparison, with editors and free templates, is in transactional email templates.

How to choose a transactional email API

Check five things first when you choose a transactional email API, and read the full ranking for the rest. Each line points to the page that owns it.

  1. An SDK for your language. Resend has official SDKs in nine languages, Mailtrap in eight, Mailgun in six (vendor docs, November 2026). Our best email APIs ranking compares the developer experience.
  2. Events and webhooks. You need bounce and complaint events in your app: see email APIs with webhooks.
  3. Deliverability and domain authentication. Mostly your own setup and habits; see the deliverability section of our main ranking.
  4. Price at your volume. Transactional email pricing compared works it out at 10,000, 100,000 and 1,000,000 emails a month.
  5. A free tier to start on. See free email APIs.

Which email service is best for transactional emails? It depends on your language, volume and how much you need from events and templates, so start from the best email APIs for the developer view and the best transactional email services for the overall view.

Before you go live: a short checklist

Six things should be done before real users get mail from your transactional email API. One line each.

  1. Verify your sending domain and publish SPF, DKIM and DMARC. Without it, sends fail (if a check fails after you publish, see fixing SPF, DKIM and DMARC failures): Resend returns 403 until the from domain is verified, and until then lets you send test emails only to your own address (Resend errors page). Postmark returns 422 without a confirmed sender signature, and its ErrorCode 412 while the account is pending approval and a recipient is on another domain. The DNS steps per service are in our setup comparison.
  2. Send in test mode first. Postmark accepts POSTMARK_API_TEST as the server token to validate a request without delivering it (Postmark docs). Sandbox detail per service is in free email APIs, and inbox previews in email testing tools.
  3. Keep the API key a secret, and scope it. Resend offers a sending_access key limited to one domain, Mailgun a Domain Sending Key, MailerSend custom access per endpoint. Postmark has only server and account tokens, and Amazon SES uses IAM policies (vendor docs, November 11, 2026).
  4. Handle webhook events for bounces and complaints. Suppress addresses that bounce, or your reputation pays. See email APIs with webhooks.
  5. Plan for retries and failures. Treat 429 and 5xx as retryable with backoff, and use an idempotency key where the service has one. The how-to is in transactional email best practices.
  6. Keep marketing mail off the transactional stream. Postmark sends through a message stream, and outbound is its default transactional one. The reasons are in transactional vs marketing email.

How we compared: vendor docs, API references, error pages and status pages, checked November 11, 2026. We ran no sending tests, and the site has no ads, affiliate links or paid placements.

Know what a request holds and ready to pick? Compare the best email APIs and the best transactional email services.

Transactional email API: FAQ

What is a transactional email API?

A transactional email API is an HTTP endpoint from an email service that sends one message triggered by a user's action, such as a receipt or password reset. You send the sender, recipient and content, or a template ID and variables, with an API key, and the service delivers the message and reports what happened.

What is the difference between a transactional email API and SMTP?

A transactional email API takes an HTTPS request with a JSON body, while SMTP is the older protocol that mail libraries, CMSs and devices already speak. Use the API for new code and SMTP for software you can't change. The full comparison is in SMTP vs email API.

Which transactional email API is best for developers?

It depends on your language, volume and need for events and templates. Check SDK coverage, webhook quality and price at your volume first. Our developer-focused ranking, the best email APIs, compares them on those points.

Is there a free transactional email API?

Yes, several services have free plans with an API, but each caps volume per month or per day. The caps and what breaks first differ by service. See free email APIs for the comparison, and free transactional email services if you also need SMTP.

What is an example of a transactional email?

A password reset, an order confirmation and a shipping notification are common examples. Each is triggered by something the person did, sent to them alone and needed by them. What is transactional email has the full list of types.

Can I use one API for transactional and marketing email?

Some services do both, but usually through separate streams or endpoints. Postmark sends through message streams, with outbound as its default transactional stream, and Mailtrap documents a transactional endpoint (send.api.mailtrap.io) and a bulk one (bulk.api.mailtrap.io) (vendor docs, November 11, 2026). See transactional vs marketing email.

Do I need to verify my domain before sending?

In practice, yes. Resend returns a 403 until the from domain is verified, Amazon SES returns MailFromDomainNotVerifiedException, MailerSend returns a 422 and Postmark requires a confirmed sender signature (vendor docs, November 11, 2026). Verification also sets up the DKIM signature that mailbox providers check. DNS steps per service are in our setup comparison.

How do I know a transactional email was delivered?

A 200 or 202 only means the service accepted it. Keep the message ID from the response, look the message up in the service's logs, and subscribe to webhook events for delivered, bounced and complained. Amazon SES notes that it can accept a message without sending it. See email APIs with webhooks.