← Back to blog

RedwoodJS Transactional Email API (2026): Confirm a Waitlist Spot from a Service with POST /emails

Send a waitlist confirmation from a RedwoodJS api-side service with Rovela’s HTTP API: process.env on the server, plain fetch to POST /emails, and an Idempotency-Key. Never a Cell or browser call with a visible key, and not an invented official Redwood plugin.

Updated November 10, 2026
RedwoodJS Transactional Email API (2026): Confirm a Waitlist Spot from a Service with POST /emails

A waitlist confirmation belongs in a Redwood service, not in a Cell

When someone joins a waitlist and a seat opens, they need a message that says the spot is theirs: “Your waitlist spot is confirmed,” plus a link to finish signup or claim the seat. That send is transactional email. It is not a marketing drip, not an OTP, and it is not a rewrite of a Remix, Nuxt, Astro, SvelteKit, SolidStart, Qwik, Analog, TanStack Start, or Deno Fresh guide. Those tutorials already exist. This one is a RedwoodJS api-side service — typically under api/src/services — that runs after your Prisma (or other) data layer has already recorded the confirmation.

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).

Call the API from the api side only. A Cell, a page, or a GraphQL query that runs in the browser must never see the key. This guide uses plain fetch and process.env in a service (or a small helper under api/src/lib). It does not invent an official Redwood mailer package or a Rovela plugin.

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 Redwood service belongs on POST /emails, which is also the distinction drawn in Email API vs SMTP relay.

A Redwood api service confirms a waitlist spot, then posts JSON to the email API and receives a message id

What you need before the first Redwood send

The first-email guide and the Quick Start are the same five steps, whether your caller is a service function or a curl from your laptop:

  1. Create an account. You start on the free plan, which sends real mail. There is no separate sandbox or test key.
  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 and what domain email is.
  3. Create an API key. A sending_access key can send and nothing else — the right default for the api side. 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 "Waitlist <hello@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 person first sees that their spot is confirmed (HTML email API).

A service helper and environment variables on the api side

Put the key in the api side’s environment (.env that is not committed, or your host’s secret store) and read it only inside api/. Redwood web code, Cells, and the browser GraphQL client should never import this helper.

# api/.env (server only; never commit the live key, never expose to web/)
ROVELA_API_KEY=re_your_sending_key
ROVELA_FROM=Waitlist <hello@mail.example.com>
ROVELA_REPLY=support@mail.example.com
// api/src/lib/emails.js — plain 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
}

Call it from a service after the confirmation row is saved — not from a resolver that runs only to render a Cell:

// api/src/services/waitlist/waitlist.js
import { db } from "src/lib/db"
import { sendEmail } from "src/lib/emails"

export const confirmWaitlistSpot = async ({ id }) => {
  const entry = await db.waitlistEntry.update({
    where: { id },
    data: { status: "confirmed", confirmedAt: new Date() },
  })
  const claimUrl = `https://app.example.com/waitlist/claim/${entry.claimToken}`
  const result = await sendEmail({
    to: entry.email,
    subject: "Your waitlist spot is confirmed",
    html: `<p>Your waitlist spot is confirmed.</p><p><a href="${claimUrl}">Claim your spot</a></p>`,
    text: `Your waitlist spot is confirmed. Claim it: ${claimUrl}`,
    replyTo: process.env.ROVELA_REPLY,
    tags: { type: "waitlist_confirmed", entry_id: String(entry.id) },
    idempotencyKey: `waitlist-confirmed-${entry.id}`,
  })
  return { ...entry, emailId: result.id }
}

The same JSON is a short curl for a runbook:

curl -X POST https://api.rovela.dev/emails \
  -H "Authorization: Bearer re_your_sending_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: waitlist-confirmed-wl_01J8K2" \
  -d '{
    "from": "Waitlist <hello@mail.example.com>",
    "to": "ada@example.com",
    "subject": "Your waitlist spot is confirmed",
    "html": "<p>Your waitlist spot is confirmed.</p><p><a href=\"https://app.example.com/waitlist/claim/tok_01\">Claim your spot</a></p>",
    "text": "Your waitlist spot is confirmed. Claim it: https://app.example.com/waitlist/claim/tok_01",
    "reply_to": "support@mail.example.com",
    "tags": {"type": "waitlist_confirmed", "entry_id": "wl_01J8K2"}
  }'

A successful body is {"object": "email", "id": "9f1c2e40-..."}. Store that id next to the waitlist row if you want a support trail; do not treat it as proof of delivery.

tags are documented as arbitrary labels and come back with the message (email API tags). reply_to is optional; use it when replies should reach a support mailbox rather than the from address (email API reply-to).

Idempotency, recipients, and what a 200 actually means

A mutation can be retried — GraphQL clients, background jobs, or a developer re-running a script. Send an Idempotency-Key header (up to 256 characters) keyed to the waitlist entry id. A retry of the same request within 24 hours returns the original response instead of sending again (idempotency).

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. A waitlist confirmation almost always has one to.

If you ever need to confirm many independent entries in one go, POST /emails/batch accepts up to 100 messages, each with the same schema. Two fields are rejected rather than ignored: template and topic_id. Send those through POST /emails. See the batch example and the batch transactional email guide. You do not need a batch for a single confirmation.

template is documented as { id, variables } and is mutually exclusive with html and text. This tutorial sends both html and text so the claim URL is visible in the notification preview. If you later switch to a stored template, use POST /emails (not batch) and follow the Templates API and the templates guide.

Errors you should handle in the 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 or invalid credential, or a sending_access key used to read, reschedule, or cancel a message. Check that the api side, not the web side, is reading ROVELA_API_KEY.
  • 429 — rate limit exceeded. Each message in a batch counts individually. Back off and retry with the same Idempotency-Key (email API retries, rate limits).

Let the service throw ApiError so a Redwood function or a job can record the failure against the entry. Broader patterns are in Email API error handling. Domain management endpoints such as GET /domains return 403 for a sending_access key — that is expected; leave domain work to the dashboard or a full_access key (Domains API, sending domains API).

Delivery is asynchronous — do not poll from the 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 block a GraphQL mutation on a polling loop. 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.

POST /emails/:id/cancel can cancel a message that has not been sent yet, which is relevant if you used scheduled_at (an ISO 8601 timestamp in the future). Reading, rescheduling, and cancelling need full_access or a dashboard session. A request body for rescheduling is not documented here, so this guide does not invent one. Everyday waitlist confirmations should send immediately.

A browser Cell with a visible key is unsafe; a Redwood api service posts a waitlist confirmation with POST /emails

What not to do in a Redwood codebase

  • Do not import the email helper from web/, a Cell, or a browser GraphQL document. The key must stay on the api side (email API authentication).
  • Do not invent an official Rovela Redwood plugin or a framework-specific SDK — there isn’t one in this guide.
  • Do not treat this as a rewrite of another meta-framework tour. The trigger is a waitlist confirmation in a Redwood service, not a generic “send email from a route.”
  • Do not send from mailbox SMTP for this. SMTP is for mail apps and mailboxes. A service should use the HTTP API.
  • Do not skip domain verification. An unverified from is refused. If you send on behalf of several tenants, a key restricted to a single domain limits the blast radius of a leak (Email API for multi-tenant SaaS).

The helper above is intentionally small. It sets Authorization and an optional Idempotency-Key, sends JSON to https://api.rovela.dev/emails, and turns the documented error envelope into an exception your service can log. It does not wrap Rovela in an invented client, and it does not try to manage domains or templates — those jobs belong to the dashboard or a full_access key, not to a waitlist mutation. If a later job needs to notify a group of confirmed entries, keep using one message per person rather than stuffing many addresses into cc or bcc just to save a request: billing is per recipient, and a bounced address in a shared recipient list is harder to interpret than a single tagged send.

A compact Redwood checklist

  1. Verify the sending domain and create a sending_access key (Quick Start).
  2. Put ROVELA_API_KEY and ROVELA_FROM in the api-side environment, not in web/.
  3. After the confirmation is saved, call POST https://api.rovela.dev/emails from a service or api/src/lib helper.
  4. Send both html and text, include the claim URL, and set Idempotency-Key to waitlist-confirmed-<id>.
  5. Optionally set reply_to and tags such as type=waitlist_confirmed.
  6. Handle 400, 401, and 429 from the error envelope. Confirm delivery with a webhook, not by polling inside the mutation.
  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.

That is the whole integration: a Redwood service you already run, one HTTPS POST, and a confirmation the person on the waitlist can act on.