Message


POST /api/v0/messages

Submission of email through API.


NameDescriptionCondition

from

Email address for From header. If not present, default will be used.

Optional

to

Recipient email address. Use commas to separate multiple recipients.

Required

reply_to

Email address for recipient reply. Also used for return path for bounced email.

Optional

unsubscribe_link

Unsubscribe link is a link within your email campaign, often placed in the footer.

Optional (Recommended)

subject

Email subject.

Required

as_html

By default we use plain text as email content. However you may set as_html=1 for sending HTML content.

Required

content

Plain text or HTML content.

Required

headers

Additional mail header.

Optional


Example of JSON body to be prepared during email submission via API.

{
    "from": "Demo <demo@webimpian.com>",
    
    // Use comma for multiple recipient, limit up to 1,000 in single request
    "to": [
        "Name 1 <demo@purpose-1.io>",
        "Name 2 <demo@purpose-2.io>"
    ], 
    "reply_to": "support@customer.dot",
    "unsubscribe_link": "https://newsletter.mailniaga.com/unsubscribe/UClRDVU763NX75ohJhys7PIg",
    "subject": "Your Campaign Subject",
    "as_html": 1,
    "content": "<p>This is demo HTML.</p>"
}

Sending via command line using cURL.

curl -X POST https://api.mailniaga.mx/api/v0/messages \
  --header "Content-Type: application/json" \
  --header "X-API-Key: <API_Key>" \
  --data-raw '{
        "from": "Demo <demo@webimpian.com>",
        
        // Use comma for multiple recipient, limit up to 1,000 in single request
        "to": [
            "Name 1 <demo@purpose-1.io>",
            "Name 2 <demo@purpose-2.io>"
        ], 
        "reply_to": "support@customer.dot",
        "unsubscribe_link": "https://newsletter.mailniaga.com/unsubscribe/UClRDVU763NX75ohJhys7PIg",
        "subject": "Your Campaign Subject",
        "as_html": 1,
        "content": "<p>This is demo HTML.</p>"
    }'

JSON structured response.

{
    "error": false, 
    "status_code": 200,
    "message": "OK",
    "data":{
        "total_recipient": 2
    }
}

Last updated