Send Email
Priority queue endpoints for sending email. Choose the endpoint that matches the urgency of your email.
Endpoints
| Method | Endpoint | Priority | Delivery |
|---|---|---|---|
POST | /send-email/instant | Instant | 0-5 sec |
POST | /send-email/high | High | 0-30 sec |
POST | /send-email/async | Normal | 0-5 min |
POST | /send-email/bulk | Low | Idle |
POST | /send-email/schedule | Scheduled | Future time |
Default to /send-email/async. Only escalate when real-time delivery genuinely matters.
Request Body
{
"to": ["[email protected]"],
"subject": "Your order is confirmed",
"body": "<h1>Thanks for your order!</h1>",
"from": "[email protected]",
"from_name": "Acme Store",
"reply_to": "[email protected]",
"cc": ["[email protected]"],
"bcc": ["[email protected]"]
}Fields
| Field | Type | Required | Notes |
|---|---|---|---|
to | string[] | Yes | Recipient addresses |
subject | string | Yes* | Required unless using template_id |
body | string | Yes* | HTML or plain text. Required unless using template_id |
from | string | Conditional | Required when using a custom domain or SMTP credential |
from_name | string | No | Display name for sender |
reply_to | string | No | Reply-to address |
cc | string[] | No | CC recipients |
bcc | string[] | No | BCC recipients |
template_id | UUID | No | Use instead of subject + body |
params | object | No | Handlebars variables for template_id |
Template Email
Use template_id + params instead of subject and body. Do not send both.
{
"to": ["[email protected]"],
"template_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"params": {
"firstName": "Alice",
"resetLink": "https://..."
}
}Scheduled Email
Add scheduled_at and timezone to any send-email body when using the /schedule endpoint:
{
"to": ["[email protected]"],
"subject": "Your weekly digest",
"body": "<p>Here is what happened this week.</p>",
"scheduled_at": "2025-12-25_09:00:00",
"timezone": "America/New_York"
}| Field | Format | Notes |
|---|---|---|
scheduled_at | YYYY-MM-DD_HH:MM:SS or ISO 8601 | Min 1 minute ahead, max 365 days |
timezone | IANA timezone string | e.g. UTC, Europe/London |
Requires LAUNCH plan or higher.
Response
{
"success": true,
"message": "Email queued successfully",
"email_id": "em_7f3a9b2c1d4e",
"queue": "async",
"estimated_delivery": "0-5 minutes"
}Examples
Async (normal priority)
curl -X POST "https://api.keplars.com/api/v1/send-email/async" \
-H "Authorization: Bearer $KEPLARS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":["[email protected]"],"subject":"Hello from Keplars","body":"Your first API email!"}'const res = await fetch(
'https://api.keplars.com/api/v1/send-email/async',
{
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.KEPLARS_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: ['[email protected]'],
subject: 'Hello from Keplars',
body: 'Your first API email!',
}),
},
);
const { data } = await res.json();import requests, os
res = requests.post(
'https://api.keplars.com/api/v1/send-email/async',
json={
'to': ['[email protected]'],
'subject': 'Hello from Keplars',
'body': 'Your first API email!',
},
headers={'Authorization': f'Bearer {os.environ["KEPLARS_API_KEY"]}'},
)
data = res.json()['data']package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := bytes.NewBufferString(`{"to":["[email protected]"],"subject":"Hello from Keplars","body":"Your first API email!"}`)
req, _ := http.NewRequest("POST",
"https://api.keplars.com/api/v1/send-email/async", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KEPLARS_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, _ := (&http.Client{}).Do(req)
defer resp.Body.Close()
b, _ := io.ReadAll(resp.Body)
fmt.Println(string(b))
}<?php
$ch = curl_init('https://api.keplars.com/api/v1/send-email/async');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'to' => ['[email protected]'],
'subject' => 'Hello from Keplars',
'body' => 'Your first API email!',
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('KEPLARS_API_KEY'),
'Content-Type: application/json',
],
]);
$data = json_decode(curl_exec($ch), true)['data'];
curl_close($ch);using System.Net.Http;
using System.Net.Http.Json;
var client = new HttpClient();
client.DefaultRequestHeaders.Add(
"Authorization", $"Bearer {Environment.GetEnvironmentVariable("KEPLARS_API_KEY")}"
);
var response = await client.PostAsJsonAsync(
"https://api.keplars.com/api/v1/send-email/async",
new
{
to = new[] { "[email protected]" },
subject = "Hello from Keplars",
body = "Your first API email!"
}
);
var body = await response.Content.ReadAsStringAsync();use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client
.post("https://api.keplars.com/api/v1/send-email/async")
.header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
.json(&json!({
"to": [
"[email protected]"
],
"subject": "Hello from Keplars",
"body": "Your first API email!"
}))
.send()
.await?;
let data: serde_json::Value = res.json().await?;
println!("{}", data);
Ok(())
}#include <curl/curl.h>
#include <cstdlib>
#include <string>
int main() {
CURL* curl = curl_easy_init();
std::string auth = std::string("Authorization: Bearer ") + std::getenv("KEPLARS_API_KEY");
const char* payload = "{\"to\":[\"[email protected]\"],\"subject\":\"Hello from Keplars\",\"body\":\"Your first API email!\"}";
struct curl_slist* headers = nullptr;
headers = curl_slist_append(headers, auth.c_str());
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/send-email/async");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}#include <curl/curl.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
CURL* curl = curl_easy_init();
char auth[256];
snprintf(auth, sizeof(auth), "Authorization: Bearer %s", getenv("KEPLARS_API_KEY"));
const char* payload = "{\"to\":[\"[email protected]\"],\"subject\":\"Hello from Keplars\",\"body\":\"Your first API email!\"}";
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, auth);
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/send-email/async");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return 0;
}Instant (highest priority)
curl -X POST "https://api.keplars.com/api/v1/send-email/instant" \
-H "Authorization: Bearer $KEPLARS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":["[email protected]"],"subject":"Your verification code","body":"Your code: 123456"}'const res = await fetch(
'https://api.keplars.com/api/v1/send-email/instant',
{
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.KEPLARS_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: ['[email protected]'],
subject: 'Your verification code',
body: 'Your code: 123456',
}),
},
);
const { data } = await res.json();import requests, os
res = requests.post(
'https://api.keplars.com/api/v1/send-email/instant',
json={
'to': ['[email protected]'],
'subject': 'Your verification code',
'body': 'Your code: 123456',
},
headers={'Authorization': f'Bearer {os.environ["KEPLARS_API_KEY"]}'},
)
data = res.json()['data']package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := bytes.NewBufferString(`{"to":["[email protected]"],"subject":"Your verification code","body":"Your code: 123456"}`)
req, _ := http.NewRequest("POST",
"https://api.keplars.com/api/v1/send-email/instant", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KEPLARS_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, _ := (&http.Client{}).Do(req)
defer resp.Body.Close()
b, _ := io.ReadAll(resp.Body)
fmt.Println(string(b))
}<?php
$ch = curl_init('https://api.keplars.com/api/v1/send-email/instant');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'to' => ['[email protected]'],
'subject' => 'Your verification code',
'body' => 'Your code: 123456',
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('KEPLARS_API_KEY'),
'Content-Type: application/json',
],
]);
$data = json_decode(curl_exec($ch), true)['data'];
curl_close($ch);using System.Net.Http;
using System.Net.Http.Json;
var client = new HttpClient();
client.DefaultRequestHeaders.Add(
"Authorization", $"Bearer {Environment.GetEnvironmentVariable("KEPLARS_API_KEY")}"
);
var response = await client.PostAsJsonAsync(
"https://api.keplars.com/api/v1/send-email/instant",
new
{
to = new[] { "[email protected]" },
subject = "Your verification code",
body = "Your code: 123456"
}
);
var body = await response.Content.ReadAsStringAsync();use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client
.post("https://api.keplars.com/api/v1/send-email/instant")
.header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
.json(&json!({
"to": [
"[email protected]"
],
"subject": "Your verification code",
"body": "Your code: 123456"
}))
.send()
.await?;
let data: serde_json::Value = res.json().await?;
println!("{}", data);
Ok(())
}#include <curl/curl.h>
#include <cstdlib>
#include <string>
int main() {
CURL* curl = curl_easy_init();
std::string auth = std::string("Authorization: Bearer ") + std::getenv("KEPLARS_API_KEY");
const char* payload = "{\"to\":[\"[email protected]\"],\"subject\":\"Your verification code\",\"body\":\"Your code: 123456\"}";
struct curl_slist* headers = nullptr;
headers = curl_slist_append(headers, auth.c_str());
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/send-email/instant");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}#include <curl/curl.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
CURL* curl = curl_easy_init();
char auth[256];
snprintf(auth, sizeof(auth), "Authorization: Bearer %s", getenv("KEPLARS_API_KEY"));
const char* payload = "{\"to\":[\"[email protected]\"],\"subject\":\"Your verification code\",\"body\":\"Your code: 123456\"}";
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, auth);
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/send-email/instant");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return 0;
}Manage Scheduled Emails
GET /send-email/scheduled
DELETE /send-email/schedule/:id