← Back to blog

Shipment Out for Delivery Email API (2026): Tell a Buyer Their Package Is Out for Delivery with POST /emails

After the fulfillment backend already marks a package out for delivery, email the buyer the tracking permalink they already have using Rovela POST /emails. Rovela does not fulfill or track packages.

Updated November 11, 2026
Shipment Out for Delivery Email API (2026): Tell a Buyer Their Package Is Out for Delivery with POST /emails

An out-for-delivery notice is not a shipped, delivered, or delayed shipment mail

When the fulfillment backend has already recorded that a package is out for delivery — the shipment is in an out-for-delivery state, a tracking permalink the buyer can open is already minted, that mid-mile event is finished — that process still has to tell the buyer: “Your package is out for delivery,” plus the tracking permalink they already have. That send is transactional email. It is not a marketing campaign, not a catalog newsletter, and it is not a rewrite of the shipping confirmation, Hasura shipment-marked-shipped, shipping delivered, or shipment delayed guides. Those tutorials already exist, and they describe a customer being told an order has shipped, a shipped event being raised from an event trigger, a customer being told a shipment was delivered, or a buyer being told a shipment is delayed. This article is one later event in your own fulfillment workflow: the package has already been marked out for delivery, and a tracking permalink already exists. Rovela does not fulfill orders, track packages, or talk to a carrier — this is your backend’s own out-for-delivery event, sent through POST /emails. The recipient is the buyer (the address you already store on that shipment). The call to action is “open tracking,” not “your order has shipped,” not “your shipment was delivered,” and not “your shipment is delayed.”

Point the permalink at a URL the buyer can actually open now — the tracking page your fulfillment system already minted when the package was marked out for delivery. Do not attach a complete scan history, a customs worksheet, or a dump of every warehouse hop unless you have a deliberate reason and the file is small enough for your own product rules; the documented call to action is the tracking permalink they already have. Do not deep-link a warehouse console the buyer cannot open. If the useful destination is simply the tracking page they already have, that URL is the right destination. There is no client library to install, and there is no official Rovela fulfillment plugin or tracking product. Use a Go net/http client plus curl in a shell when you want to prove the JSON. The JSON body and headers are the product. The fulfillment backend that already marked the package out for delivery should send the notice; Rovela does not change shipment status and does not invent a carrier product.

This is also not a rewrite of nearby commerce guides. The BigCommerce remaining-items tutorial tells a customer that leftover items will ship in a separate package; it is not an out-for-delivery mail. The PrestaShop click-and-collect ready tutorial tells a customer an order is ready for pickup. The order canceled, Shopify gift-card issued, and WooCommerce refund issued tutorials are different events entirely. Nearby Go guides such as Go transactional email cover other callers; they do not replace this out-for-delivery story. Rovela’s Email API is a single HTTPS call. 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 {"object":"email","id":"..."}. HTTP 200 means the message was accepted and queued, not that it has already arrived (Quick Start).

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 backend belongs on POST /emails, which is also the distinction drawn in Email API vs SMTP relay. Related reading on the HTTP shape includes the transactional email API, the simple transactional email API, and sending transactional email from an app.

A fulfillment backend records that a package was already marked out for delivery, then a Go client posts JSON with the tracking permalink to the email API and receives a message id

What you need before the first out-for-delivery notice

The first-email guide and the Quick Start are the same five steps, whether the caller is curl or a Go net/http helper inside your fulfillment service:

  1. Create an account. You start on the free plan, which sends real mail. There is no separate sandbox, and no test key that behaves differently from production.
  2. Add and verify a sending domain (a subdomain such as mail.example.com is a common choice). You cannot send from a domain you have not verified; an unverified or foreign from is 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, the Domains API, and what domain email is.
  3. Create an API key. A sending_access key can send and nothing else — the right default for a production out-for-delivery notifier. A full_access key can also read messages and events, and manage domains, templates, and webhooks. The full key is shown once.
  4. Send with POST /emails.
  5. Confirm delivery in the dashboard, with GET /emails/:id or GET /emails/:id/events (those reads need full_access or a dashboard session), or with a webhook.

from is a string in the documented form "Fulfillment <shipping@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 and the sending domains API overview. Related reading on records and subdomains includes how email authentication works, how to set up domain email, and sending subdomain setup.

At least one of html, text, or template is required. template is a documented { id, variables } object and is mutually exclusive with html and text. Send both html and text where you can — many clients preview the text part, which is often where the buyer first sees the tracking permalink (HTML email API). If you later store reusable copy in a template, follow the templates guide; this article keeps the copy inline so the service stays easy to read.

A fulfillment backend that sends after the package is already out for delivery

Keep the Rovela key out of the browser, out of a public repository, and out of a container image. A leaked sending_access key can send mail as your domain. The fulfillment backend that already marked the package out for delivery should read ROVELA_API_KEY from its process environment and call Rovela only on the server (email API authentication). If a carrier scan or warehouse event marks the package out for delivery in your own store, write that out-for-delivery record first (status out for delivery, tracking permalink already minted and reachable by the buyer), then enqueue the notice. Do not call the Email API from a storefront script, and do not invent a Rovela plugin that changes shipment status — Rovela only sends the mail.

Store the event first: the shipment id you already have, a short order or package label you already show on the tracking page, the buyer’s address, and the tracking permalink they already have. The send is just the notice. The recipient is consistently the buyer whose package was just marked out for delivery — not every warehouse operator, not a marketing segment, and not a shared support inbox unless you add that address deliberately. Key the Idempotency-Key to that out-for-delivery event so a retried worker does not mail the same “your package is out for delivery” notice twice. A later out-for-delivery event for a different package is a different event and should be a different key. If a later job records that the package was delivered or delayed, those are different guides, not this one.

// out_for_delivery_mailer.go
// Fulfillment backend helper. Plain net/http. No official Rovela fulfillment plugin.
// Send only after the package has already been marked out for delivery.

package fulfillmail

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"strings"
	"time"
)

type sendPayload struct {
	From    string            `json:"from"`
	To      string            `json:"to"`
	Subject string            `json:"subject"`
	HTML    string            `json:"html"`
	Text    string            `json:"text"`
	ReplyTo string            `json:"reply_to"`
	Tags    map[string]string `json:"tags"`
}

func sendEmail(to, subject, html, text, idempotencyKey, fromAddress string, tags map[string]string) (string, error) {
	body, err := json.Marshal(sendPayload{
		From:    "Fulfillment <" + fromAddress + ">",
		To:      to,
		Subject: subject,
		HTML:    html,
		Text:    text,
		ReplyTo: fromAddress,
		Tags:    tags,
	})
	if err != nil {
		return "", err
	}
	req, err := http.NewRequest(http.MethodPost, "https://api.rovela.dev/emails", bytes.NewReader(body))
	if err != nil {
		return "", err
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("ROVELA_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Idempotency-Key", idempotencyKey)
	client := &http.Client{Timeout: 30 * time.Second}
	resp, err := client.Do(req)
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		return "", fmt.Errorf("Rovela send failed: HTTP %d", resp.StatusCode)
	}
	var parsed struct {
		ID string `json:"id"`
	}
	if err := json.NewDecoder(resp.Body).Decode(&parsed); err != nil {
		return "", err
	}
	return parsed.ID, nil
}

func NotifyOutForDelivery(buyerEmail, packageLabel, trackingPermalink, shipmentID string) (string, error) {
	safeLabel := strings.NewReplacer("&", "&amp;", "<", "&lt;", ">", "&gt;").Replace(packageLabel)
	return sendEmail(
		buyerEmail,
		"Your package is out for delivery",
		"<p>Your package “"+safeLabel+"” is out for delivery.</p><p><a href=\""+trackingPermalink+"\">Open tracking</a></p>",
		"Your package \""+packageLabel+"\" is out for delivery.\n\nOpen tracking: "+trackingPermalink,
		"out-for-delivery-"+shipmentID,
		"shipping@yourdomain.com",
		map[string]string{"type": "out_for_delivery"},
	)
}

Call NotifyOutForDelivery from the fulfillment service or queued worker that already wrote out_for_delivery_at (or your own “out for delivery” flag) — after the tracking permalink exists and remains reachable by that buyer, not before. A typical pattern is a carrier webhook or warehouse event handler that persists the new status first, then enqueues the notice. Keep the HTTP call out of the request path that merely creates a shipment or marks it shipped; the buyer should be mailed when the package is actually out for delivery, not when the label is first printed. The email is a status notice, not a place to dump a complete scan log, a customs form, or every item in the carton the buyer can already inspect once they open tracking. If a later event marks the package delivered, that is a different event and should use a different idempotency key — do not reuse the out-for-delivery key, and do not treat this mail as a shipping delivered notice.

If several packages go out for delivery in a short window and you genuinely need one HTTP call per batch of notices, POST /emails/batch accepts up to 100 messages and rejects template and topic_id. Most fulfillment workflows are better served by one idempotent POST /emails per shipment. topic_id is only a documented field on the single-send endpoint; this guide does not walk through a topics product.

Idempotency, recipients, and what a 200 actually means

Fulfillment workers retry, and an “the package is out for delivery, notify the buyer” path can run more than once for the same record. Send an Idempotency-Key header (up to 256 characters). A retry of the same request within 24 hours returns the original response instead of sending again (idempotency). Key it to the shipment id (or to a specific out-for-delivery event id you already store), not to the clock and not to the buyer’s email alone. If the same address later has a different package marked out for delivery, that is a second notice and a second key.

A message may address at most 50 recipients across to, cc, and bcc combined. That is the transport’s limit, not a plan limit, and it is checked before the request is accepted. Quota is charged per recipient, not per message — cc and bcc count the same as to (cc and bcc). An out-for-delivery notice addresses the buyer whose package was just marked out for delivery. If a second contact also has to be told, add that address deliberately and accept that it counts as a second recipient. Do not cc every warehouse operator or a marketing list by default.

HTTP 200 from POST /emails means the message was accepted and queued. It is not a delivery receipt. The JSON is {"object":"email","id":"..."}. Persist that id next to the shipment record if you want to look the message up later from a dashboard session. Do not block the fulfillment service until a mailbox provider confirms delivery.

scheduled_at is a documented ISO 8601 future timestamp if you ever need to hold a notice (scheduled email). For a package that is already out for delivery, send immediately after the out-for-delivery record is written. If you did schedule a message and the buyer should not receive it, POST /emails/:id/cancel cancels an unsent message. Reading, cancelling, and any rescheduling need full_access or a dashboard session. This article does not invent a reschedule request body. Attachments, when you have a genuine reason to include one, use { filename, content, content_type } with content as base64; an out-for-delivery notice rarely needs a file.

Errors you should handle in the fulfillment service

Documented send errors use an envelope of { statusCode, name, message }:

  • 400 — a missing required field, a from domain that does not belong to your organization, a template that does not exist, or more than 50 recipients on one message. Fix the payload; retrying the same body will fail the same way.
  • 401 — a missing, malformed, or revoked Bearer key. Check the process environment, not the shipment row.
  • 429 — you are being rate limited. Back off and retry with the same Idempotency-Key so a later attempt cannot send a second notice for the same out-for-delivery event (rate limits, retries).

Treat unknown 5xx responses as retryable with the same key. Log name and message next to the shipment id; do not log the Bearer key. A practical walk-through is the email API error handling guide. Related operational reading includes email API logs and email API integration.

Delivery is asynchronous — do not poll from the fulfillment service

A 200 from POST /emails means accepted for delivery, not delivered. Reading GET /emails/:id or GET /emails/:id/events needs a full_access key or a dashboard session; a sending_access key cannot do it, and you should not add a polling loop inside the fulfillment backend. Subscribe to a webhook instead, and verify the signature header x-resend-signature as documented in webhook security and signature verification. Event names include accepted, delivered, opened, clicked, bounced, or failed. For a single message you can also use the email delivery status API or the dashboard from a support session. Related reading includes the email webhooks API and transactional email webhooks.

A generic shipped or delivered notice is a different tutorial; a fulfillment backend posts an out-for-delivery notice with the tracking permalink using POST /emails

What not to do in this out-for-delivery notice

  • Do not put the Rovela key in a browser client, a public repository, a storefront script, or a container image.
  • Do not invent a Rovela plugin that fulfills orders or tracks packages. Your backend already recorded the out-for-delivery status; Rovela delivers the mail. There is no official client library. Rovela is not changing shipment status.
  • Do not send this as an “your order has shipped,” “your shipment was delivered,” “your shipment is delayed,” or “your remaining items will ship separately” template borrowed from another tutorial. The permalink is a tracking page the buyer can now open, and the recipient is that buyer.
  • Do not include customs documents, payment details, password material, or a dump of warehouse notes in the email body. The notice carries a short package label and the permalink.
  • Do not send from mailbox SMTP for this. SMTP is for mail apps and mailboxes. A fulfillment backend should use the HTTP API. Inbound mail into a hosted mailbox is a different path, described in the webmail manual; this guide is an outbound out-for-delivery notice. If you are migrating an older mailer, see migrate SMTP to the Email API and SMTP ports 25, 465, and 587.
  • Do not poll GET /emails/:id with a sending_access key, and do not invent a reschedule body if you later cancel an unsent message.

A compact out-for-delivery checklist

  1. Verify the sending domain and create a sending_access key (Quick Start).
  2. Put ROVELA_API_KEY and ROVELA_FROM in the fulfillment service’s process environment, not in a storefront script.
  3. Record the out-for-delivery status first: the buyer’s address, a short package label, and the tracking permalink they already have.
  4. Call POST /emails with a Go net/http client (or curl), both html and text, a reply_to if you want replies in a shipping inbox, and an Idempotency-Key scoped to that shipment id.
  5. Treat HTTP 200 as accepted, not delivered. Persist the returned message id if you need it later.
  6. Confirm delivery with a signed webhook or from the dashboard.
  7. If you are comparing providers, the existing pages are Rovela vs Mailgun, vs Amazon SES, vs Postmark, vs SendGrid, vs Resend, and vs Brevo. For the HTTP shape itself, see the transactional email API, the curl sending guide, and the HTTP email API overview. For other notification patterns, see the email notification API guide.