Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Developer · Guide

How to Get Mailchimp API Key for WordPress (Step by Step)

How to Get Mailchimp API Key for WordPress (Step by Step)

Short answer

Log in to Mailchimp, click your profile icon and choose Profile. Open Extras, select API keys, click Create A Key, name it and generate it. Copy the key at once, since Mailchimp shows it only one time, then paste it into your WordPress plugin's Mailchimp settings.

Key takeaways

  • Create keys in Mailchimp under Profile > Extras > API keys.
  • Copy the full key, including the data center code after the dash.
  • Mailchimp shows the full key only once, so save it right away.
  • Some plugins, like Mailchimp for WooCommerce, use a sign-in flow instead.
  • Store keys for custom code in wp-config or an environment variable.
  • Use one key per site so you can revoke them separately.

How do you get a Mailchimp API key for WordPress?

Log in to Mailchimp, open your profile menu, go to Profile > Extras > API keys, click Create A Key, name it, generate it and copy the key right away into your WordPress plugin.

An API key lets a WordPress plugin talk to your Mailchimp account. It can add subscribers, read your audiences and apply tags without you exporting files by hand.

Many plugins need one, including Mailchimp for WordPress (MC4WP), some form plugins and custom code. A few plugins, such as the official WooCommerce integration, use a sign-in flow instead and never ask for a key.

This guide shows where to find the key, how to paste it into common plugins, and how to keep it safe.

What do you need before you create a key?

You need a Mailchimp account with enough access to manage account settings, plus admin access to the WordPress site where you will paste the key.

Check these first:

  • The right Mailchimp user level. Some user roles cannot see the API keys screen. Mailchimp's API key help page lists which levels can create keys.
  • An audience. Most plugins need at least one audience to connect to.
  • The plugin you will use. Install and activate it first so you know where the key goes.

If you have not chosen a plugin yet, our guide on adding Mailchimp to WordPress covers the main options.

How do you create the API key in Mailchimp?

From your profile menu, choose Profile, open the Extras dropdown, select API keys, then click Create A Key, give it a name and click Generate Key.

  1. Log in to your Mailchimp account.
  2. Click your profile icon and choose Profile.
  3. Open the Extras menu and select API keys.
  4. Click Create A Key.
  5. Enter a name, such as your site name plus the plugin name.
  6. Click Generate Key.
  7. Copy the key and store it somewhere safe.

Mailchimp's developer guide on generating your API key shows the same steps with screenshots.

Copy the key immediately. Mailchimp shows the full key only once. If you lose it, create a new key rather than trying to find the old one.

Save it in a password manager rather than a text file on your desktop or a note in your email. A password manager keeps it encrypted and lets you find it again if you rebuild the site later.

If you work with a team, record which person created each key and on what date. That small habit makes it much easier to clean up old keys a year from now.

What does a Mailchimp API key look like?

A Mailchimp API key is a long string of letters and numbers followed by a dash and a short data center code, such as us21, which tells plugins which server to use.

The part after the dash matters. Plugins read it to build the right API address for your account.

When pasting, copy the whole key, including the dash and data center code. Extra spaces at the start or end are a common reason a key is rejected.

Where do you paste the key in WordPress plugins?

Open the plugin's Mailchimp settings screen, paste the key into the API key field, save, and confirm the plugin shows a connected status and lists your audiences.

Each plugin puts the field in a slightly different place:

PluginWhere the key usually goesConnection method
Mailchimp for WordPress (MC4WP)The plugin's Mailchimp settings screenAPI key
Form plugin Mailchimp add-onsIntegrations or marketing settingsAPI key
Mailchimp for WooCommercePlugin setup wizardSign in to Mailchimp
Custom codewp-config constant or environment variableAPI key

For MC4WP, the free Mailchimp for WordPress plugin asks for the key on its main settings screen. After saving, it shows your audiences so you can pick one for each form.

If you use WPForms, our guide on connecting WPForms to Mailchimp walks through that add-on.

How do you know the connection works?

After saving the key, the plugin should show a connected or valid status and list your Mailchimp audiences; then submit a test sign-up and check it appears in Mailchimp.

A quick test:

  1. Save the key in the plugin.
  2. Confirm your audience names appear.
  3. Add a sign-up form to a test page.
  4. Submit a test email you control.
  5. Look for the contact in your Mailchimp audience.

If double opt-in is on, the contact appears as pending until you confirm the email. That is normal.

Also check that the fields map correctly. If your form collects a first name, confirm it lands in the right merge field in Mailchimp rather than being dropped.

If your plugin supports tags or groups, submit one more test with those options set. Tags are often how welcome emails and automations decide who gets what, so a missing tag can look like a broken automation later.

Why is your Mailchimp API key not working?

A key usually fails because it was copied with spaces, it was disabled or deleted, it belongs to a different account, or your server cannot reach Mailchimp.

Work through these checks:

  • Copy errors. Paste the key into a plain text editor to check for spaces or missing characters.
  • Disabled key. In Mailchimp, check the API keys screen and confirm the key is active.
  • Wrong account. If you manage several Mailchimp accounts, make sure the key came from the right one.
  • Blocked requests. Some hosts or security plugins block outgoing connections.
  • Old plugin version. Update the plugin and try again.

Our guide on the Mailchimp WordPress plugin not working covers more connection problems.

How do you use the key safely in custom code?

Store the key in a constant in wp-config or an environment variable, never in theme files or public code, and load it from there when your code calls the Mailchimp API.

An API key gives full access to your Mailchimp account. Anyone who has it can read and change your audience.

A common approach is to add a constant to wp-config:

define( 'MY_MAILCHIMP_API_KEY', 'your-key-here' );

Your code then reads that constant. The wp-config file sits outside your theme and is not served to visitors. The wp-config documentation explains how the file works.

On hosts that support environment variables, you can store the key there and read it with PHP's getenv function. That keeps the key out of files you might copy or share.

Never put the key in JavaScript that runs in the browser. Browser code is visible to every visitor.

Should you create a separate key for each site or plugin?

Yes; one key per site or tool lets you revoke a single key if something goes wrong without breaking every other connection on your account.

Give each key a clear name, such as the site and plugin. Then you can tell at a glance which key belongs where.

Separate keys also help when you troubleshoot. If one site starts making odd changes to your audience, you can disable its key and watch whether the changes stop.

The extra keys cost nothing, and Mailchimp lets you keep several active at once. The only work is naming them clearly when you create them.

If a site is sold, retired or hacked, disable only that site's key. The rest of your integrations keep working.

How do you revoke or replace a Mailchimp API key?

Go back to Profile > Extras > API keys in Mailchimp, disable or delete the old key, create a new one, and paste the new key into your plugin.

Replace a key when:

  • A developer or agency who had access no longer works with you.
  • The key was shared in an email, chat or support ticket.
  • You suspect your site was compromised.

After replacing it, test a sign-up again. Plugins using the old key will stop syncing until you update them.

What other API keys might your WordPress site need?

Many WordPress tools use API keys, and the same rules apply: create them in the service's dashboard, store them safely, and give each site its own key.

If you also run a store, our guide on getting a WooCommerce API key explains how WooCommerce creates keys for outside services.

For custom integrations, the WordPress REST API guide explains how WordPress itself handles requests from other apps.

Frequently asked questions

Is a Mailchimp API key free?

Yes. Creating an API key does not cost anything, and you can generate keys on free and paid Mailchimp plans. What you can do through the API still depends on your plan's features and contact limits.

Can I see my Mailchimp API key again after creating it?

No. Mailchimp shows the full key only when you generate it. If you did not save it, create a new key, paste it into your plugin, and disable the old one so unused keys do not linger on your account.

Why can't I find the API keys option in Mailchimp?

Your user level may not have permission to manage account settings. Ask the account owner or an admin to create the key, or to raise your access level. Also check you are in the right account if you belong to several.

Is it safe to share my Mailchimp API key with a developer?

Only if you trust them, since the key gives full account access. A safer approach is to create a separate key just for that developer or project, then disable it when the work is finished.

What is the data center code in the key?

It is the short code after the dash, such as us21. It tells plugins which Mailchimp server holds your account. Always copy it with the rest of the key, or the plugin will not be able to connect.

Sources

  1. About API Keys Mailchimp
  2. Generate your API key Mailchimp Developer
  3. MC4WP: Mailchimp for WordPress WordPress.org
  4. wp-config.php WordPress Developer Resources
  5. getenv PHP Manual

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.