Send Transactional Email
const url = 'https://api.contacta.mx/v1/send/email';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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 { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.contacta.mx/v1/send/email \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --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..." } ] }'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 Bodyrequired
Section titled “Request Bodyrequired”Request body for sending a transactional email.
Either html or text must be provided. Both are accepted simultaneously.
object
object
Sender display name
Example
John DoeSender email address (must be an authorized sender in your account)
Example
john@doe.comList of recipients
object
Recipient display name
Example
Jane SmithRecipient email address
Example
jane@smith.comEmail subject line
Example
Welcome to Our ServicePlain-text version of the email body
Example
Hello, this is a test email.HTML version of the email body
Example
<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}}
Example
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
Example
document.pdfPublicly accessible URL of the file
Example
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
Example
document.pdfBase64-encoded file content
Example
data:(mime type),base64,JVBERi0xLjQKJazc...Responses
Section titled “Responses”Email successfully queued
object
UUIDs 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
object
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
object
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
object
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
object
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 }}
