Send Email
Overview
The primary endpoint for sending individual emails through the Single API. This is the most flexible and
feature-rich sending option, allowing complete control over email content, recipients, attachments, and delivery parameters.
This endpoint supports:
- Full HTML email content with inline CSS
- Multiple recipients (To, CC, BCC)
- File attachments up to 10MB total
- Embedded images using CID references
- Custom email headers for tracking
- Reply-To and other routing headers
Perfect for:
- Order confirmations and receipts
- Password reset emails
- Account notifications
- Welcome emails
- Transactional alerts
The API accepts a rich message object that includes HTML content, subject, sender details, recipient array, and optional
attachments and images. Each email is processed individually with full delivery tracking.
Endpoint Details
| HTTP Method | POST |
|---|---|
| Endpoint Path | v1.0/messages/sendMail |
| API Version | Single API (v1.0) |
| Content-Type | application/json |
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| owner_id | String | Yes | Your unique SendClean account identifier | user_12345 |
| token | String | Yes | Your API authentication token for secure access | sk_live_abc123... |
| smtp_user_name | String | Yes | The SMTP username to use for sending this email | smtp_user_001 |
| message.html | String | Yes | HTML content of the email. Can include full HTML markup, inline CSS, and formatting | <html>``<body>``<h1>Welcome!</h1>``</body>``</html> |
| message.subject | String | Yes | Subject line of the email. Keep under 60 characters for best email client compatibility | Welcome to SendClean! |
| message.from_email | String (Email) | Yes | Sender email address. Must be from a verified sending domain | [email protected] |
| message.from_name | String | No | Display name for the sender. This appears in the recipient's inbox | SendClean Support Team |
| message.to | Array of Objects | Yes | Array of recipient objects. Each object contains email, name, and type (to/cc/bcc) | [{"email":"[email protected]","name":"John","type":"to"}] |
| message.headers | Object | No | Custom email headers like Reply-To, X-Custom-Id, etc. for tracking and routing | {"Reply-To":"[email protected]"} |
| message.attachments | Array of Objects | No | File attachments. Each object contains type, name, and base64-encoded content | [{"type":"application/pdf","name":"invoice.pdf","content":"base64..."}] |
| message.images | Array of Objects | No | Embedded images referenced in HTML using CID. Base64-encoded image data | [{"type":"image/png","name":"logo","content":"base64..."}] |
Request Example
Below is a complete example of the request body. Replace placeholder values with your actual credentials and data.
{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"smtp_user_name": "{{smtp_user_name}}",
"message": {
"html": "https://app.us.sendclean.net/api/report/mtaReports",
"text": "Welcome To Routemobile",
"subject": "Have A Nice Day",
"from_email": "[email protected]",
"from_name": "Archana J R",
"to": [
{
"email": "[email protected]",
"name": "Archana",
"type": "to"
}
],
"headers": {
"Reply-To": "[email protected]",
"X-Unique-Id": "id"
},
"attachments": [
{
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}
],
"images": [
{
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}
]
}
}Response Format
Successful Response:
{
"status": "success",
"code": 200,
"message": "Email queued successfully",
"data": {
"message_id": "msg_abc123xyz",
"queued_at": "2026-04-17T10:30:00Z",
"recipients": 1
}
}Common Use Cases
- Send order confirmation emails immediately after purchase
- Deliver password reset links with time-sensitive tokens
- Send account verification emails during user registration
- Deliver personalized welcome emails to new users
- Send invoice and receipt emails after transactions
Best Practices
- • Always validate email addresses before sending to reduce bounces
- • Use proper HTML structure with inline CSS for best email client compatibility
- • Keep email size under 102KB for optimal deliverability
- • Include both HTML and plain text versions when possible
- • Use unique X-Unique-Id values for each send to enable accurate tracking
- • Implement retry logic with exponential backoff for failed sends
- • Test emails across multiple email clients before production use
Common Errors & Troubleshooting
400 - Invalid recipient: One or more recipient email addresses are invalid
Solution: Validate all email addresses match RFC 5322 format before sending. Check for typos, missing @ symbols, or invalid domain names.
401 - Authentication failed: Invalid owner_id or token
Solution: Verify your credentials are correct and not expired. Check for extra spaces or special characters. Ensure token hasn't been rotated.
403 - SMTP user disabled: The specified SMTP user is disabled
Solution: Enable the SMTP user using the EditSMTP endpoint or create a new active SMTP user.
429 - Rate limit exceeded: Too many requests in time window
Solution: Implement exponential backoff and retry logic. Consider upgrading your hourly limits or spreading sends over longer period.
401 - Unauthorized: Authentication credentials are missing or invalid
Solution: Verify owner_id and token are correct. Ensure they match your account credentials exactly with no extra whitespace.
500 - Internal server error: Unexpected server error occurred
Solution: Retry the request after a brief delay. If error persists, contact SendClean support with the request details and timestamp.
Implementation Examples
Python (requests):
import requests
import jsonurl = "https://api.sendclean.com/v1.0/messages/sendMail"
payload =:
{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"smtp_user_name": "{{smtp_user_name}}",
"message": {
"html": "https://app.us.sendclean.net/api/report/mtaReports",
"text": "Welcome To Routemobile",
"subject": "Have A Nice Day",
"from_email": "[email protected]",
"from_name": "Archana J R",
"to": [
{
"email": "[email protected]",
"name": "Archana",
"type": "to"
}
],
"headers": {
"Reply-To": "[email protected]",
"X-Unique-Id": "id"
},
"attachments": [
{
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}
],
"images": [
{
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}
]
}
}headers =:
{
"Content-Type": "application/json"
}response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
result = response.json()
print("Success:", result)
else:
print("Error:", response.status_code, response.text)
cURL:
curl -X POST \
https://api.sendclean.com/v1.0/messages/sendMail \
-H 'Content-Type: application/json' \
-d '{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"smtp_user_name": "{{smtp_user_name}}",
"message": {
"html": "https://app.us.sendclean.net/api/report/mtaReports",
"text": "Welcome To Routemobile",
"subject": "Have A Nice Day",
"from_email": "[email protected]",
"from_name": "Archana J R",
"to": [ {
"email": "[email protected]",
"name": "Archana",
"type": "to"
}"headers":
{
"Reply-To": "[email protected]",
"X-Unique-Id": "id"
},"attachments": [ {
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}"images": [ {
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}}'
Node.js (axios):
const axios = require('axios');
const url = 'https://api.sendclean.com/v1.0/messages/sendMail';
const payload = {
"owner_id":"{{owner_id}}",
"token":"{{token}}",
"smtp_user_name":"{{smtp_user_name}}",
"message": {
"html": "https://app.us.sendclean.net/api/report/mtaReports",
"text": "Welcome To Routemobile",
"subject": "Have A Nice Day",
"from_email": "[email protected]",
"from_name": "Archana J R",
"to": [ {
"email": "[email protected]",
"name": "Archana",
"type": "to"
}"headers":
{
"Reply-To": "[email protected]",
"X-Unique-Id": "id"
}, "attachments": [ {
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
} "images": [ {
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}};
axios.post(url, payload, {
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
console.log('Success:', response.data);
})
.catch(error => {
console.error('Error:', error.response ? error.response.data : error.message);
});PHP:
<?php
$url = 'https://api.sendclean.com/v1.0/messages/sendMail';
$payload = json_decode('{
"owner_id":"{{owner_id}}",
"token":"{{token}}",
"smtp_user_name":"{{smtp_user_name}}",
"message": {
"html": "https://app.us.sendclean.net/api/report/mtaReports",
"text": "Welcome To Routemobile",
"subject": "Have A Nice Day",
"from_email": "[email protected]",
"from_name": "Archana J R",
"to": [ {
"email": "[email protected]",
"name": "Archana",
"type": "to"
}"headers":
{
"Reply-To": "[email protected]",
"X-Unique-Id": "id"
}, "attachments": [ {
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
} "images": [ {
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}}', true);
-
$ch = curl_init($url);
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-
curl_setopt($ch, CURLOPT_POST, true);
-
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
-
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]); -
$response = curl_exec($ch);
-
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
curl_close($ch);
-
if ($httpCode == 200) {
-
$result = json_decode($response, true);
-
print_r($result);
-
} else {
echo "Error: $httpCode - $response";
?>
Overview
Sends an email using a pre-configured template stored in SendClean. Templates allow you to separate
content management from sending logic, making it easier to:
- Maintain consistent branding
- Update email designs without code changes
- A/B test different email versions
- Ensure compliance with email standards
When sending with a template:
- Reference the template by its unique ID
- Provide any dynamic variables the template expects
- Specify recipients and sending parameters
- Optional: Override template defaults like subject or from address
Templates can include dynamic content using merge tags that get replaced with actual values at send time.
Endpoint Details
| HTTP Method | POST |
|---|---|
| Endpoint Path | v1.0/messages/sendTemplate |
| API Version | Single API (v1.0) |
| Content-Type | application/json |
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| owner_id | String | Yes | Your unique SendClean account identifier | user_12345 |
| token | String | Yes | Your API authentication token for secure access | sk_live_abc123... |
| smtp_user_name | String | Yes | The SMTP username to use for sending this email | smtp_user_001 |
| message.subject | String | Yes | Subject line of the email. Keep under 60 characters for best email client compatibility | Welcome to SendClean! |
| message.from_email | String (Email) | Yes | Sender email address. Must be from a verified sending domain | [email protected] |
| message.from_name | String | No | Display name for the sender. This appears in the recipient's inbox | SendClean Support Team |
| message.to | Array of Objects | Yes | Array of recipient objects. Each object contains email, name, and type (to/cc/bcc) | [{"email":"[email protected]","name":"John","type":"to"}] |
| message.template_id | String | Yes | ID of the pre-created email template to use for this send | tmpl_welcome_001 |
| message.headers | Object | No | Custom email headers like Reply-To, X-Custom-Id, etc. for tracking and routing | {"Reply-To":"[email protected]"} |
| message.attachments | Array of Objects | No | File attachments. Each object contains type, name, and base64-encoded content | [{"type":"application/pdf","name":"invoice.pdf","content":"base64..."}] |
| message.images | Array of Objects | No | Embedded images referenced in HTML using CID. Base64-encoded image data | [{"type":"image/png","name":"logo","content":"base64..."}] |
Request Example
Below is a complete example of the request body. Replace placeholder values with your actual credentials and data.
{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"smtp_user_name": "{{smtp_user_name}}",
"message": {
"template_id": "{{template_id}}",
"subject": "Test through Postman",
"from_email": "[email protected]",
"from_name": "QA Sendclean",
"to": [
{
"email": "[email protected]",
"name": "Archana J R",
"type": "to"
}
],
"headers": {
"Reply-To": "[email protected]",
"X-Unique-Id": "Archana JR "
},
"attachments": [
{
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}
],
"images": [
{
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}
]
}
}Response Format
Successful Response:
{
"status": "success",
"code": 200,
"message": "Email queued successfully",
"data": {
"message_id": "msg_abc123xyz",
"queued_at": "2026-04-17T10:30:00Z",
"recipients": 1
}
}Common Use Cases
- Send branded welcome emails using your approved template
- Deliver consistent transactional notifications across all apps
- Send multi-language emails using locale-specific templates
- A/B test different email designs by switching templates
- Maintain compliance by using legally-approved templates
Common Errors & Troubleshooting
401 - Unauthorized: Authentication credentials are missing or invalid
Solution: Verify owner_id and token are correct. Ensure they match your account credentials exactly with no extra whitespace.
500 - Internal server error: Unexpected server error occurred
Solution: Retry the request after a brief delay. If error persists, contact SendClean support with the request details and timestamp.
Implementation Examples
Python (requests):
import requests
import jsonurl = "https://api.sendclean.com/v1.0/messages/sendTemplate"
payload =:
{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"smtp_user_name": "{{smtp_user_name}}",
"message": {
"template_id": "{{template_id}}",
"subject": "Test through Postman",
"from_email": "[email protected]",
"from_name": "QA Sendclean",
"to": [
{
"email": "[email protected]",
"name": "Archana J R",
"type": "to"
}
],
"headers": {
"Reply-To": "[email protected]",
"X-Unique-Id": "Archana JR "
},
"attachments": [
{
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}
],
"images": [
{
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}
]
}
}headers =:
{
"Content-Type": "application/json"
}response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
result = response.json()
print("Success:", result)
else:
print("Error:", response.status_code, response.text)
cURL:
curl -X POST \
https://api.sendclean.com/v1.0/messages/sendTemplate \
-H 'Content-Type: application/json' \
-d '{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"smtp_user_name": "{{smtp_user_name}}",
"message": {
"template_id": "{{template_id}}",
"subject": "Test through Postman",
"from_email": "[email protected]",
"from_name": "QA Sendclean",
"to": [ {
"email": "[email protected]",
"name": "Archana J R",
"type": "to"
}"headers":
{
"Reply-To": "[email protected]",
"X-Unique-Id": "Archana JR "
},"attachments": [ {
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
}"images": [ {
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}}'
Node.js (axios):
const axios = require('axios');
const url = 'https://api.sendclean.com/v1.0/messages/sendTemplate';
const payload = {
"owner_id":"{{owner_id}}",
"token":"{{token}}",
"smtp_user_name":"{{smtp_user_name}}",
"message": {
"template_id": "{{template_id}}",
"subject": "Test through Postman",
"from_email": "[email protected]",
"from_name": "QA Sendclean",
"to": [ {
"email": "[email protected]",
"name": "Archana J R",
"type": "to"
}"headers":
{
"Reply-To": "[email protected]",
"X-Unique-Id": "Archana JR "
}, "attachments": [ {
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
} "images": [ {
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}};
axios.post(url, payload, {
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
console.log('Success:', response.data);
})
.catch(error => {
console.error('Error:', error.response ? error.response.data : error.message);
});PHP:
<?php
$url = 'https://api.sendclean.com/v1.0/messages/sendTemplate';
$payload = json_decode('{
"owner_id":"{{owner_id}}",
"token":"{{token}}",
"smtp_user_name":"{{smtp_user_name}}",
"message": {
"template_id": "{{template_id}}",
"subject": "Test through Postman",
"from_email": "[email protected]",
"from_name": "QA Sendclean",
"to": [ {
"email": "[email protected]",
"name": "Archana J R",
"type": "to"
}"headers":
{
"Reply-To": "[email protected]",
"X-Unique-Id": "Archana JR "
}, "attachments": [ {
"type": "text/plain",
"name": "myfile.txt",
"content": "ZXhhbXBsZSBmaWxl"
} "images": [ {
"type": "image/png",
"name": "IMAGECID",
"content": "ZXhhbXBsZSBmaWxl"
}}', true);
-
$ch = curl_init($url);
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-
curl_setopt($ch, CURLOPT_POST, true);
-
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
-
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]); -
$response = curl_exec($ch);
-
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
curl_close($ch);
-
if ($httpCode == 200) {
-
$result = json_decode($response, true);
-
print_r($result);
-
} else {
echo "Error: $httpCode - $response";
?>
Overview
Alternative template sending endpoint using HTTP GET method instead of POST. This is useful
For scenarios where:
- You're integrating from systems that only support GET requests
- You want to trigger emails via simple URL clicks
- You're building email links into workflows or third-party systems
All parameters are passed as URL query parameters instead of in the request body. Note that this method is less secure than
POST since credentials appear in URLs, so use it only when POST is not feasible.
Endpoint Details
| HTTP Method | GET |
|---|---|
| Endpoint Path | v1.0/messages/sendTemplateHTTPGet?owner_id={{owner_id}}&token={{token}}⪪p_user_name={{smtp_user_name}}&template_id={{template_id}}⊂ject=Sendclean QA Test mail through postman&from_email=[email protected]&to=[email protected] |
| API Version | Single API (v1.0) |
| Content-Type | application/json |
Response Format
Successful Response:
{
"status": "success",
"code": 200,
"message": "Email queued successfully",
"data": {
"message_id": "msg_abc123xyz",
"queued_at": "2026-04-17T10:30:00Z",
"recipients": 1
}
}Common Errors & Troubleshooting
401 - Unauthorized: Authentication credentials are missing or invalid
Solution: Verify owner_id and token are correct. Ensure they match your account credentials exactly with no extra whitespace.
500 - Internal server error: Unexpected server error occurred
Solution: Retry the request after a brief delay. If error persists, contact SendClean support with the request details and timestamp.
Overview
Retrieves detailed delivery and engagement information for previously sent emails. This endpoint is
essential for tracking email performance and troubleshooting delivery issues.
You can query messages using:
- Unique identifier (X-Unique-Id) set when sending
- Date range filters
- Recipient email address
- Delivery status
The response includes:
- Delivery status (sent, delivered, bounced, etc.)
- Timestamp information (sent time, delivered time, opened time)
- Engagement metrics (opens, clicks)
- Bounce information and reason codes
- ISP response messages
Use this for:
- Building email analytics dashboards
- Debugging delivery problems
- Compliance and audit trails
- Customer support investigations
Endpoint Details
| HTTP Method | POST |
|---|---|
| Endpoint Path | v1.0/messages/getMessageInfo |
| API Version | Single API (v1.0) |
| Content-Type | application/json |
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| owner_id | String | Yes | Your unique SendClean account identifier | user_12345 |
| token | String | Yes | Your API authentication token for secure access | sk_live_abc123... |
| x_unique_id | String | Yes | Unique identifier used when sending the email. Used to retrieve delivery information | order_12345_confirmation |
| skip_page | Integer | No | Pagination offset. Use 0 for first page, 50 for second page, etc. | 0 |
Request Example
Below is a complete example of the request body. Replace placeholder values with your actual credentials and data.
{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"x_unique_id": "test",
"skip_page": 0
}Response Format
Successful Response:
{
"status": "success",
"code": 200,
"message": "Operation completed successfully"
}Common Errors & Troubleshooting
401 - Unauthorized: Authentication credentials are missing or invalid
Solution: Verify owner_id and token are correct. Ensure they match your account credentials exactly with no extra whitespace.
500 - Internal server error: Unexpected server error occurred
Solution: Retry the request after a brief delay. If error persists, contact SendClean support with the request details and timestamp.
Implementation Examples
curl -X POST \
https://api.sendclean.com/v1.0/messages/getMessageInfo \
-H 'Content-Type: application/json' \
-d '{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"x_unique_id": "test",
"skip_page": 0
}'const axios = require('axios');
const url = 'https://api.sendclean.com/v1.0/messages/getMessageInfo';
const payload = {
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"x_unique_id": "test",
"skip_page": 0
};
axios.post(url, payload, {
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
console.log('Success:', response.data);
})
.catch(error => {
console.error('Error:', error.response ? error.response.data : error.message);
});<?php
$url = 'https://api.sendclean.com/v1.0/messages/getMessageInfo';
$payload = json_decode('{
"owner_id": "{{owner_id}}",
"token": "{{token}}",
"x_unique_id": "test",
"skip_page": 0
}', true);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode == 200) {
$result = json_decode($response, true);
print_r($result);
} else {
echo "Error: $httpCode - $response";
}
?>Updated 4 days ago