Fix “API Request Error: 401 – API Key Invalid” in Mailchimp for WordPress (MC4WP)

Paste this error into Google and you’ll find a hundred guesses. Here’s the fast path that actually works for Mailchimp for WordPress (MC4WP): 401 means Mailchimp rejected your credentials—most often a revoked/wrong API key, a datacenter mismatch, or a key created by a user without sufficient permissions. Follow the steps below in order, and you’ll be connected in minutes.

MC4WP shows “API Request Error: 401 – API Key Invalid.” How do I fix this, step by step?

30‑Second Fix (works most of the time)

  1. Generate a fresh Mailchimp API key from an Admin user in your account.
  2. Copy the entire key (it ends with -usX) and paste it in WP Admin → MC4WP → Mailchimp, then Save.
  3. Click Renew Mailchimp lists on that screen to refresh cached data.
  4. Test your signup form again.

Why you’re seeing 401

401 Unauthorized is returned when the API key is invalid, revoked, or pointing at the wrong datacenter (the -usX suffix). MC4WP simply forwards your key to Mailchimp; if Mailchimp can’t authenticate it, you’ll get this exact error.

Step‑by‑step (bulletproof) fixes

1) Create a valid, Admin‑scoped API key

  1. In Mailchimp, go to Account → Extras → API keys and click Create A Key.
  2. Ensure the user creating the key is an Administrator. API keys inherit the creator’s permissions.
  3. Copy the key exactly. Format is like aaaaaaaaaaaaaaaaaaaaaaaaa-us17 (note the -us17 suffix).

Why this matters: Using a revoked key, a partial key (missing the suffix), or a key created by a limited‑permission user commonly triggers 401.

2) Paste the key into MC4WP correctly & refresh lists

  1. In WordPress, open MC4WP → Mailchimp, paste the key, and click Save.
  2. Click Renew Mailchimp lists to clear MC4WP’s cache and pull fresh audiences, fields, and interest groups.
  3. If you have multiple forms, open MC4WP → Forms and ensure each form is subscribed to the correct Audience (list).

3) Datacenter check (the -usX part)

Mailchimp’s base URL is determined by the datacenter in your key. If your environment forces a different API host, you’ll get 401. Verify with cURL (replace with your values):

DC=us17                      # from the end of your API key
KEY="xxxxxxxxxxxxxxxxxxxxxxx-us17"

# Expect HTTP/2 200 and JSON body. 401 means the key is invalid/revoked.
curl -i -u anystring:$KEY "https://$DC.api.mailchimp.com/3.0/"

If the request succeeds here but MC4WP still shows 401, a plugin/mu‑plugin may be overriding MC4WP’s requests. Temporarily disable other Mailchimp‑related plugins and test again.

4) Common gotchas (fix these and retest)

  • Whitespace/quotes: Remove leading/trailing spaces, smart quotes, or hidden characters when pasting the key.
  • Wrong account: Make sure the key belongs to the same Mailchimp account that holds your target Audience.
  • Revoked or expired key: If a teammate revoked it (Mailchimp marks it as disabled), create a new one.
  • Transactional vs Marketing: Use a Marketing API key (not Transactional/Mandrill) for MC4WP.

5) Still failing? Prove the exact cause

  1. Test with a brand‑new Admin key (don’t reuse old keys).
  2. Try another Admin user in the same account to generate the key.
  3. Confirm status from the API:
    # Should return account JSON if valid
    curl -s -u anystring:$KEY "https://$DC.api.mailchimp.com/3.0/" | head -c 200
  4. If cURL works but MC4WP doesn’t, enable debugging and re‑test:
    /* wp-config.php */
    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);

    Check wp-content/debug.log for Mailchimp/HTTP entries and share them with your host if needed.

Verification checklist

  • Fresh Admin‑created key pasted in MC4WP and saved.
  • Renew Mailchimp lists run without errors; the correct Audience appears.
  • Direct API call to https://usX.api.mailchimp.com/3.0/ returns 200 JSON with Basic Auth (anystring:API_KEY).
  • Signup form adds a test email to the expected Audience.

FAQ

Why does the key need “-usX”? That suffix tells Mailchimp which datacenter to use; pointing at the wrong datacenter causes 401.

MC4WP says “Connected” but forms fail. Refresh lists and re‑select your Audience in each form; also ensure the key was created by an Admin user.

Could a firewall or cURL version cause 401? Network blocks usually cause timeouts/403/5xx, not 401. A 401 specifically means invalid/revoked credentials or wrong datacenter.

Need human WordPress help?

WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!