NAV
shell ruby python javascript php

Mailatmars Transactional API

Transactional API plateform gives ability to send email throught your app in easy way.transactional

We give more flexibility for content that you send throught Transactional API. you can send text that define at a api request time and also send template from mailatmars template library.

for get Access Token Please Go to dev.mailatmars.com and generate sending API token and use to send email request.

Transactional API

Transactional API serve you send email throught one request. and in below reference we define 5+ programming language Use case code that helps you to build your app easily.

Send Define Text Email

Using this endpoint you can send text email that text you define at request time.Transactional

import requests

url = "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/txt/email/ravigorasiya65@gmail.com"

payload="{\n    \"collection_id\":\"62be6ca2d7c29\",\n  \"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n  \"preview\":\"We are from mailatmars that help you in transactional API\",\n  \"content\":\"Hi, we are from mailatmars that help in your<br> bussiness tranasactional API support thank \"\n}"
headers = {
  'Authorization': 'Bearer 4en8nafhg9l601ed7fchh9dh',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


require "uri"
require "net/http"

url = URI("https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/txt/email/ravigorasiya65@gmail.com")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer 4en8nafhg9l601ed7fchh9dh"
request["Content-Type"] = "application/json"
request.body = "{\n    \"collection_id\":\"62be6ca2d7c29\",\n  \"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n  \"preview\":\"We are from mailatmars that help you in transactional API\",\n  \"content\":\"Hi, we are from mailatmars that help in your<br> bussiness tranasactional API support thank \"\n}"

response = https.request(request)
puts response.read_body


var settings = {
  "url": "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/txt/email/ravigorasiya65@gmail.com",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer 4en8nafhg9l601ed7fchh9dh",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({"collection_id":"62be6ca2d7c29","subject":"Hi, This Is test email from mailatmars transactional API","preview":"We are from mailatmars that help you in transactional API","content":"Hi, we are from mailatmars that help in your<br> bussiness tranasactional API support thank "}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
curl --location --request POST 'https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/txt/email/ravigorasiya65@gmail.com' \
--header 'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh' \
--header 'Content-Type: application/json' \
--data-raw '{
    "collection_id":"62be6ca2d7c29",
  "subject":"Hi, This Is test email from mailatmars transactional API",
  "preview":"We are from mailatmars that help you in transactional API",
  "content":"Hi, we are from mailatmars that help in your<br> bussiness tranasactional API support thank "
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mailatmars.com/send/906549565%5Ec2Fua2V0X3JhdmlfdGVzdA==/txt/email/ravigorasiya65@gmail.com',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "collection_id":"62be6ca2d7c29",
  "subject":"Hi, This Is test email from mailatmars transactional API",
  "preview":"We are from mailatmars that help you in transactional API",
  "content":"Hi, we are from mailatmars that help in your<br> bussiness tranasactional API support thank "
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


Response

[
    {
        "email": "ravigorasiya65@gmail.com",
        "email_status": {
            "status": 1,
            "suc_code": 501,
            "message": {
                "con_id": null,
                "list_id": "458642694^bmV3",
                "content_data": "text"
            },
            "help_link": ""
        }
    }
]

Body Content

{
    "collection_id":"62be6ca2d7c29",
  "subject":"Hi, This Is test email from mailatmars transactional API",
  "preview":"We are from mailatmars that help you in transactional API",
  "content":"Hi, we are from mailatmars that help in your<br> bussiness tranasactional API support thank "
}

This Endpoint Use for getting all Contact List That present in mailatmars account.

Request Information

Category Value
Request Type POST
URL https://api.mailatmars.com/send/:lst_id/txt/email/:email_add

Header Information

Parameters Value
Berear Token Access Token From Console

URL Parameter

Parameter Value Information
lst_id id of list that contain this email How To get list id
email_add email address that you send requested email from contact list

Body Content

Key Value Information
to-name name that you set in sender name of reciever
collection_id Collection Id generate from Mailatmars Cosole how to get collecton id
subject subject of email enter your subject for this mail
preview Preview text of sending email
content content content of email that you send

Response Field

Field Explain
email recipient email address
email_status Sending email status
status status of email sending if 1 then successfully sended
message message of error if accur

Send Using Template

Using this endpoint you can send text email that template string you define at request time.

import requests

url = "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/email/ravigorasiya65@gmail.com"

payload="{\n    \"to-name\":\"ravigorasiya\",\n    \"collection_id\":\"62be6ca2d7c29\",\n  \"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n  \"preview\":\"We are from mailatmars that help you in transactional API\",\n  \"content\":\"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0=\"\n}"
headers = {
  'Authorization': 'Bearer 4en8nafhg9l601ed7fchh9dh',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


require "uri"
require "net/http"

url = URI("https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/email/ravigorasiya65@gmail.com")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer 4en8nafhg9l601ed7fchh9dh"
request["Content-Type"] = "application/json"
request.body = "{\n    \"to-name\":\"ravigorasiya\",\n    \"collection_id\":\"62be6ca2d7c29\",\n  \"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n  \"preview\":\"We are from mailatmars that help you in transactional API\",\n  \"content\":\"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0=\"\n}"

response = https.request(request)
puts response.read_body


var settings = {
  "url": "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/email/ravigorasiya65@gmail.com",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer 4en8nafhg9l601ed7fchh9dh",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({"to-name":"ravigorasiya","collection_id":"62be6ca2d7c29","subject":"Hi, This Is test email from mailatmars transactional API","preview":"We are from mailatmars that help you in transactional API","content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
curl --location --request POST 'https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/email/ravigorasiya65@gmail.com' \
--header 'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh' \
--header 'Content-Type: application/json' \
--data-raw '{
    "to-name":"ravigorasiya",
    "collection_id":"62be6ca2d7c29",
  "subject":"Hi, This Is test email from mailatmars transactional API",
  "preview":"We are from mailatmars that help you in transactional API",
  "content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mailatmars.com/send/906549565%5Ec2Fua2V0X3JhdmlfdGVzdA==/template/email/ravigorasiya65@gmail.com',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "to-name":"ravigorasiya",
    "collection_id":"62be6ca2d7c29",
  "subject":"Hi, This Is test email from mailatmars transactional API",
  "preview":"We are from mailatmars that help you in transactional API",
  "content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


Response

[
    {
        "email": "ravigorasiya65@gmail.com",
        "email_status": {
            "status": 1,
            "suc_code": 501,
            "message": {
                "con_id": null,
                "list_id": "458642694^bmV3",
                "content_data": "MTQxNDYzMTE4XjE2MzQwMjA3ODcjMTQxNDYzMTE4XmRHVbhnnpkQzEwWlcxdw=="
            },
            "help_link": ""
        }
    }
]

Body Content

{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}

Request Information

Category Value
Request Type POST
URL https://api.mailatmars.com/send/:lst_id/template/email/:email_add

Header Information

Parameters Value
Berear Token Access Token From Console

URL Parameter

Parameter Value Information
lst_id id of list that contain this email How To get list id
email_add email address that you send requested email from contact list

Body Content

Key Value Information
to-name name that you set in sender name of reciever
collection_id Collection Id generate from Mailatmars Cosole how to get collecton id
subject subject of email enter your subject for this mail
preview Preview text of sending email
content template string from API template Library how to get API template

Response Field

Field Explain
email recipient email address
email_status Sending email status
status status of email sending if 1 then successfully sended
message message of error if accur

Send Email For Taged Contact

import requests

url = "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/tag/12"

payload="{\n\"to-name\":\"ravigorasiya\",\n\"collection_id\":\"62be6ca2d7c29\",\n\"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n\"preview\":\"We are from mailatmars that help you in transactional API\",\n\"content\":\"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0=\"\n}"
headers = {
  'Authorization': 'Bearer 4en8nafhg9l601ed7fchh9dh',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


require "uri"
require "net/http"

url = URI("https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/tag/12")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer 4en8nafhg9l601ed7fchh9dh"
request["Content-Type"] = "application/json"
request.body = "{\n\"to-name\":\"ravigorasiya\",\n\"collection_id\":\"62be6ca2d7c29\",\n\"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n\"preview\":\"We are from mailatmars that help you in transactional API\",\n\"content\":\"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0=\"\n}"

response = https.request(request)
puts response.read_body


var settings = {
  "url": "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/tag/12",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer 4en8nafhg9l601ed7fchh9dh",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({"to-name":"ravigorasiya","collection_id":"62be6ca2d7c29","subject":"Hi, This Is test email from mailatmars transactional API","preview":"We are from mailatmars that help you in transactional API","content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
curl --location --request POST 'https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/tag/12' \
--header 'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh' \
--header 'Content-Type: application/json' \
--data-raw '{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mailatmars.com/send/906549565%5Ec2Fua2V0X3JhdmlfdGVzdA==/template/tag/12',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Response

[
    {
        "email": "ravigorasiya65@gmail.com",
        "email_status": {
            "status": 1,
            "suc_code": 501,
            "message": {
                "con_id": null,
                "list_id": "458642694^bmV3",
                "content_data": "NDU4NjQyNjk0XjE2MzU4Mjc2NjgjNDU4NjQyNjk0XmRHVnpkQT09"
            },
            "help_link": ""
        }
    }
]

Body Content

{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}

Request Information

Category Value
Request Type POST
URL https://api.mailatmars.com/send/:lst_id/template/tag/:tag_id

Header Information

Parameters Value
Berear Token Access Token From Console

URL Parameter

Parameter Value Information
lst_id id of list that contain this email How To get list id
tag_id id of tag How To get Tag Id

Body Content

Key Value Information
to-name name that you set in sender name of reciever
collection_id Collection Id generate from Mailatmars Cosole how to get collecton id
subject subject of email enter your subject for this mail
preview Preview text of sending email
content template string from API template Library how to get API template

Response Field

Field Explain
email recipient email address
email_status Sending email status
status status of email sending if 1 then successfully sended
message message of error if accur

Send Email By Status

import requests

url = "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/status/unsubscribe"

payload="{\n\"to-name\":\"ravigorasiya\",\n\"collection_id\":\"62be6ca2d7c29\",\n\"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n\"preview\":\"We are from mailatmars that help you in transactional API\",\n\"content\":\"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0=\"\n}"
headers = {
  'Authorization': 'Bearer 4en8nafhg9l601ed7fchh9dh',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)



require "uri"
require "net/http"

url = URI("https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/status/unsubscribe")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer 4en8nafhg9l601ed7fchh9dh"
request["Content-Type"] = "application/json"
request.body = "{\n\"to-name\":\"ravigorasiya\",\n\"collection_id\":\"62be6ca2d7c29\",\n\"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n\"preview\":\"We are from mailatmars that help you in transactional API\",\n\"content\":\"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0=\"\n}"

response = https.request(request)
puts response.read_body


var settings = {
  "url": "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/status/unsubscribe",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer 4en8nafhg9l601ed7fchh9dh",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({"to-name":"ravigorasiya","collection_id":"62be6ca2d7c29","subject":"Hi, This Is test email from mailatmars transactional API","preview":"We are from mailatmars that help you in transactional API","content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
curl --location --request POST 'https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/status/unsubscribe' \
--header 'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh' \
--header 'Content-Type: application/json' \
--data-raw '{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mailatmars.com/send/906549565%5Ec2Fua2V0X3JhdmlfdGVzdA==/template/status/unsubscribe',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


Response

[
    {
        "email": "ravigorasiya65@gmail.com",
        "email_status": {
            "status": 1,
            "suc_code": 501,
            "message": {
                "con_id": null,
                "list_id": "458642694^bmV3",
                "content_data": "NDU4NjQyNjk0XjE2MzU4Mjc2NjgjNDU4NjQyNjk0XmRHVnpkQT09"
            },
            "help_link": ""
        }
    }
]

Body Content

{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}

Request Information

Category Value
Request Type POST
URL https://api.mailatmars.com/send/:lst_id/template/status/:status_name

Header Information

Parameters Value
Berear Token Access Token From Console

URL Parameter

Parameter Value Information
lst_id id of list that contain this email How To get list id
status_name status of contact that you send types of status

Body Content

Key Value Information
to-name name that you set in sender name of reciever
collection_id Collection Id generate from Mailatmars Cosole how to get collecton id
subject subject of email enter your subject for this mail
preview Preview text of sending email
content template string from API template Library how to get API template

Response Field

Field Explain
email recipient email address
email_status Sending email status
status status of email sending if 1 then successfully sended
message message of error if accur

Send Email By Any Field

import requests

url = "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%25avi"

payload="{\n\"to-name\":\"ravigorasiya\",\n\"collection_id\":\"62be6ca2d7c29\",\n\"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n\"preview\":\"We are from mailatmars that help you in transactional API\",\n\"content\":\"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0=\"\n}"
headers = {
  'Authorization': 'Bearer 4en8nafhg9l601ed7fchh9dh',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


require "uri"
require "net/http"

url = URI("https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%25avi")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer 4en8nafhg9l601ed7fchh9dh"
request["Content-Type"] = "application/json"
request.body = "{\n\"to-name\":\"ravigorasiya\",\n\"collection_id\":\"62be6ca2d7c29\",\n\"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n\"preview\":\"We are from mailatmars that help you in transactional API\",\n\"content\":\"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0=\"\n}"

response = https.request(request)
puts response.read_body


var settings = {
  "url": "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%25avi",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer 4en8nafhg9l601ed7fchh9dh",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({"to-name":"ravigorasiya","collection_id":"62be6ca2d7c29","subject":"Hi, This Is test email from mailatmars transactional API","preview":"We are from mailatmars that help you in transactional API","content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
curl --location --request POST 'https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%25avi' \
--header 'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh' \
--header 'Content-Type: application/json' \
--data-raw '{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mailatmars.com/send/906549565%5Ec2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%2525avi',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


Response

[
    {
        "email": "ravigorasiya65@gmail.com",
        "email_status": {
            "status": 1,
            "suc_code": 501,
            "message": {
                "con_id": null,
                "list_id": "458642694^bmV3",
                "content_data": "NDU4NjQyNjk0XjE2MzU4Mjc2NjgjNDU4NjQyNjk0XmRHVnpkQT09"
            },
            "help_link": ""
        }
    }
]

Body Content

{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}

Request Information

Category Value
Request Type POST
URL https://api.mailatmars.com/send/:lst_id/template/:field_name/url_encode(:like_operator)

Header Information

Parameters Value
Berear Token Access Token From Console

URL Parameter

Parameter Value Information
lst_id id of list that contain this email How To get list id
field_name name of table field getting from table schemas

Body Content

Key Value Information
to-name name that you set in sender name of reciever
collection_id Collection Id generate from Mailatmars Cosole how to get collecton id
subject subject of email enter your subject for this mail
preview Preview text of sending email
content template string from API template Library how to get API template

Response Field

Field Explain
email recipient email address
email_status Sending email status
status status of email sending if 1 then successfully sended
message message of error if accur

Set Dynamic Variable

Dynamic Variable is use full for send dynamic content easily. for this purpose we develope our API to send dynamic content.message

For Send dynamic content you can only set dynamic variable in body content with array. and that array containe key=>value data.dynamic and that data we will be implement on your mailatmars Template and send.

import requests

url = "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%25avi"

payload="{\n\"to-name\":\"ravigorasiya\",\n\"collection_id\":\"62be6ca2d7c29\",\n\"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n\"preview\":\"We are from mailatmars that help you in transactional API\",\n\"content\":\"OTA2NTQ5NTY1XjE2NTY2NDg2NTMjOTA2NTQ5NTY1XmRHVnpkRjl5Wm1RPQ==\",\n\"dynamic_content\":{\n    \"otp\":\"76859\"\n}\n}"
headers = {
  'Authorization': 'Bearer 4en8nafhg9l601ed7fchh9dh',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)



require "uri"
require "net/http"

url = URI("https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%25avi")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer 4en8nafhg9l601ed7fchh9dh"
request["Content-Type"] = "application/json"
request.body = "{\n\"to-name\":\"ravigorasiya\",\n\"collection_id\":\"62be6ca2d7c29\",\n\"subject\":\"Hi, This Is test email from mailatmars transactional API\",\n\"preview\":\"We are from mailatmars that help you in transactional API\",\n\"content\":\"OTA2NTQ5NTY1XjE2NTY2NDg2NTMjOTA2NTQ5NTY1XmRHVnpkRjl5Wm1RPQ==\",\n\"dynamic_content\":{\n    \"otp\":\"76859\"\n}\n}"

response = https.request(request)
puts response.read_body


var settings = {
  "url": "https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%25avi",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer 4en8nafhg9l601ed7fchh9dh",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({"to-name":"ravigorasiya","collection_id":"62be6ca2d7c29","subject":"Hi, This Is test email from mailatmars transactional API","preview":"We are from mailatmars that help you in transactional API","content":"OTA2NTQ5NTY1XjE2NTY2NDg2NTMjOTA2NTQ5NTY1XmRHVnpkRjl5Wm1RPQ==","dynamic_content":{"otp":"76859"}}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
curl --location --request POST 'https://api.mailatmars.com/send/906549565^c2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%25avi' \
--header 'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh' \
--header 'Content-Type: application/json' \
--data-raw '{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDg2NTMjOTA2NTQ5NTY1XmRHVnpkRjl5Wm1RPQ==",
"dynamic_content":{
    "otp":"76859"
}
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mailatmars.com/send/906549565%5Ec2Fua2V0X3JhdmlfdGVzdA==/template/firstname/%2525avi',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDg2NTMjOTA2NTQ5NTY1XmRHVnpkRjl5Wm1RPQ==",
"dynamic_content":{
    "otp":"76859"
}
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer 4en8nafhg9l601ed7fchh9dh',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


Response

[
    {
        "email": "ravigorasiya65@gmail.com",
        "email_status": {
            "status": 1,
            "suc_code": 501,
            "message": {
                "con_id": null,
                "list_id": "458642694^bmV3",
                "content_data": "NDU4NjQyNjk0XjE2MzU4Mjc2NjgjNDU4NjQyNjk0XmRHVnpkQT09"
            },
            "help_link": ""
        }
    }
]

Body Content

{
"to-name":"ravigorasiya",
"collection_id":"62be6ca2d7c29",
"subject":"Hi, This Is test email from mailatmars transactional API",
"preview":"We are from mailatmars that help you in transactional API",
"content":"OTA2NTQ5NTY1XjE2NTY2NDc0NTgjOTA2NTQ5NTY1XmFXTnBjbVYwWHpKdVpBPT0="
}

Request Information

Category Value
Request Type POST
URL https://api.mailatmars.com/send/:lst_id/template/:field_name/url_encode(:like_operator)

Header Information

Parameters Value
Berear Token Access Token From Console

URL Parameter

Parameter Value Information
lst_id id of list that contain this email How To get list id
field_name name of table field getting from table schemas

Body Content

Key Value Information
to-name name that you set in sender name of reciever
collection_id Collection Id generate from Mailatmars Cosole how to get collecton id
subject subject of email enter your subject for this mail
preview Preview text of sending email
content template string from API template Library how to get API template
dynamic_content Set Dynamic Variable That Set in API Template

Response Field

Field Explain
email recipient email address
email_status Sending email status
status status of email sending if 1 then successfully sended
message message of error if accur