Shipping Confirmation Email API (2026): Tell a Customer Their Order Has Shipped with POST /emails
Send a shipping confirmation with a tracking URL through Rovela’s HTTP API: a language-agnostic POST /emails helper in Node fetch plus curl, an Idempotency-Key keyed to the shipment id, optional warehouse reply_to, and tags. Not an order-placed, receipt, invoice, or Shopify webhook rewrite.
A shipping confirmation is not an order receipt
When a warehouse marks a carton as handed to the carrier, the customer needs a different message from the one they got at checkout: “Your order has shipped,” plus a tracking URL they can open on their phone. That send is transactional email. It is not an order-placed acknowledgement, not a payment receipt, not an invoice with an attachment, and it is not a rewrite of a Shopify order webhook or a Stripe receipt. Those tutorials already exist. This one is the fulfillment notice after the package is actually in transit.
Rovela’s Email API is a single HTTPS call for that work. There is no client library to install. The base URL is https://api.rovela.dev. You authenticate with Authorization: Bearer re_… (Authentication) and queue a message with POST /emails. The response is a message id. HTTP 200 means the message was accepted and queued, not that it has already arrived (Quick Start).
This guide stays language-agnostic on purpose: the same JSON body and headers work from any runtime that can make an HTTPS request. The examples use a small Node fetch helper and a short curl you can paste into a terminal or a runbook. They do not invent an official shipping SDK, a carrier plugin, or a contacts, topics, or broadcasts product tour.
If you are still choosing between HTTP and SMTP, read Email API vs SMTP. Rovela’s SMTP is mailbox SMTP for mail apps (mx.rovela.dev:465, a device credential, send-as-self, 30 messages a minute from one client address). Programmatic volume from a fulfillment worker belongs on POST /emails, which is also the distinction drawn in Email API vs SMTP relay.
What you need before the first shipping send
The first-email guide and the Quick Start are the same five steps, whether your caller is curl or fetch in a warehouse worker:
- Create an account. You start on the free plan, which sends real mail. There is no separate sandbox or test key.
- Add and verify a sending domain (a subdomain such as
mail.example.comis a common choice). You cannot send from a domain you have not verified; an unverified or foreignfromis refused with a 400 that names the domain. The dashboard asks for four DNS records — SPF, DKIM, DMARC, and return-path. See the domain setup guide and what domain email is. - Create an API key. A
sending_accesskey can send and nothing else — the right default for a production shipper. Afull_accesskey can also read messages and events, and manage domains, templates, and webhooks. The full key is shown once. - Send with
POST /emails. - Confirm delivery in the dashboard, with
GET /emails/:idorGET /emails/:id/events(those reads needfull_accessor a dashboard session), or with a webhook.
from is a string in the documented form "Warehouse <shipments@yourdomain.com>". The address must sit on a verified sending domain. That is the same rule that makes domain email trustworthy: you prove you control the domain before you speak as it. How the display name and the address work is covered in the From name guide.
At least one of html, text, or template is required. Send both html and text where you can — many clients preview the text part, which is often where a customer first sees the tracking URL (HTML email API).
A small Node helper and a curl you can keep in a runbook
Keep the key on the server that already decided the shipment is in transit. Never put it in a storefront page, a packing-slip PDF generator that runs in a browser, or a public repository. A leaked sending_access key can send mail as your domain.
Private values belong in the worker’s environment (or your host’s secret store) and are read only inside the helper. A missing key should fail when the helper is first used, not halfway through a scan of today’s cartons.
# environment (server only; never commit the live key)
ROVELA_API_KEY=re_your_sending_key
ROVELA_FROM=Warehouse <shipments@mail.example.com>
ROVELA_WAREHOUSE_REPLY=dock@mail.example.com
// emails.js — Node 18+ fetch, no official SDK
export class ApiError extends Error {
constructor({ statusCode, name, message }) {
super(message || `Rovela: HTTP ${statusCode}`);
this.statusCode = statusCode;
this.name = name || "ApiError";
}
}
function requireEnv(name) {
const value = process.env[name];
if (!value) throw new Error(`Missing required environment variable: ${name}`);
return value;
}
export async function sendEmail(opts) {
const apiKey = requireEnv("ROVELA_API_KEY");
const from = requireEnv("ROVELA_FROM");
const headers = {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
};
if (opts.idempotencyKey) headers["Idempotency-Key"] = opts.idempotencyKey;
const body = { from, to: opts.to, subject: opts.subject };
if (opts.html) body.html = opts.html;
if (opts.text) body.text = opts.text;
if (opts.replyTo) body.reply_to = opts.replyTo;
if (opts.tags) body.tags = opts.tags;
const res = await fetch("https://api.rovela.dev/emails", {
method: "POST",
headers,
body: JSON.stringify(body),
});
const payload = await res.json().catch(() => ({}));
if (!res.ok) {
throw new ApiError({
statusCode: Number(payload.statusCode || res.status),
name: payload.name,
message: payload.message,
});
}
return payload; // { object: "email", id }
}
The JSON body and headers are the same ones the Emails API documents. The same request in curl is useful when you are proving the domain and the key before you wire the worker, and it is the shape already shown in the curl sending guide and the HTTP email API explainer:
curl -X POST https://api.rovela.dev/emails \
-H "Authorization: Bearer re_your_sending_key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: shipment:wh-east:shp_8f3a2c" \
-d '{
"from": "Warehouse <shipments@mail.example.com>",
"to": "alice@example.com",
"subject": "Your order has shipped",
"html": "<p>Your order has shipped.</p><p>Track it: <a href=\"https://track.example.com/shp_8f3a2c\">https://track.example.com/shp_8f3a2c</a></p>",
"text": "Your order has shipped. Track it: https://track.example.com/shp_8f3a2c",
"reply_to": "dock@mail.example.com",
"tags": { "type": "shipping", "shipment_id": "shp_8f3a2c" }
}'
tags are documented as arbitrary labels (an object or an array) and come back with the message — useful when you later look at a bounce and want the shipment id next to it (email API tags). reply_to is the right place for a warehouse address if you want packing questions to skip the no-reply mailbox (reply-to).
Send after the carton is in transit, once per shipment id
A shipping confirmation is easy to double-send: the warehouse scanner retries, a queue worker redelivers the “handed to carrier” event, or two packers close the same shipment a few seconds apart. Put the send behind your own fulfillment record, and give every shipment a stable Idempotency-Key that includes the shipment id. An Idempotency-Key may be up to 256 characters; a retry of the same request within 24 hours returns the original response instead of sending again (idempotency).
The sketch below is ordinary Node. It assumes you already stored the shipment in your own system. This article does not invent a Rovela orders API, a carrier API, or a Shopify connector.
// notifyShipped.js
import { ApiError, sendEmail } from "./emails.js";
export async function notifyOrderShipped({
customerEmail,
orderId,
shipmentId,
trackingUrl,
carrierName,
}) {
if (!customerEmail || !shipmentId || !trackingUrl) {
throw new Error("customerEmail, shipmentId, and trackingUrl are required");
}
const subject = "Your order has shipped";
const html = `<p>Your order has shipped.</p>
<p>Carrier: ${carrierName || "your carrier"}</p>
<p>Track this shipment: <a href="${trackingUrl}">${trackingUrl}</a></p>
<p>Order ${orderId} · shipment ${shipmentId}</p>`;
const text = `Your order has shipped.
Carrier: ${carrierName || "your carrier"}
Track this shipment: ${trackingUrl}
Order ${orderId} · shipment ${shipmentId}`;
try {
return await sendEmail({
to: customerEmail,
subject,
html,
text,
replyTo: process.env.ROVELA_WAREHOUSE_REPLY,
tags: { type: "shipping", shipment_id: shipmentId, order_id: orderId },
idempotencyKey: `shipment:${shipmentId}`,
});
} catch (err) {
if (err instanceof ApiError) {
// The carton can still leave the dock; mail is queued asynchronously.
console.error("shipping email failed", err.statusCode, err.message);
return { object: "email", id: null, emailError: err.message };
}
throw err;
}
}
trackingUrl, carrierName, and orderId are your domain fields. Store them however your warehouse already does, then pass the customer address and the public tracking URL to POST /emails. Do not treat click tracking in the email product as a substitute for the carrier’s tracking page; if you care about opens and clicks on the message itself, that is a separate topic covered in the open and click tracking guide.
If a single wave later needs many personalized confirmations in one go — a truck that just closed with eighty cartons — you can mention batch (POST /emails/batch, up to 100 messages, each processed independently). template and topic_id are rejected on batch rather than ignored; send those through POST /emails. The batch example and the batch transactional email guide cover the request shape.
This is also a poor place to reuse a checkout or billing tutorial. Ecommerce order email is the “we received your order” path. Lemon Squeezy, Paddle, Polar, and Gumroad cover payment webhooks. Keep this helper for the moment the label is printed and the carton has left.
Errors you should handle in the helper
Every documented error uses the same envelope, so one ApiError covers them (Quick Start, Email API error handling):
{ "statusCode": 400, "name": "Bad Request", "message": "html or text body is required" }
The message says what was wrong. Surface it in your worker logs as-is.
400— a missing required field, a base64 attachment that does not decode, afromdomain that does not belong to your organization, atemplatethat does not exist, or more than 50 recipients on one message.ccandbcccount toward billing and toward that cap (cc and bcc).401— missing or invalid credential, or asending_accesskey used to read, reschedule, or cancel a message.429— rate limit exceeded. The first-email guide notes that the rate limit is per key, and that each message in a batch counts individually. The official batch example waits onRetry-Afterwhen that header is present (and falls back to one second if it is not). This article will not invent a requests-per-second number, because the public docs do not publish one. Retries of a failed HTTP call should reuse the same idempotency key (Email API retries, rate limits).
HTTP 200 on send is not delivery. If you need to look a message up later, GET /emails/:id and GET /emails/:id/events require a full_access key or a dashboard session — do not put that key in the same helper you call from every carton. Managing sending domains is a different API and a different key scope (Domains API, Email API authentication, sending domains API). A sending_access key used on a management endpoint such as GET /domains is documented as 403; that is not the same as a failed send.
A worker should not fail the shipment just because mail queued slowly. Record that the carton left, log the error, and let your webhook or a later retry (with the same idempotency key) finish the notice.
Delivery is asynchronous — do not poll from the shipper
The worker should record the message id and return. Confirm delivery in the dashboard, with the Email delivery status API, or with a webhook. For production, prefer a webhook over polling GET /emails/:id from the fulfillment job. Closing out a wave should not wait on inbox arrival.
A webhook endpoint reads the raw body, verifies x-resend-signature, and returns 2xx quickly. Verification is byte-exact HMAC-SHA256 over "<timestamp>.<raw body>" (webhook security). A 400 you return because a payload surprised you is a permanent loss; store anything you do not yet understand rather than rejecting it. Deduplicate on the event id. Managing webhook endpoints themselves is covered in the Email Webhooks API guide and the signature verification walkthrough.
When you need a message to go out later — a “out for delivery today” note you only want to queue after a morning scan — use scheduled_at (scheduled email). POST /emails/:id/cancel can cancel a message that has not been sent yet; reading, rescheduling, and cancelling need a full_access key or a dashboard session. Public docs do not describe a reschedule request body, so this article will not invent one. Reusable layouts belong in the Templates API and the templates guide.
What not to do in a shipping worker
Do not invent a Rovela shipping plugin, a dashboard click path that is not in the docs, or a special carton object Rovela would have to provide. This integration is plain HTTP from your own fulfillment code.
Do not call the Emails API from a browser packing UI or a customer-facing tracking page. The key would travel with the page. Call it from the worker that already marked the shipment as handed to the carrier.
Do not point Nodemailer or any other SMTP client at Rovela mailbox SMTP and call that your shipper. Mailbox SMTP is for mail apps: a mailbox can send only as itself, and a single client address is limited to 30 messages a minute. That is the wrong default for warehouse volume.
Do not treat this guide as a replacement for an order-placed, receipt, or invoice article, and do not treat it as a broadcast or contacts tour. Public docs for contacts, topics, segments, and broadcasts are not used as a product walkthrough here. This helper is for the mail your warehouse sends after a carton is in transit.
Hosted mailboxes are a different product surface. People can read and send from them in a mail app. Your fulfillment process should not share a device credential with someone else’s Thunderbird profile.
If you ship on behalf of several brands from one organization, restrict a key to a single domain so a leak cannot send as somebody else (Email API for multi-tenant SaaS). Nearby notification patterns live in the email notification API overview if you need a broader map, then come back here for the shipping shape.
If you later compare providers, the documented pages include Rovela vs Postmark, vs SendGrid, vs Mailgun, vs Resend, vs Brevo, and vs Amazon SES.
A compact shipping confirmation checklist
- Verify the sending domain before you set
from. An unverified domain is a 400, not a silent drop. - Keep
ROVELAcredentials in the worker environment and import the helper only from server code that already recorded the shipment. - Prefer a
sending_accesskey in production shippers; keepfull_accessfor tooling that reads events or manages webhooks. - Send both
htmlandtext, include the public tracking URL in both, setreply_toif the warehouse should see replies, and tag the message withtype=shippingand the shipment id. - Set an
Idempotency-Keyderived from the shipment id on any path a scanner retry or a queue redelivery can hit twice. - Record the message
idand return from the worker. Do not fail the shipment because mail is still queueing. Watch delivery with a webhook, not a loop in the shipper. - If you need a first request in curl, use the transactional email API overview, then come back to this helper for the fulfillment shape.