DEV Community

Vigilmon
Vigilmon

Posted on

How to Monitor Your Resend Email API with Vigilmon

How to Monitor Your Resend Email API with Vigilmon

Resend is a modern email API built for developers — clean SDK, React Email support, and excellent deliverability. But when email is mission-critical (password resets, receipts, notifications), you need to know immediately if Resend or your email integration goes down.

Why Monitor Email Delivery?

Email failures are silent. When Resend has an outage or your integration breaks:

  • Users can't reset their passwords
  • Transactional receipts don't arrive
  • Account verification emails bounce
  • Users assume your app is broken

External monitoring catches these failures before users escalate to support.

Monitor Resend's Service Status

In Vigilmon:

  • URL: https://status.resend.com
  • Check interval: 5 minutes
  • Expected status: 200

Application Email Health Route

Node.js / TypeScript:

import { Resend } from "resend";

const resend = new Resend(process.env.RESEND_API_KEY);

app.get("/health/email", async (req, res) => {
  try {
    // Use the domains endpoint — lightweight, no email sent
    const { data, error } = await resend.domains.list();

    if (error) {
      return res.status(503).json({
        status: "error",
        provider: "resend",
        message: error.message,
      });
    }

    res.json({
      status: "ok",
      provider: "resend",
      domains: data?.data?.length ?? 0,
    });
  } catch (err) {
    res.status(503).json({ status: "error", message: String(err) });
  }
});
Enter fullscreen mode Exit fullscreen mode

Next.js App Router:

// app/api/health/email/route.ts
import { Resend } from "resend";
import { NextResponse } from "next/server";

const resend = new Resend(process.env.RESEND_API_KEY);

export async function GET() {
  try {
    const { data, error } = await resend.domains.list();

    if (error) {
      return NextResponse.json({ status: "error", message: error.message }, { status: 503 });
    }

    return NextResponse.json({ status: "ok", domains: data?.data?.length ?? 0 });
  } catch (err) {
    return NextResponse.json({ status: "error", message: String(err) }, { status: 503 });
  }
}
Enter fullscreen mode Exit fullscreen mode

Python (FastAPI):

import httpx
from fastapi.responses import JSONResponse

@app.get("/health/email")
async def email_health():
    try:
        async with httpx.AsyncClient() as client:
            response = await client.get(
                "https://api.resend.com/domains",
                headers={"Authorization": f"Bearer {settings.RESEND_API_KEY}"},
                timeout=10.0
            )

        if response.status_code == 200:
            return {"status": "ok", "provider": "resend"}
        return JSONResponse(status_code=503, content={"status": "error"})
    except Exception as e:
        return JSONResponse(status_code=503, content={"status": "error", "message": str(e)})
Enter fullscreen mode Exit fullscreen mode

Add to Vigilmon

  1. Log in at vigilmon.online
  2. Click + Add Monitor
  3. URL: https://your-app.com/api/health/email
  4. Check interval: 2 minutes
  5. Expected status: 200

Heartbeat Monitoring for Email Flows

For end-to-end testing, set up a heartbeat monitor and ping it from a cron job:

// cron: every 30 minutes
async function emailHealthCheck() {
  const { error } = await resend.emails.send({
    from: "health@your-app.com",
    to: "monitor@your-app.com",
    subject: "Email health check",
    text: "Automated health check.",
  });

  if (!error) {
    await fetch("https://vigilmon.online/heartbeat/your-heartbeat-id");
  }
}
Enter fullscreen mode Exit fullscreen mode

What to Monitor

Monitor URL Purpose
Resend status https://status.resend.com Provider status
App email health /api/health/email Integration health
Heartbeat Vigilmon heartbeat Synthetic email test

Email is infrastructure. Monitor it like infrastructure.


Vigilmon — free uptime monitoring for Resend, SendGrid, and any email API integration.

Top comments (0)