Send Transactional Email
POST /v1/send/email
Sends a transactional email using a custom from, subject, and html/text body.
Use this endpoint when you need full control over the email content.
For template-based sends, use POST /v1/send/template instead.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”Request body for sending a transactional email.
Either html or text must be provided. Both are accepted simultaneously.
object
object
Sender display name
John DoeSender email address (must be an authorized sender in your account)
john@doe.comList of recipients
object
Recipient display name
Jane SmithRecipient email address
jane@smith.comEmail subject line
Welcome to Our ServicePlain-text version of the email body
Hello, this is a test email.HTML version of the email body
<p>Hello, this is a test email.</p>Dynamic variables to inject into the email content.
Available from variable_a_var to variable_z_var.
Use them in your content with {{variable_a_var}} syntax.
object
Use in dynamic content as {{variable_a_var}}
Variable A ValueFiles to attach via URL. The server will download and attach each file. (Max size per file: 10MB)
object
File name as it will appear in the attachment
document.pdfPublicly accessible URL of the file
https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdfFiles to attach via base64-encoded content. (Max size per file: 10MB)
object
File name as it will appear in the attachment
document.pdfBase64-encoded file content
data:(mime type),base64,JVBERi0xLjQKJazc...Responses
Section titled “ Responses ”Email successfully queued
object
trueSuccesfully queued emailUUIDs assigned to each queued email, one per recipient
Example
{ "status": true, "message": "Succesfully queued email", "data": [ "1b9d6e34-634a-4762-8d5a-f9cb9165d432" ]}Unauthorized — invalid or missing API token
object
An http error occurred. If error persists, contact soporte@contacta.mxobject
Example
{ "status": false, "message": "An http error occurred. If error persists, contact soporte@contacta.mx", "data": { "message": "Your key auth is not valid, please check with your administrator", "code": 401 }}Insufficient credits to complete the send
object
An http error occurred. If error persists, contact soporte@contacta.mxobject
Example
{ "status": false, "message": "An http error occurred. If error persists, contact soporte@contacta.mx", "data": { "message": "Not enough credits for make this send, please check and retry", "code": 402 }}Unprocessable entity — validation failed on request body
object
An http error occurred. If error persists, contact soporte@contacta.mxobject
Example
{ "status": false, "message": "An http error occurred. If error persists, contact soporte@contacta.mx", "data": { "message": "Missing required fields, please verify your request", "code": 422 }}One or more recipients are blacklisted (unsubscribed)
object
An http error occurred. If error persists, contact soporte@contacta.mxobject
Example
{ "status": false, "message": "An http error occurred. If error persists, contact soporte@contacta.mx", "data": { "message": "One or more email addresses are blacklisted for unsubscribing, please check.", "code": 451 }}Examples
Section titled “Examples ”Useful for guiding users to view code examples in different developer languages.
curl -X POST "https://api.example.com/v1/send/email" \ -H "Accept: application/json" \ -H "Connection: keep-alive" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <your-token>" \ -d '{"from":{"name":"John Doe","email":"john@doe.com"},"to":[{"name":"Jane Smith","email":"jane@smith.com"}],"subject":"Welcome to Our Service","text":"Hello, this is a test email.","html":"<p>Hello, this is a test email.</p>","variables":{"variable_a_var":"Variable A Value"},"attachment":[{"name":"document.pdf","url":"https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf"}],"attachment_buffer":[{"name":"document.pdf","content":"data:(mime type),base64,JVBERi0xLjQKJazc..."}]}' const fetch = require('node-fetch');
fetch("https://api.example.com/v1/send/email", { method: "POST", headers: { "Accept": "application/json", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "Bearer <your-token>"}, body: JSON.stringify({ "from": { "name": "John Doe", "email": "john@doe.com" }, "to": [ { "name": "Jane Smith", "email": "jane@smith.com" } ], "subject": "Welcome to Our Service", "text": "Hello, this is a test email.", "html": "<p>Hello, this is a test email.</p>", "variables": { "variable_a_var": "Variable A Value" }, "attachment": [ { "name": "document.pdf", "url": "https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf" } ], "attachment_buffer": [ { "name": "document.pdf", "content": "data:(mime type),base64,JVBERi0xLjQKJazc..." } ]}) }) .then(res => res.json()) .then(console.log) .catch(console.error); <?php $curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://api.example.com/v1/send/email", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => [ "Accept: application/json", "Connection: keep-alive", "Content-Type: application/json", "Authorization: Bearer <your-token>" ], CURLOPT_POSTFIELDS => json_encode({ "from": { "name": "John Doe", "email": "john@doe.com" }, "to": [ { "name": "Jane Smith", "email": "jane@smith.com" } ], "subject": "Welcome to Our Service", "text": "Hello, this is a test email.", "html": "<p>Hello, this is a test email.</p>", "variables": { "variable_a_var": "Variable A Value" }, "attachment": [ { "name": "document.pdf", "url": "https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf" } ], "attachment_buffer": [ { "name": "document.pdf", "content": "data:(mime type),base64,JVBERi0xLjQKJazc..." } ]}) ]);
$response = curl_exec($curl); curl_close($curl); echo $response; ?> using System.Net.Http; using System.Text; using System.Threading.Tasks;
var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.POST, "https://api.example.com/v1/send/email") { Content = new StringContent("{ \"from\": { \"name\": \"John Doe\", \"email\": \"john@doe.com\" }, \"to\": [ { \"name\": \"Jane Smith\", \"email\": \"jane@smith.com\" } ], \"subject\": \"Welcome to Our Service\", \"text\": \"Hello, this is a test email.\", \"html\": \"<p>Hello, this is a test email.</p>\", \"variables\": { \"variable_a_var\": \"Variable A Value\" }, \"attachment\": [ { \"name\": \"document.pdf\", \"url\": \"https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf\" } ], \"attachment_buffer\": [ { \"name\": \"document.pdf\", \"content\": \"data:(mime type),base64,JVBERi0xLjQKJazc...\" } ]}", Encoding.UTF8, "application/json") }; request.Headers.Add("Accept", "application/json");request.Headers.Add("Connection", "keep-alive");request.Headers.Add("Content-Type", "application/json");request.Headers.Add("Authorization", "Bearer <your-token>"); var response = await client.SendAsync(request); var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); import requests import json
url = "https://api.example.com/v1/send/email" headers = { "Accept": "application/json", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "Bearer <your-token>" } data = { "from": { "name": "John Doe", "email": "john@doe.com" }, "to": [ { "name": "Jane Smith", "email": "jane@smith.com" } ], "subject": "Welcome to Our Service", "text": "Hello, this is a test email.", "html": "<p>Hello, this is a test email.</p>", "variables": { "variable_a_var": "Variable A Value" }, "attachment": [ { "name": "document.pdf", "url": "https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf" } ], "attachment_buffer": [ { "name": "document.pdf", "content": "data:(mime type),base64,JVBERi0xLjQKJazc..." } ]}
response = requests.post(url, headers=headers, json=data) print(response.text) import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets;
public class ApiExample { public static void main(String[] args) throws Exception { URL url = new URL("https://api.example.com/v1/send/email"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoOutput(true); conn.setRequestProperty("Accept", "application/json"); conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Authorization", "Bearer <your-token>");
String jsonInputString = "{\"from\":{\"name\":\"John Doe\",\"email\":\"john@doe.com\"},\"to\":[{\"name\":\"Jane Smith\",\"email\":\"jane@smith.com\"}],\"subject\":\"Welcome to Our Service\",\"text\":\"Hello, this is a test email.\",\"html\":\"<p>Hello, this is a test email.</p>\",\"variables\":{\"variable_a_var\":\"Variable A Value\"},\"attachment\":[{\"name\":\"document.pdf\",\"url\":\"https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf\"}],\"attachment_buffer\":[{\"name\":\"document.pdf\",\"content\":\"data:(mime type),base64,JVBERi0xLjQKJazc...\"}]}"; try(OutputStream os = conn.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); }
int code = conn.getResponseCode(); System.out.println("Response code: " + code); } }