Skip to content

Sending Custom HTML Emails

Endpoint Overview

Send custom HTML-formatted emails directly to one or more recipient addresses associated with a template ID.

  • HTTP Method: POST
  • Endpoint URL: https://api.trywhiteowl.com/api/v1/email/html
  • Authentication: Bearer Token (API Key)
  • Required Permission: email:send (Ensure your API key has Send permission under Email)

Header Type Required Description
Authorization String Yes Bearer token format: Bearer YOUR_API_KEY
Content-Type String Yes application/json

Field Type Required Description
template Number Yes The numeric identifier of the template to associate with this email.
emails Array (Strings) Yes List of valid recipient email addresses.
subject String Yes Subject line for the email.
html String Yes Custom raw HTML string representing the email body.

Example Payload:

{
"template": 101,
"emails": [
"student@example.com"
],
"subject": "Monthly Newsletter",
"html": "<h1>Special Announcement</h1><p>Check out our latest update!</p>"
}

cURL

Terminal window
curl -X POST "https://api.trywhiteowl.com/api/v1/email/html" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": 101,
"emails": ["student@example.com"],
"subject": "Monthly Newsletter",
"html": "<h1>Special Announcement</h1><p>Check out our latest update!</p>"
}'

JavaScript (Fetch)

const options = {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template: 101,
emails: ['student@example.com'],
subject: 'Monthly Newsletter',
html: '<h1>Special Announcement</h1><p>Check out our latest update!</p>'
})
};
fetch('https://api.trywhiteowl.com/api/v1/email/html', options)
.then(response => response.json())
.then(data => console.log(data))
.catch(err => console.error(err));

Python (Requests)

import requests
url = "https://api.trywhiteowl.com/api/v1/email/html"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"template": 101,
"emails": ["student@example.com"],
"subject": "Monthly Newsletter",
"html": "<h1>Special Announcement</h1><p>Check out our latest update!</p>"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())

Success Response (200 OK)

{
"success": true,
"message": "Email sent successfully"
}

Error Responses

  • Expired Subscription:
{
"success": false,
"message": "Your subscription has expired"
}
  • Daily Sending Limit Exceeded:
{
"success": false,
"message": "You can only send 100 emails a day"
}
  • Empty Template Record:
{
"success": false,
"message": "The body for the template you selected is empty"
}
  • Sender Configuration Missing:
{
"success": false,
"message": "Your sender email or api keys has not been setup yet"
}
  • Internal / Delivery Error:
{
"success": false,
"message": "There was an error sendind the email"
}