Getting a MailChimp API Key
You Will Learn
Learn to get a MailChimp API key and know how it is used.
Let's create a MailChimp API key and make sense of it.
The first thing you need is a MailChimp account if you are going to use the MailChimp API. Once you an account you need to create an API key so you can connect to MailChimp securely.
Create a MailChimp API Key
Creating a MailChimp API key is easy. From your MailChimp account.
- Click your profile menu item. This is where your name and avatar is located. this will reveal a dropdown menu.
- In the drop-down menu click "Account".
- On your account page click the submenu item "Extras". Then, select from the revealed list "API keys".
- Scroll down a bit and click the button "Create a Key"
- Scroll down again and copy your new API key and save it to a safe place.
MailChimp API Key Scheme
The MailChimp API key is more than an API key. It also holds important information about what MailChimp server you need to use. In your API key, there will be a
- (dash) toward the end. Everything after that dash is your API servers location.
Your API key should look something like this: "453d7da1e6gh603e6c9e0fd9a4844a7b-us16". Based on this API key:
- Your server
- Your API Key is "453d7da1e6gh603e6c9e0fd9a4844a7b-us16" (keep the location data attached)
Using Your MailChimp API Key
To use your API key and connect to the MailChimp API you can use any tool that lets you customize and send HTTP requests. cURL or
curl, pronounced "see URL", is a common tool used to make an HTTP request in a development environment.
You can use
curl to connect to and authenticate a connection to the MailChimp API using your understanding of the MailChimp API key.
curl --request GET \ --url 'https://<location>.api.mailchimp.com/3.0/' \ --user 'anystring:<your_apikey>'
If you use the information from the example API key the
curl command could look like this.
curl --request GET \ --url 'https://us16.api.mailchimp.com/3.0/' \ --user 'key:453d7da1e6gh603e6c9e0fd9a4844a7b-us16'