Skip to content
FunnelGuard

Fix guide by FunnelsGuard

ESP API key revoked or rotated: fix site emails that stopped

DLV-065High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

An API key is a secret string that proves your website is allowed to send email through your provider. Your site sends it with each request. If the key is deleted, expired, regenerated or limited to the wrong permissions, the provider answers with an authentication error, usually 401 Unauthorized or 403 Forbidden.

Where the email path breaks
  1. Visitor submits formForm passes validation
  2. Site calls ESP APISends the old key
  3. ESP rejects key401 or 403 returned
  4. Email to inboxNever sent
  5. Sales follow-upNobody knows the lead exists

The visitor sees a normal thank-you page, but the provider refuses the send.

Why it costs you leads or sales

How it unfolds (example)
  1. Day 0

    Someone rotates the key in the ESP dashboard for security.

  2. Day 0

    The site still uses the old key. Every send returns 401.

  3. Day 1-3

    Form entries look normal in analytics, but the inbox is quiet.

  4. Day 4

    A customer asks where their confirmation is.

  5. Day 4

    The new key is added and emails resume. Earlier leads need recovering by hand.

Leads reaching your inbox per dayExample numbers
Leads reaching your inbox per day (example)Before revoke: 10 leads; Day 1 after: 0 leads; Day 3 after: 0 leads; After fix: 10 leads048100010Before revokeDay 1 afterDay 3 afterAfter fixleads

Example: a site getting 10 form submissions a day. After the key is revoked, 0 notifications arrive until it is fixed.

How to check if your site has it

Confirm the key is the problem
  1. Submit a real test form

    Use a fresh email address you can read, and note the time.

  2. Check the ESP activity log

    In SendGrid look at Activity, in Mailgun at Logs, in Postmark at the message stream Activity, in SES at CloudWatch or your sending metrics. No entry for your test means the request never got accepted.

  3. Check the site or plugin error log

    Look for 401, 403, 'Unauthorized', 'Forbidden', 'Invalid API key' or 'The security token included in the request is invalid'. In WordPress, your SMTP or mail logging plugin shows these.

  4. Check the key in the ESP dashboard

    Open the API keys page (SendGrid: Settings > API Keys; Mailgun: Sending > Domain settings > Sending API keys; Postmark: Servers > API Tokens; SES: IAM access keys). See whether the key the site uses still exists and has send permission.

Test a SendGrid key from the command linebash
curl -i --request POST https://api.sendgrid.com/v3/mail/send \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"personalizations":[{"to":[{"email":"you@example.com"}]}],"from":{"email":"verified-sender@example.com"},"subject":"Key test","content":[{"type":"text/plain","value":"Test"}]}'

How to fix it

Replace the key everywhere it is used
  1. Create a new key

    In the ESP dashboard create a key with only the permission it needs (for SendGrid, Mail Send). Copy it immediately, as many providers show it once.

  2. List every place that uses the old key

    Check the website, any SMTP plugin, your CRM, checkout app, form tool, automation tools and staging sites.

  3. Paste the new key

    Update each place, using the platform instructions below.

  4. Revoke the old key only after it is replaced

    Once every system sends successfully, delete any leftover old keys.

  5. Recover missed leads

    Export form entries stored in your form plugin, CRM or database for the outage period and follow up manually.

Where to update the key
  1. Open your mail plugin

    In plugins such as WP Mail SMTP, Post SMTP or the ESP's own plugin, open the settings and paste the new key or token. Save.

  2. Check wp-config.php

    Some setups define the key as a constant there. Update it in that file instead of the plugin screen if so.

  3. Send a test

    Use the plugin's Email Test tool, then submit a real form.

How to confirm it's fixed

Confirmation checks
  • The ESP activity log shows your test message as accepted or delivered.
  • A real form submission produces the team notification in the inbox.
  • The customer auto-reply arrives, and is not in spam.
  • Order or booking confirmations arrive if you use them.
  • The error log shows no new 401 or 403 entries.
  • The lead appears in your CRM if it is connected.

How to prevent it happening again

Prevention habits
  • Keep a short record of which systems use which key.
  • Rotate keys on a schedule, and update the site in the same change.
  • Create one key per system so you can revoke one without breaking others.
  • Add the key to a shared secrets manager, not to personal notes.
  • Log send failures and alert on 401 and 403 responses.
  • Send a test lead after any security clean-up or staff offboarding.
Key handling

Before

  • One shared key used by many tools
  • Key rotated in the ESP only
  • Errors hidden behind a success page

After

  • One key per system, documented
  • Rotation and site update done together
  • Send errors logged and alerted

How FunnelGuard handles this

Questions people ask

Why did my website emails suddenly stop sending?

A common cause is that the API key your site uses was revoked, deleted or rotated at the email provider. The provider then returns a 401 or 403 error for every send. Check the provider's activity log and your site's error log to confirm.

How do I update my SendGrid or Mailgun API key on my website?

Create a new key in the provider dashboard, then paste it where the site stores it: an SMTP plugin, an environment variable, or a connected app. Send a test and check the provider log shows it accepted.

Why does my form say success but no email arrives?

Many forms show the thank-you page before the email is sent, and do not check the provider's response. If the ESP rejects the key, the visitor still sees success while the email is never sent.

Does rotating an API key break my emails?

Yes, if the site keeps using the old key. Rotation invalidates the old value, so every system using it must be updated at the same time. Replace the key first, test, then revoke the old one.

What does a 401 or 403 from an email API mean?

A 401 usually means the key is missing, wrong or revoked. A 403 usually means the key is valid but lacks permission, or the sender is not allowed. Both stop the email from being sent.

How can I find which tool still uses the old key?

Search your site settings, plugins, environment variables, CRM and automation tools. The ESP activity log and key page can also show which key last made a request, depending on the provider.

Can FunnelGuard tell me my API key was revoked?

Not directly. FunnelGuard detects that expected test emails are missing and alerts you with a likely cause, but it does not read your ESP account. You confirm the key problem using the ESP logs.

How do I recover leads lost while emails were failing?

Export submissions saved in your form plugin, CRM or database for the outage dates and contact those people. If the form did not store entries, check analytics events or server logs for submissions.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: Missing emails detected.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.