Keplars

Send Emails

Start sending emails with priority queue processing and advanced features

Send emails through Keplars Mail Service using priority queue endpoints for different delivery speeds.

Priority Queue System:

  • Instant: Critical emails like 2FA codes (0-5 seconds)
  • High: Notifications and alerts (0-30 seconds)
  • Async: Regular emails (0-5 minutes)
  • Bulk: Marketing and newsletters (idle processing)

Quick Start

Send Regular Email

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":"Welcome!","body":"Thank you for signing up!"}'
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: 'Welcome!',
    body: 'Thank you for signing up!',
  }),
  },
);
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': 'Welcome!',
        'body': 'Thank you for signing up!',
    },
    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":"Welcome!","body":"Thank you for signing up!"}`)
    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' => 'Welcome!',
        'body' => 'Thank you for signing up!',
    ]),
    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 = "Welcome!",
    body = "Thank you for signing up!"
}
);
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": "Welcome!",
    "body": "Thank you for signing up!"
}))
        .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\":\"Welcome!\",\"body\":\"Thank you for signing up!\"}";
    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\":\"Welcome!\",\"body\":\"Thank you for signing up!\"}";
    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;
}

Send Instant Email

For critical emails like 2FA codes:

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;
}

Email Types

Basic Email

{
  "to": ["[email protected]"],
  "subject": "Email subject",
  "body": "Email content"
}

HTML Email

The API automatically detects HTML content in the body field:

{
  "to": ["[email protected]"],
  "subject": "Welcome!",
  "body": "<h1>Welcome!</h1><p>Thank you for joining.</p>"
}

Pro Tip: Use React Email to build complex HTML emails with React components instead of writing raw HTML.

Template Email

Use pre-designed templates with dynamic content:

{
  "to": ["[email protected]"],
  "template_id": "019a83de-2fc2-7b5f-bfbc-c951fe1200f7",
  "params": {
    "userName": "John Doe",
    "orderNumber": "12345",
    "orderDate": "2026-01-18"
  }
}

Important: When using templates, do NOT include subject or body fields. The template defines these automatically.

Learn more about templates: Email Templates

Examples

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":"Welcome!","body":"Welcome to our platform!"}'
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: 'Welcome!',
    body: 'Welcome to our platform!',
  }),
  },
);
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': 'Welcome!',
        'body': 'Welcome to our platform!',
    },
    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":"Welcome!","body":"Welcome to our platform!"}`)
    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' => 'Welcome!',
        'body' => 'Welcome to our platform!',
    ]),
    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 = "Welcome!",
    body = "Welcome to our platform!"
}
);
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": "Welcome!",
    "body": "Welcome to our platform!"
}))
        .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\":\"Welcome!\",\"body\":\"Welcome to our platform!\"}";
    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\":\"Welcome!\",\"body\":\"Welcome to our platform!\"}";
    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;
}

Check Email Status

curl -X GET https://api.keplars.com/api/v1/emails/{emailId}/status \
  -H "Authorization: Bearer YOUR_API_KEY"

Response:

{
  "success": true,
  "data": {
    "id": "email_id",
    "status": "delivered",
    "created_at": "2024-01-15T10:30:00Z",
    "delivered_at": "2024-01-15T10:30:45Z"
  }
}

Response Format

Success

{
  "success": true,
  "data": {
    "id": "email_id",
    "message": "Email sent successfully"
  }
}

Error

{
  "success": false,
  "error": "Invalid email address",
  "code": "INVALID_EMAIL"
}

Next Steps


Start sending emails with Keplars Mail Service. Choose instant for critical emails or queue for regular communications.

On this page