Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Mailchimp API SnippetsNew to Visual Studio Code? Get it now.
Mailchimp API Snippets

Mailchimp API Snippets

Chimpmatic

| (0) | Free
Mailchimp Marketing API v3 code snippets for PHP, JavaScript, and Python. Ready-to-use REST API calls with authentication, error handling, and tabbed placeholders.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Mailchimp API Snippets

Mailchimp Marketing API v3 code snippets for VS Code. Ready-to-use REST API calls for PHP, JavaScript, and Python with authentication, error handling, and tabbed placeholders.

Quick Start

  1. Type mc-api-init to set up the API client
  2. Type mc-api- to see all available snippets
  3. Tab through placeholders to customize

All snippets use the helper function from mc-api-init. Always insert mc-api-init first, then add individual API call snippets inside the main function.

Available Snippets

Type mc-api- in any PHP, JavaScript, TypeScript, or Python file.

Setup & Connection

Prefix Description
mc-api-init Initialize API client with key and datacenter
mc-api-ping Verify API connection

Audiences & Members

Prefix Description
mc-api-lists Get all audiences
mc-api-list-members List members of an audience
mc-api-get-member Get a single member by email
mc-api-subscribe Add/subscribe a member
mc-api-update-member Update member info
mc-api-upsert Create or update a member (PUT)
mc-api-unsubscribe Unsubscribe a member
mc-api-delete-member Permanently delete a member (GDPR)
mc-api-member-tags Add or remove member tags
mc-api-merge-fields List audience merge fields
mc-api-segments List audience segments
mc-api-create-segment Create a segment

Campaigns

Prefix Description
mc-api-campaigns List all campaigns
mc-api-create-campaign Create a campaign
mc-api-campaign-content Set campaign HTML content
mc-api-send-campaign Send a campaign
mc-api-send-test Send a test email
mc-api-schedule-campaign Schedule a campaign
mc-api-reports Get campaign reports

Templates & Automations

Prefix Description
mc-api-templates List templates
mc-api-create-template Create a template
mc-api-automations List automations
mc-api-batch Start a batch operation

Language Support

Each snippet generates idiomatic code for its language:

Language HTTP Client Auth Method
PHP cURL Basic Auth
JavaScript / TypeScript fetch + Buffer Basic Auth (base64)
Python requests Auth tuple

How It Works

Every snippet starts with mc-api-init which creates a reusable request helper function. All other snippets call this function — just tab through the placeholders:

  1. API Key — your Mailchimp API key (includes datacenter suffix like -us1)
  2. List/Campaign IDs — paste from your Mailchimp dashboard
  3. Email addresses, names, content — customize per call

Related Extensions

  • Chimpmatic — Mailchimp Email Templates — IntelliSense for Mailchimp merge tags + 25 responsive email template snippets

Learn More

  • Mailchimp API Reference
  • How to Get Your Mailchimp API Key
  • Mailchimp Audience Fields and Merge Tags
  • Chimpmatic Documentation

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft