> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://mailchimp.com/developer/transactional/api/messages/send-mc-template/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mailchimp.com/_mcp/server.
# Send using Mailchimp template
POST https://mandrillapp.com/api/1.4/messages/send-mc-template
Content-Type: application/json
Send a new transactional message through Mandrill using a Mailchimp Transactional template.
Reference: https://mailchimp.com/developer/transactional/api/messages/send-mc-template
## Request
### Body (application/json)
This endpoint expects a MessagesSendMcTemplateRequest.
- `key` (string, required) — A valid Mandrill API key
- `mc_template_id` (integer, required) — the Mailchimp Transactional template ID from the user's account
- `message` (MessagesRequestComponent, required) — the other information on the message to send - same as /messages/send
- `mc_template_version` (enum, optional) — which version of the template to use - "draft" for draft content or "published" for published content. Defaults to "published". Note: requesting "published" when the template has not been published will return a 404 error.
- Allowed values: `draft`, `published`
- `async` (boolean, optional, nullable) — enable a background sending mode that is optimized for bulk sending. In async mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async.
- `ip_pool` (string, optional) — the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead.
- `send_at` (string, optional) — when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately; for future dates, you're limited to one year from the date of scheduling.
## Response
### 200
Success
- `any`
## Errors
### 401 Unauthorized Error
Invalid or missing API key.
- `status` (string, required) — Status of the response, typically "error"
- `code` (enum, required) — Numeric error code
- Allowed values: `401`
- `name` (enum, required) — Machine-friendly error name
- Allowed values: `Invalid_Key`
- `message` (string, required) — Human-readable error message
### 402 Payment Required Error
A paid plan is required to use this feature.
- `status` (string, required) — Status of the response, typically "error"
- `code` (enum, required) — Numeric error code
- Allowed values: `10`
- `name` (enum, required) — Machine-friendly error name
- Allowed values: `PaymentRequired`
- `message` (string, required) — Human-readable error message
### 404 Not Found Error
Template or subaccount not found
- `Messages/send-mc-templateRequestNotFoundError`
### 500 Internal Server Error
An unexpected internal server error occurred.
- `status` (string, required) — Status of the response, typically "error"
- `code` (integer, required) — Numeric error code
- `name` (string, required) — Machine-friendly error name
- `message` (string, required) — Human-readable error message
## Types
### MessagesRequestComponent
Mandrill message payload for transactional email
- `html` (string, optional, nullable) — the full HTML content to be sent
- `text` (string, optional, nullable) — optional full text content to be sent
- `subject` (string, optional, nullable) — the message subject
- `from_email` (string, optional, nullable) — the sender email address
- `from_name` (string, optional, nullable) — optional from name to be used
- `to` (list of MessagesRequestComponentToItems, optional) — an array of recipient information.
- `headers` (MessagesRequestComponentHeaders, optional) — optional extra headers to add to the message (most headers are allowed)
- `important` (boolean, optional, nullable) — whether or not this message is important, and should be delivered ahead of non-important messages
- `track_opens` (boolean, optional, nullable) — whether or not to turn on open tracking for the message
- `track_clicks` (boolean, optional, nullable) — whether or not to turn on click tracking for the message
- `auto_text` (boolean, optional, nullable) — whether or not to automatically generate a text part for messages that are not given text
- `auto_html` (boolean, optional, nullable) — whether or not to automatically generate an HTML part for messages that are not given HTML
- `inline_css` (boolean, optional, nullable) — whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size
- `url_strip_qs` (boolean, optional, nullable) — whether or not to strip the query string from URLs when aggregating tracked URL data
- `preserve_recipients` (boolean, optional, nullable) — whether or not to expose all recipients in to "To" header for each email
- `view_content_link` (boolean, optional, nullable) — set to false to remove content logging for sensitive emails
- `bcc_address` (string, optional, nullable) — an optional address to receive an exact copy of each recipient's email
- `tracking_domain` (string, optional, nullable) — a custom domain to use for tracking opens and clicks instead of mandrillapp.com
- `signing_domain` (string, optional, nullable) — a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients)
- `return_path_domain` (string, optional, nullable) — a custom domain to use for the messages's return-path
- `merge` (boolean, optional, nullable) — whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars or global_merge_vars are provided.
- `merge_language` (enum, optional, default: mailchimp) — the merge tag language to use when evaluating merge tags, either mailchimp or handlebars Possible values: "mailchimp" or "handlebars".
- Allowed values: `mailchimp`, `handlebars`
- `global_merge_vars` (list of MergeVar, optional) — global merge variables to use for all recipients. You can override these per recipient.
- `merge_vars` (list of MessagesRequestComponentMergeVarsItems, optional) — per-recipient merge variables, which override global merge variables with the same name.
- `tags` (list of string, optional) — an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.
- `subaccount` (string, optional, nullable) — the unique id of a subaccount for this message - must already exist or will fail with an error
- `google_analytics_domains` (list of string, optional) — an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
- `google_analytics_campaign` (MessagesRequestComponentGoogleAnalyticsCampaign, optional) — optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
- `metadata` (MessagesRequestComponentMetadata, optional) — metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
- `recipient_metadata` (list of MessagesRequestComponentRecipientMetadataItems, optional) — Per-recipient metadata that will override the global values specified in the metadata parameter.
- `attachments` (list of MessagesRequestComponentAttachmentsItems, optional) — an array of supported attachments to add to the message
- `images` (list of MessagesRequestComponentImagesItems, optional) — an array of embedded images to add to the message
### Error
Standard error payload returned on API errors.
- `status` (string, required) — Status of the response, typically "error"
- `code` (integer, required) — Numeric error code
- `name` (string, required) — Machine-friendly error name
- `message` (string, required) — Human-readable error message
### MessagesRequestComponentToItems
- `email` (string, optional) — The email address of the recipient
- `name` (string, optional, nullable) — The optional display name to use for the recipient
- `type` (enum, optional, default: to) — the header type to use for the recipient, defaults to "to" if not provided Possible values: "to", "cc", or "bcc".
- Allowed values: `to`, `cc`, `bcc`
### MessagesRequestComponentHeaders
optional extra headers to add to the message (most headers are allowed)
### MergeVar
Merge variable for template content injection
- `name` (string, optional) — Merge variable name (case-insensitive, may not start with _)
- `content` (string, optional) — Content value for the merge variable
### MessagesRequestComponentMergeVarsItems
- `rcpt` (string, optional) — Email address of the recipient
- `vars` (list of MergeVar, optional) — Recipient-specific merge variables
### MessagesRequestComponentGoogleAnalyticsCampaign
optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
### MessagesRequestComponentMetadata
metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
### MessagesRequestComponentRecipientMetadataItems
- `rcpt` (string, optional)
- `values` (MessagesRequestComponentRecipientMetadataItemsValues, optional)
### MessagesRequestComponentAttachmentsItems
- `type` (string, optional) — the MIME type of the attachment
- `name` (string, optional) — the file name of the attachment
- `content` (string, optional) — the content of the attachment as a base64-encoded string
### MessagesRequestComponentImagesItems
- `type` (string, optional) — the MIME type of the image - must start with "image/"
- `name` (string, optional) — the content ID of the image - used \
to reference the image in your HTML content
- `content` (string, optional) — the content of the image as a base64-encoded string
### MessagesRequestComponentRecipientMetadataItemsValues
## Examples
**Request**
```json
{
"key": "ONzNrsmbtNXoIKyfPmjnig",
"mc_template_id": 12345
}
```
**Response**
```json
[
{
"_id": "string",
"email": "recipient.email@example.com",
"queued_reason": "attachments",
"reject_reason": "hard-bounce",
"status": "sent"
}
]
```
**SDK Code**
```python
import requests
url = "https://mandrillapp.com/api/1.4/messages/send-mc-template"
payload = {
"key": "ONzNrsmbtNXoIKyfPmjnig",
"mc_template_id": 12345
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
```
```javascript
const url = 'https://mandrillapp.com/api/1.4/messages/send-mc-template';
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: '{"key":"ONzNrsmbtNXoIKyfPmjnig","mc_template_id":12345}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mandrillapp.com/api/1.4/messages/send-mc-template"
payload := strings.NewReader("{\n \"key\": \"ONzNrsmbtNXoIKyfPmjnig\",\n \"mc_template_id\": 12345\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```ruby
require 'uri'
require 'net/http'
url = URI("https://mandrillapp.com/api/1.4/messages/send-mc-template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"ONzNrsmbtNXoIKyfPmjnig\",\n \"mc_template_id\": 12345\n}"
response = http.request(request)
puts response.read_body
```
```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse response = Unirest.post("https://mandrillapp.com/api/1.4/messages/send-mc-template")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"ONzNrsmbtNXoIKyfPmjnig\",\n \"mc_template_id\": 12345\n}")
.asString();
```
```php
request('POST', 'https://mandrillapp.com/api/1.4/messages/send-mc-template', [
'body' => '{
"key": "ONzNrsmbtNXoIKyfPmjnig",
"mc_template_id": 12345
}',
'headers' => [
'Content-Type' => 'application/json',
],
]);
echo $response->getBody();
```
```csharp
using RestSharp;
var client = new RestClient("https://mandrillapp.com/api/1.4/messages/send-mc-template");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"key\": \"ONzNrsmbtNXoIKyfPmjnig\",\n \"mc_template_id\": 12345\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = ["Content-Type": "application/json"]
let parameters = [
"key": "ONzNrsmbtNXoIKyfPmjnig",
"mc_template_id": 12345
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://mandrillapp.com/api/1.4/messages/send-mc-template")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```
> Find all the Mailchimp API documentation and tools developers need to send marketing and transactional emails.