← Back to blog

Hummingbird Transactional Email API (2026): Notify That a Signing Certificate Is Nearing Expiry with POST /emails

Send a “a signing certificate or credential in your app is nearing expiry, here is the settings permalink you already have” notice from a Swift Hummingbird handler with Rovela’s HTTP API: a Bearer key from the process environment, URLSession to POST /emails, plus curl, and an Idempotency-Key. No official Hummingbird or Swift SDK. Distinct from Vapor membership activation, the language-level Swift sending tour, Gin’s certificate-is-ready notice, and auth-lifecycle mails such as api-key-created or password-changed.

Updated November 11, 2026
Hummingbird Transactional Email API (2026): Notify That a Signing Certificate Is Nearing Expiry with POST /emails

A certificate-expiry notice is not a Vapor membership activation, a Gin “certificate is ready,” or an API-key-created mail

When a signing certificate or similar credential in your app is nearing expiry — a webhook signing cert that lapses next week, an Apple Pay or Apple Sign In certificate your settings page already tracks, a mutual-TLS client certificate your operators rotate — a Hummingbird (Swift) handler still has to tell the operator or account that owns it: “This signing certificate is nearing expiry,” plus the settings permalink you already have. That send is transactional email. It is not a newsletter, not a security digest, and it is not a rewrite of the Vapor transactional email, send email with Swift, Gin transactional email, API key created, password changed, two-factor enabled, new device login, or email changed guides. Those tutorials already exist. Vapor activates a membership from a Swift route. The language-level Swift tour shows how to post JSON, not this expiry reminder. Gin announces that a certificate is ready — a generated cert the recipient can download — which is a different lifecycle moment from “this credential is about to lapse.” API-key-created, password-changed, two-factor-enabled, new-device-login, and email-changed are auth-lifecycle notices. This guide is a Hummingbird HTTP handler or worker that fires after your Swift service has already recorded the upcoming expiry and minted a settings permalink. The recipient is consistently the operator or account owner whose address you already store on that credential, not a random teammate. The call to action is “open settings and rotate or replace this credential,” not “your membership is active,” and not “here is a certificate to download.”

This guide does not invent an official Hummingbird plugin or a Rovela Swift SDK. There is no client library to install. The public docs do not describe an official Hummingbird connector, and this article will not invent one. The examples use URLSession from an async Hummingbird-compatible helper, plus a short curl. Another Swift HTTP client would post the same JSON; this article uses URLSession because it ships with the language. The JSON body and headers are the product.

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

A Hummingbird handler records that a signing certificate is nearing expiry, then a URLSession client posts JSON with the settings permalink to the email API and receives a message id

What you need before the first certificate-expiry notice

The first-email guide and the Quick Start are the same five steps, whether the caller is curl or URLSession inside a Hummingbird worker:

  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 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 expiry 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 "Security <security@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 the operator first sees the settings permalink (HTML email API).

A Hummingbird helper that sends after the expiry is already recorded

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 Hummingbird process that already recorded the upcoming expiry should read ROVELA_API_KEY from its process environment and call Rovela only on the server.

Store the event first: the credential id you already have, the operator’s address, the expiry date you already store if you show one, and the settings permalink. The send is just the notice. Key the Idempotency-Key to that reminder event so a retried daily sweep does not mail the same “this certificate lapses soon” notice twice. A later reminder window, or a different credential, is a different event and should be a different key.

// RovelaClient.swift — Hummingbird-compatible helper, URLSession, no official SDK
import Foundation

enum RovelaError: Error {
    case missingEnv(String)
    case http(Int, String)
}

struct RovelaSendResponse: Decodable {
    let id: String
}

func requireEnv(_ name: String) throws -> String {
    guard let value = ProcessInfo.processInfo.environment[name], !value.isEmpty else {
        throw RovelaError.missingEnv(name)
    }
    return value
}

func sendEmail(
    to: String,
    subject: String,
    html: String,
    text: String,
    replyTo: String?,
    tags: [String: String],
    idempotencyKey: String
) async throws -> String {
    let apiKey = try requireEnv("ROVELA_API_KEY")
    let from = try requireEnv("ROVELA_FROM")

    var body: [String: Any] = [
        "from": from,
        "to": to,
        "subject": subject,
        "html": html,
        "text": text,
        "tags": tags,
    ]
    if let replyTo { body["reply_to"] = replyTo }

    var request = URLRequest(url: URL(string: "https://api.rovela.dev/emails")!)
    request.httpMethod = "POST"
    request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    request.setValue(idempotencyKey, forHTTPHeaderField: "Idempotency-Key")
    request.httpBody = try JSONSerialization.data(withJSONObject: body)

    let (data, response) = try await URLSession.shared.data(for: request)
    let status = (response as? HTTPURLResponse)?.statusCode ?? 0
    if !(200..<300).contains(status) {
        let obj = (try? JSONSerialization.jsonObject(with: data) as? [String: Any]) ?? [:]
        let message = obj["message"] as? String ?? "request failed"
        throw RovelaError.http(status, message)
    }
    return try JSONDecoder().decode(RovelaSendResponse.self, from: data).id
}

func notifyCertificateNearingExpiry(
    operatorEmail: String,
    credentialName: String,
    expiresOn: String,
    settingsPermalink: String,
    reminderId: String
) async throws -> String {
    let subject = "Signing certificate nearing expiry: \(credentialName)"
    let text = """
    The signing certificate “\(credentialName)” is nearing expiry on \(expiresOn).

    Open settings to rotate or replace it: \(settingsPermalink)
    """
    let html = """
    <p>The signing certificate “\(credentialName)” is nearing expiry on \(expiresOn).</p>
    <p><a href="\(settingsPermalink)">Open settings to rotate or replace it</a></p>
    """
    return try await sendEmail(
        to: operatorEmail,
        subject: subject,
        html: html,
        text: text,
        replyTo: "security@yourdomain.com",
        tags: ["type": "certificate_nearing_expiry"],
        idempotencyKey: "hummingbird-cert-expiry-\(reminderId)"
    )
}

Call notifyCertificateNearingExpiry from the Hummingbird route or scheduled worker that already wrote the reminder — for example after your credentials store marks a certificate as expiring within a window you already chose. The helper is ordinary URLSession; Hummingbird does not need a mail middleware. The same JSON works from curl, which is useful when you are proving the domain and the key before wiring the worker:

curl -X POST https://api.rovela.dev/emails \
  -H "Authorization: Bearer $ROVELA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: hummingbird-cert-expiry-rem_01JK9P" \
  -d '{
    "from": "Security <security@yourdomain.com>",
    "to": "owner@example.com",
    "subject": "Signing certificate nearing expiry: webhook-signing-2025",
    "html": "<p>The signing certificate “webhook-signing-2025” is nearing expiry on 2026-11-25.</p><p><a href=\"https://app.example.com/settings/certificates\">Open settings to rotate or replace it</a></p>",
    "text": "The signing certificate “webhook-signing-2025” is nearing expiry on 2026-11-25.\n\nOpen settings to rotate or replace it: https://app.example.com/settings/certificates",
    "reply_to": "security@yourdomain.com",
    "tags": {"type": "certificate_nearing_expiry"}
  }'

Read email API authentication if you want a closer look at Bearer keys. Optional fields used here — reply_to and tags — are documented; tags may be an object or an array of arbitrary labels (email API tags, email API reply-to). You can also set headers or topic_id as documented fields; this tutorial does not turn topic_id into a product tour, and it does not attach a certificate file. The settings permalink is the call to action; do not put a private key in the email.

Idempotency, recipients, and what a 200 actually means

Expiry sweeps retry, and a daily job can see the same certificate more than once. 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 the header to the reminder event id (hummingbird-cert-expiry-<reminderId>), not to the credential name or the operator’s email alone — the same owner can have another certificate, or a later reminder window, and that is a different notice.

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. A certificate-expiry notice almost always has one to (the operator who owns the credential). Do not cc a shared security mailbox by default unless you intend that mailbox to count against quota and to receive a copy of every reminder. A second staff copy should be its own message, with its own idempotency key such as hummingbird-cert-expiry-rem_01JK9P-staff.

If you ever need to notify many independent credentials in one go (a rare catch-up, not the usual path), 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. Each item should still carry its own business key if you send them as individual POST /emails calls; if you use the batch endpoint, keep the rest of the payload identical to a single send, without template or topic_id.

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

You can also set scheduled_at to an ISO 8601 future timestamp. An expiry reminder is sometimes scheduled for a window you already chose (for example, fourteen days before the date you store). If you schedule one and then decide not to send it — the certificate was rotated early — POST /emails/:id/cancel can cancel a message that has not been sent yet. Reading, rescheduling, and cancelling need full_access or a dashboard session. This guide does not invent a reschedule request body.

Errors you should handle in the Hummingbird worker

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 the secret the process is actually reading.
  • 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).

Map 400 and 401 to a non-retryable failure, and 429 to a retry with the same key, so a typo in from does not spin the queue. 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).

Do not conflate this send with a Vapor membership activation, the language-level Swift sending tour, a Gin certificate-is-ready download notice, an API key created mail, or a password changed notice. Those articles cover different stacks or different lifecycle moments. This article covers a Hummingbird worker after a signing certificate is already nearing expiry, and the call to action is “open settings.”

Delivery is asynchronous — do not poll from the handler

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 Hummingbird request. 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.

A Vapor membership activation, Gin certificate-is-ready, or API-key-created notice is a different tutorial; a Hummingbird handler posts a certificate-nearing-expiry notice with the settings permalink using POST /emails

What not to do in this certificate-expiry notice

  • Do not put the Rovela key in a browser client, a public repository, or a container image.
  • Do not invent an official Hummingbird plugin or a Rovela Swift SDK. Your worker already recorded the expiry; Rovela delivers the mail. There is no official client library.
  • Do not attach a private key, a PEM file, or a certificate body. The settings permalink is enough.
  • Do not reuse a Vapor membership activation, send email with Swift, or Gin certificate-is-ready story. Gin’s notice is that a certificate can be downloaded. This article is an expiry warning.
  • Do not turn this into an API key created, password changed, two-factor enabled, new device login, or email changed tutorial. Those are auth-lifecycle notices, not credential-expiry reminders.
  • Do not send from mailbox SMTP for this. SMTP is for mail apps and mailboxes. A Hummingbird process 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 expiry notice.
  • Do not skip domain verification. An unverified from is refused. If you send on behalf of several brands or tenants, a key restricted to a single domain limits the blast radius of a leak (Email API for multi-tenant SaaS).

A compact certificate-expiry checklist

  1. Verify the sending domain and create a sending_access key (Quick Start).
  2. Put ROVELA_API_KEY and ROVELA_FROM in the Hummingbird process environment, not in the browser.
  3. After your Hummingbird worker has already recorded that a signing certificate is nearing expiry and minted a settings permalink, POST https://api.rovela.dev/emails with URLSession (or the same JSON from curl).
  4. Send both html and text, include the settings permalink, and set Idempotency-Key to hummingbird-cert-expiry-<reminderId>.
  5. Optionally set reply_to and tags such as type=certificate_nearing_expiry. You may set scheduled_at if you already chose a reminder window.
  6. Handle 400, 401, and 429 from the error envelope. Confirm delivery with a webhook, not by polling inside the handler.
  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.