Fixing Mailgun 'Unauthorized' Error in GPTWeb

1 views
the 'Email test failed: Unauthorized' error almost always points to one of a few specific Mailgun configuration issues. Let's work through the most common causes so you can get this resolved quickly.

Most Common Causes & Fixes

  • **Wrong API Key Type** — Mailgun has two key types: a Private API Key and a Public Validation Key. GPTWeb requires your **Private API Key** (starts with `key-`). Double-check you haven't pasted the public key by mistake.
  • **API Key Copied Incorrectly** — Even a single extra space before or after the key will cause an Unauthorized error. Try copying the key fresh directly from Mailgun and paste it carefully.
  • **Wrong Region Selected** — If your Mailgun account is on the **EU region**, you must select EU in GPTWeb's email settings. Selecting US for an EU account (or vice versa) will always return Unauthorized.
  • **Domain Mismatch** — Ensure the domain entered in GPTWeb exactly matches the sending domain configured in your Mailgun account (e.g., `mg.yourdomain.com` not `yourdomain.com`).
  • **Mailgun Account Suspended or Unverified** — Log into Mailgun and confirm your account is active and your sending domain is fully verified with SPF and DKIM records.
  • **Restricted API Key** — If you created a restricted API key in Mailgun, ensure it has **Send Messages** and **View Domain** permissions enabled.
Wrong API Key
Top Cause
Region Mismatch
2nd Most Common
~95%
Fix Success Rate
< 5 min
Avg Resolution Time
Quick Checklist to Resolve: 1. Go to your Mailgun Dashboard → API Keys
  • Copy your Private API Key fresh (starts with key-)

  • In GPTWeb Admin → Settings → Email Configuration

  • Clear the existing API key field and paste the new one

  • Confirm your Region (US or EU) matches your Mailgun account

  • Confirm your Mailgun Domain matches exactly

  • Click Save & Test again If the error persists after confirming all of the above, please open a [](gptweb://modal/contact) and include the Mailgun domain and region you're using so the team can investigate further.
  • GPTWeb is the future of engagement, websites, and marketing automation combined — built for the AI era, built for now.

    Need more help?

    Our AI assistant can answer any question instantly.

    Continue This Conversation