DidMyFormSend

Guide: Resend

Resend email not sending? Each error, what it means and the fix.

Resend answers every send with an HTTP status and an error name. On a contact form the usual ones are 401 validation_error (the API key is invalid), 403 validation_error (the from domain is not verified, or resend.dev is sending to someone other than you) and 429 (a quota or the rate limit). Log the status and the name, then fix it where the table below says.

  • €2 a month per form€1 from the 11th
  • 14-day trialCard added at the start
  • Ready codeCloudflare Workers, Supabase Edge Functions, Astro sites on Cloudflare, Next.js sites on Vercel or Node.js and plain PHP sites, sending through Resend, and FormHaven forms with no code

Step 1

Read Resend's answer before you guess

Resend answers every send. An accepted mail gets a 200 with the email's id. A refusal gets a 4xx or 5xx status and a JSON body with a name (the code you look up below), a message in words and the statusCode. Resend's Node.js SDK hands back the same thing as { data, error }.

If your code logged nothing, Resend did. Its Logs page shows each API request with the status code and the full response body. Filter on Errors, and for supported errors the Help me fix button opens the fix.

Note the status and the name. validation_error covers several problems, and the status tells them apart: 400 is a bad field, 401 a bad key, 403 a domain problem.

Two answers from POST /emailsapi.resend.com
HTTP/1.1 200 OK
{ "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" }

HTTP/1.1 401 Unauthorized
{ "message": "API key is invalid", "name": "validation_error", "statusCode": 401 }
The refusal is what a deleted API key gets.Example

Step 2

Every refusal a contact form can get, and its fix

These are the errors on Resend's errors reference that a handler calling POST /emails can hit. The message is Resend's own wording; where it names your domain or address, it is shown as Resend's docs show it.

Status and nameResend's messageWhat it means and the fix
400 validation_error"An error was found with one or more fields in the request."A field is wrong, for example a malformed to or from address. The message names the field and the error: fix that field.
401 missing_api_key"Missing API Key"The request had no Authorization header. The API key variable is empty in this deploy: set it.
401 validation_error"API key is invalid"For sending, Resend returns this for a key that does not exist, was deleted or is not active. Create a key on the API Keys page and update the secret.
403 restricted_api_key"API key is not active"Check the key on the API Keys page and create a new one if needed.
403 suspended_api_key"This API key is suspended"Contact Resend support if you think this is a mistake.
403 validation_error"You can only send testing emails to your own email address (youremail@domain.com). To send emails to other recipients, please verify a domain at resend.com/domains, and change the from address to an email using this domain."The handler sends from resend.dev to someone other than you. Verify your own domain and send from it.
403 validation_error"The domain.com domain is not verified. Please, add and verify your domain."The from address is on a domain that is not verified in this Resend account. See the fix below.
422 missing_required_field"The request body is missing one or more required fields."For example no subject or no to. The message lists the missing fields.
429 daily_quota_exceeded"You have exceeded your daily email sending quota."Upgrade, or wait for the reset at midnight UTC. Sent and received emails both count.
429 monthly_quota_exceeded"You have exceeded your monthly email sending quota."Upgrade, or turn on pay-as-you-go on a paid plan. Sent and received emails both count.
429 rate_limit_exceeded"Too many requests. Please limit the number of requests per second."Send fewer requests at once, for example through a queue, or ask Resend support for a higher limit.
500 application_error"An unexpected error occurred."Try again later and check Resend's status page.
503 service_unavailable"API is temporarily unavailable"Try again later and check Resend's status page.

One 403 is not in that table. Resend's API introduction says every request needs a User-Agent header, and that a 403 with error code 1010 despite a valid key most likely means the header is missing. The SDKs set it for you; a hand-written HTTP client may need to set it.

Step 3

Fix "domain is not verified"

The domain in your from address has to be one this Resend account verified. On the Domains page:

  1. Press Add Domain and enter the domain. Resend recommends a subdomain such as mail.example.com.
  2. Pick the region closest to most of your recipients.
  3. Copy the DKIM and SPF records from the Records tab into your DNS, exactly as Resend generated them. On Cloudflare DNS, keep the CNAME records on DNS only (grey cloud), or verification does not complete.
  4. Wait. A domain often verifies within 15 minutes; DNS can take up to 72 hours. Resend's dns.email tool shows whether the records are public yet, and Restart verification starts a fresh check.

Then match from to what you verified. If you verified only a subdomain, send from an address at that subdomain: verifying mail.example.com lets you send from form@mail.example.com, not from form@example.com. The domain may also sit in a different Resend account than the API key: check you are signed in to the one the key belongs to.

The from address against the verified domain
; Verified in Resend: mail.example.com

from: "Website <form@example.com>"        ; 403 validation_error: not verified
from: "Website <form@mail.example.com>"   ; accepted
Example

Step 4

Fix an invalid, inactive or suspended key

A 401 validation_error or a 403 restricted_api_key means the key the handler sends is not one Resend accepts any more. Make a new one on the API Keys page. A key limited to sending is enough for a contact form.

Then put it where the handler reads it, in every deploy that serves the form:

  • Cloudflare Worker: npx wrangler secret put RESEND_API_KEY. It creates a new version of the Worker and deploys it at once.
  • Vercel: change the variable in the project's settings, then redeploy. A change applies to new deployments only.

A 403 suspended_api_key is Resend's decision, not yours to fix in code: contact their support.

Key problems, by answer
401 missing_api_keyNo key reached Resend: the variable is empty here.
401 validation_errorThe key does not exist, was deleted or is not active.
403 restricted_api_key"API key is not active".
403 suspended_api_keyResend suspended the key.

Step 5

Fix a quota or rate limit

Three 429s. daily_quota_exceeded resets at midnight UTC, monthly_quota_exceeded needs an upgrade or pay-as-you-go on a paid plan, and both count received emails as well as sent ones. rate_limit_exceeded means more than your team's limit per second: the default is 10 requests per second per team, across all its API keys.

A contact form rarely sends 10 a second. A bot that floods the form can use up the daily quota, though, and from then on every real enquiry that day gets a 429. Put the bot check (Turnstile, a honeypot field) before the send, so a bot never spends a send.

429, by name
  • daily_quota_exceededUntil 00:00 UTC Upgrade to remove the daily limit, or wait for the reset.
  • monthly_quota_exceededUntil you act Upgrade, or turn on pay-as-you-go on a paid plan.
  • rate_limit_exceededPer second Fewer requests at once. Resend's response headers say where you stand.

Step 6

Log it from a Worker or a Next.js route

Log the status and the name on every refusal, and you never need the dashboard to find out what went wrong.

sendWithResend, shown here, is the function DidMyFormSend's Cloudflare Worker code uses to send through Resend's REST API, copied from that code. It keeps the HTTP status, reads name from the body, and turns a timeout or a body that is not JSON into a short code of its own. It never keeps Resend's message: that sentence can hold an address.

With the Node.js SDK, read error from the result:

Next.js route handler, Resend SDK
// app/api/contact/route.js, with the Resend Node.js SDK
const { data, error } = await resend.emails.send(mail);

if (error) {
  // error.name is the code from the table, error.message the sentence.
  console.error("Resend refused the send:", error.name, error.message);
  return new Response("Sorry, your message could not be sent.", { status: 502 });
}
console.log("Resend accepted the mail:", data.id);
worker.js: sendWithResend
// Sends the mail and returns the report: Resend's real answer, read from its body.
async function sendWithResend(apiKey, mail) {
  const report = { result: "failed", provider: "resend", occurred_at: Math.floor(Date.now() / 1000) };

  let res;
  try {
    res = await fetch(RESEND_URL, {
      method: "POST",
      // Resend's docs say a request without a User-Agent is refused with 403, and
      // Cloudflare Workers send none by default, so it is set here.
      headers: {
        authorization: `Bearer ${apiKey}`,
        "content-type": "application/json",
        "user-agent": "didmyformsend-snippet/1",
      },
      body: JSON.stringify(mail),
      signal: AbortSignal.timeout(10000),
    });
  } catch (err) {
    report.provider_status = err && err.name === "TimeoutError" ? "timeout" : "network_error";
    return report;
  }

  report.http_status = res.status;
  let body = null;
  try {
    body = await res.json();
  } catch {
    report.provider_status = "non_json_response";
    return report;
  }

  const ok = res.ok && body && typeof body.id === "string" && body.id !== "" && !body.error;
  if (ok) {
    report.result = "sent";
    report.provider_status = String(res.status);
    const id = safe(body.id, /^[A-Za-z0-9_-]{1,64}$/);
    if (id) report.event_id = id;
    return report;
  }

  // Only Resend's short error code goes in the report, never its error sentence.
  const code = body && (body.name ?? (body.error && body.error.name));
  report.provider_status =
    safe(code, /^[A-Za-z0-9_.:-]{1,64}$/) ?? (res.ok ? "no_message_id" : "unknown_error");
  return report;
}
Copied from the code DidMyFormSend ships

Next time

Get the refusal by email the first time it happens

sendWithResend is half of DidMyFormSend. The other half reports what it read after every send, and you get an email when Resend refuses one, with the status and the name, for example "Resend answered: 403, validation_error." Signed tests go into the handler every week once it passes the setup check, so a broken key shows up even on a form nobody used that week.

The report holds Resend's answer to your handler's request. A bounce later on shows on Resend's Emails page.

Build the Worker handler step by step, or see how DidMyFormSend works.

MonitorsLast 30 days, UTC
  • bakery.example / contactSends refused Your form handler tried to email 3 messages, the latest on 22 November at 14:02 UTC, and the mail provider refused them. Resend answered 403.
  • example.com / quoteWorking Resend accepted the mail at 14:02 (message id re_8f2c41d9).
    24 Oct22 Nov
SentRefusedSkippedNo heartbeat Example data

Sources and other guides

Every error code, name and message on this page was read on the pages below on 23 November 2026. Providers change their wording, so check the page when something does not match.

  • Contact form not sending email? Check these six things.

    Usually the form works and the mail provider says no: a revoked API key, a sending domain that is no longer verified, or a sending limit. Many handlers show "Thanks" anyway, because they never read that answer. Log the provider's status code and error name, fix what it names, then check DNS and the spam folder.

  • A Cloudflare Worker contact form that sends through Resend

    The Worker reads the form post, sends the mail through Resend's API, waits for Resend's answer and tells the visitor what really happened. Keep the API key in a Worker secret, send from a domain you verified in Resend, and hand the report of each send to ctx.waitUntil so it runs after the visitor has their answer.

All guides

Hear about the next refused send from us.

Add the heartbeat to your handler and get an email when the provider says no. €2 a month per form, and the first charge comes after 14 days.