Mailchimp API 3.0 Best Practices
With any API, it is important that your integrations are fault-tolerant and smart with their use of resources. To make sure your integration with the Mailchimp API is as reliable as possible, review the best practices outlined in this guide.
When you use any API, keep in mind that errors and exceptions (e.g., server connection problems or outages) are rare, but they happen. To make sure that your integration is as reliable as it can be, you should always watch for errors and exceptions. If an API call returns an error, log the call in as much detail as you can, including what you sent along with the entire error response and headers. If you need to contact support, this information can speed up the help process.
We also recommend that you sync your calls to the Mailchimp API as a background job instead of making your contacts wait for a response. For custom signup forms, most contacts want to know if their attempt to subscribe to a list/audience worked or not.
Use Specific Requests
Sometimes, the API returns values that are large and slow to calculate. After you know what data you need, use our partial response capabilities to request only what is essential to you. Typically, fewer requests generate quicker responses.
Another way to reduce response time is to make fewer calls. Calls that are too frequent can slow your application and may also receive unwanted attention from the Mailchimp operations team. For example, you probably do not need to query campaign statistics every hour for several days because most campaigns receive the bulk of their open and click activity in the first 24 hours. To reduce calls further, we recommend that you sync only new data and cache data that is unlikely to change.
We recommend OAuth2 for platform integrations.
We recommend that you cache frequently-used values that do not change often. For simple subscriptions, cache required values for resources like Lists, Interests, and Merge Fields, and offer a setup area where users can change those values.
To avoid the possibility of abuse complaints, balance your calls with your list/audience size. For example, when you make hundreds of calls per second to get details for 200 contacts, it will look like abuse to our operations team. Learn more about our connection limits.
If you create dozens of new campaigns a day, your email marketing strategy may be better suited for Mandrill’s powerful delivery service. The Mandrill API is ideal for sending data-driven transactional emails, including targeted e-commerce messages and personalized one-to-one emails.