---
title: "Mailercloud Email API - Help Guide"
description: "Mailercloud provides an easy way to send emails programmatically using our Email API. This guide will help you understand how to use it effectively."
url: https://help.mailercloud.com/en/articles/155-mailercloud-email-api-help-guide
collection: "API Platform"
updated: 2026-10-29
language: en
---

# Mailercloud Email API - Help Guide

Mailercloud provides an easy way to send emails programmatically using our Email API. This guide will help you understand how to use it effectively.

## **What is Mailercloud Email API?**

The Mailercloud Email API allows you to send emails automatically from your application or website. You can define the sender, recipients, subject, email content, and even add attachments. This is useful for sending automated emails like order confirmations, password resets, or marketing emails.

## **How to Use the Email API?**

To use this API, you need an API key for authentication.

### Endpoint

```javascript
POST https://email-api.mailercloud.com/email
```

### Headers

```javascript
Content-Type: application/json
Authorization: YOUR_API_KEY 
```

### Normal Request Body

```javascript
{
    "email": {
        "from": "from@example.com",
        "fromName": "John Doe",
        "replyTo": [
            "replyone@example.com",
            "replytwo@example.com"
        ],
        "subject": "email subject",
        "text": "text body",
        "html": "html body",
        "recipients": {
            "to": [{
                "name": "Recipient1",
                "email": "abc12345"
            }, {
                "name": "Recipient2",
                "email": "abc@example.com"
            }],
            "cc": [
                "recipient_cc1@example.com",
                "recipient_cc2@example.com"
            ],
            "bcc": [
                "recipient_bcc1@example.com",
                "recipient_bcc2@example.com"
            ]
        },
        "attachments": [{
            "name": "Attachment1",
            "url": "https://link/to/attachment/1"
        },{
            "name": "Attachment2",
            "url": "http://link/to/attachment/2"
        }]
    },
    "metadata": {
        "campaignType": "PROMOTIONAL", //Only allow TRANSACTIONAL or PROMOTIONAL
        "timestamp": "2018-01-25T10:24:16+0000",
        "messageId": "your-message-id", // optional; generated by the server if omitted
        "custom" : {
            "key1" : "val1",
            "key2" : "val2"
        }
    },
     "version": "1.0" //required
}

```

### AMP Request Body

```javascript
{
    "email": {
        "from": "from@example.com",
        "fromName": "John Doe",
        "replyTo": [
            "replyone@example.com",
            "replytwo@example.com"
        ],
        "subject": "email subject",
        "text": "text body",
        "html": "html body",
        "amp_html" : "amp_body",
        "recipients": {
            "to": [{
                "name": "Recipient1",
                "email": "abc12345"
            }, {
                "name": "Recipient2",
                "email": "abc@example.com"
            }],
            "cc": [
                "recipient_cc1@example.com",
                "recipient_cc2@example.com"
            ],
            "bcc": [
                "recipient_bcc1@example.com",
                "recipient_bcc2@example.com"
            ]
        },
        "attachments": [{
            "name": "Attachment1",
            "url": "https://link/to/attachment/1"
        },{
            "name": "Attachment2",
            "url": "http://link/to/attachment/2"
        }]
    },
    "metadata": {
        "campaignType": "PROMOTIONAL",  //Only allow TRANSACTIONAL or PROMOTIONAL
        "timestamp": "2018-01-25T10:24:16+0000",
        "messageId": "your-message-id", // optional; generated by the server if omitted
        "custom" : {
            "key1" : "val1",
            "key2" : "val2"
        }
    },
     "version": "2.0" // required
}
```

## **What Information is Required?**

<table style="min-width: 75px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(33, 37, 41);"><strong>Parameter</strong></span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(33, 37, 41);"><strong>Type</strong></span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(33, 37, 41);"><strong>Description</strong></span></p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(1, 79, 134);">email.from</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">String</p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Sender’s email address</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(1, 79, 134);">email.fromName</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">String</p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Sender’s name</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(1, 79, 134);">email.replyTo</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Array</p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Reply-to email addresses</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(1, 79, 134);">email.subject</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">String</p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Email subject</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(1, 79, 134);">email.text</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">String</p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Plain text version of the email. Optional: if you leave it out and send html, a plain-text version is generated from the HTML (see Plain-text version below).</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(1, 79, 134);">email.html</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">String</p></td><td colspan="1" rowspan="1"><p style="text-align: left;">HTML version of the email</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(1, 79, 134);">email.recipients</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Object</p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Contains recipient information (To, CC, BCC)</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: rgb(1, 79, 134);">email.attachments</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Array</p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Attach files to your email</p></td></tr></tbody></table>

## **Plain-text version**

Every message is sent with both a plain-text part and your HTML (multipart/alternative), so it reads well in every mail client.

-   If you send email.text, it is used exactly as you sent it.
    
-   If you send only email.html, the plain-text part is generated from it: headings and paragraphs become lines, list items become bullets, and links keep their address as "Link text (https://…)". HTML with no readable text, such as an image-only email, is sent as HTML only.
    
-   To send an HTML-only message as HTML only, set metadata.custom.auto\_text to false. Any email.text you include is still sent.
    
-   Over SMTP relay, the same control is the mld-track-auto-text header (false to turn generation off).
    

In Transactional → Activity, open a message to see the plain-text part that was actually sent (yours or the generated one) under Plain text, and the complete message as delivered under Raw source. For a message sent to several recipients, each recipient’s row shows that recipient’s own content and raw source.

### Response

### Successful Response

When the email is sent successfully, the API returns:

```javascript
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": "SUCCESS",
    "statusCode": 1000,
    "message": "NA"
}
```

### Error Responses

### Message Cannot Be Sent

```javascript
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": "ERROR",
    "statusCode": 9002,
    "message": "Daily email sending quota is over."
}
```

### Payload Not Acceptable

```javascript
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "status": "ERROR",
    "statusCode": 9022,
    "message": "Unsupported version",
    "supportedVersion": "1.0"
}
```

## **Status Codes and Their Meaning**

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #212529;"><strong>Status Code</strong></span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #212529;"><strong>Meaning</strong></span></p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">1000</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Success</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9001</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Throttling error</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9002</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Message sending quota exceeded</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9003</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Authentication failure</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9004</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Recipient address not specified</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9005</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">From field missing</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9006</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Soft bounce (temporarily deferred)</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9007</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Hard bounce</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9008</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Email reported as spam</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9009</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Email unsubscribed</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9010</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Email in suppression list</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9011</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Sender address not verified</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9012</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">ESP rejected message</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9013</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Request to ESP expired</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9014</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">ESP unavailable</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9015</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">IP not whitelisted with ESP</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9016</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Subject field empty</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9017</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Invalid sender address</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9018</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Invalid email address</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9019</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Recipient's mailbox is full</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9020</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Error processing email at Private ESP</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9021</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Mailbox was not found on email server</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9022</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Unsupported or unknown version</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9024</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Authorization failure</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9452</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Message overloading</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9512</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Host email server not found</p></td></tr><tr><td colspan="1" rowspan="1"><p style="text-align: left;"><span style="color: #014f86;">9999</span></p></td><td colspan="1" rowspan="1"><p style="text-align: left;">Unknown error occurred</p></td></tr></tbody></table>

## Optional Fields

-   Custom headers — email.headers, for example List-Unsubscribe or X-Order-Reference
    
-   Inbox tracking — metadata.custom.inbox\_tracking with metadata.custom.campaign\_id
    
-   Tags — metadata.custom.tags, up to 10, for filtering messages in the Activity list
    
-   Content storage — metadata.custom.store\_content: false for sensitive emails such as OTPs
    
-   Plain-text generation — metadata.custom.auto\_text: false to send an HTML-only message without a generated plain-text part (see Plain-text version above)
    
-   Duplicate protection — reusing a metadata.messageId within 24 hours does not send again and still returns success, so a timed-out request is safe to retry. The message ID is shown in the Activity list.
    
-   Tracking — opens are tracked when your sending domain has a tracking domain configured. Click tracking is not available.
    

For the full field reference, [see](https://apidoc.mailercloud.com/api-reference/email/send-email) the Send Email API documentation.
