Sending Emails
Learn how to send transactional emails using the SENTD API.
Basic usage
Send an email by making a POST request to the /api/send endpoint:
const response = await fetch('https://api.sentd.io/api/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
from: 'you@yourdomain.com',
to: 'recipient@example.com',
subject: 'Hello!',
html: '<p>This is a test email.</p>',
}),
});Parameters
| Parameter | Type | Description |
|---|---|---|
from* | string | Sender email address |
to* | string | string[] | Recipient email address(es) |
subject* | string | Email subject line |
html | string | HTML body content |
text | string | Plain text body content |
cc | string | string[] | CC recipients |
bcc | string | string[] | BCC recipients |
replyTo | string | Reply-to address |
scheduledAt | string | ISO 8601 datetime to send |
Multiple recipients
Send to multiple recipients by passing an array:
{
"from": "you@yourdomain.com",
"to": ["user1@example.com", "user2@example.com"],
"cc": ["manager@example.com"],
"bcc": ["archive@example.com"],
"subject": "Team Update",
"html": "<p>Hello team!</p>"
}Scheduled sending
Schedule an email to be sent at a specific time using the scheduledAt parameter:
{
"from": "you@yourdomain.com",
"to": "user@example.com",
"subject": "Reminder",
"html": "<p>Don't forget about tomorrow's meeting!</p>",
"scheduledAt": "2024-12-25T09:00:00Z"
}Scheduled emails can be sent up to 7 days in advance. The time must be in ISO 8601 format with timezone.
Using templates
Instead of inline HTML, you can use a pre-defined template:
{
"from": "you@yourdomain.com",
"to": "user@example.com",
"template": "welcome-email",
"data": {
"name": "John",
"company": "Acme Inc"
}
}Learn more about creating templates.