Keplars

Email Templates

Create and use email templates with Handlebars syntax for dynamic content

Email Templates

Email templates allow you to create reusable email designs with dynamic content using Handlebars syntax. Templates are compiled at send-time with your custom parameters.

Templates work seamlessly with all email providers (Gmail, Microsoft, AWS SES) and support rich visual components.

Looking for component-based templates? Check out React Email for building emails with React components and TypeScript.

How Templates Work

graph LR
    A[Email Request] --> B[Template Compilation]
    B --> C[Handlebars Processing]
    C --> D[HTML Generation]
    D --> E[Email Sent]
  1. Request: Send email with template_id and params
  2. Compilation: Template Engine compiles template with parameters
  3. Generation: Handlebars generates final HTML and subject
  4. Delivery: Email sent via your configured provider

Quick Start

1. Create a Template

Use the visual editor or API to create a template:

curl -X POST "https://api.keplars.com/api/v1/templates/save" \
  -H "Authorization: Bearer $KEPLARS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Welcome Email","description":"Welcome new users","category":"onboarding","workspace_id":"your-workspace-id"}'
const res = await fetch(
  'https://api.keplars.com/api/v1/templates/save',
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.KEPLARS_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
    name: 'Welcome Email',
    description: 'Welcome new users',
    category: 'onboarding',
    workspace_id: 'your-workspace-id',
  }),
  },
);
const { data } = await res.json();
import requests, os
res = requests.post(
    'https://api.keplars.com/api/v1/templates/save',
    json={
        'name': 'Welcome Email',
        'description': 'Welcome new users',
        'category': 'onboarding',
        'workspace_id': 'your-workspace-id',
    },
    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(`{"name":"Welcome Email","description":"Welcome new users","category":"onboarding","workspace_id":"your-workspace-id"}`)
    req, _ := http.NewRequest("POST",
        "https://api.keplars.com/api/v1/templates/save", 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/templates/save');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode([
        'name' => 'Welcome Email',
        'description' => 'Welcome new users',
        'category' => 'onboarding',
        'workspace_id' => 'your-workspace-id',
    ]),
    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/templates/save",
    new
{
    name = "Welcome Email",
    description = "Welcome new users",
    category = "onboarding",
    workspace_id = "your-workspace-id"
}
);
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/templates/save")
        .header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
        .json(&json!({
    "name": "Welcome Email",
    "description": "Welcome new users",
    "category": "onboarding",
    "workspace_id": "your-workspace-id"
}))
        .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 = "{\"name\":\"Welcome Email\",\"description\":\"Welcome new users\",\"category\":\"onboarding\",\"workspace_id\":\"your-workspace-id\"}";
    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/templates/save");
    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 = "{\"name\":\"Welcome Email\",\"description\":\"Welcome new users\",\"category\":\"onboarding\",\"workspace_id\":\"your-workspace-id\"}";
    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/templates/save");
    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;
}

Response:

{
  "success": true,
  "data": {
    "id": "019a83de-2fc2-7b5f-bfbc-c951fe1200f7",
    "name": "Welcome Email",
    "created_at": "2026-01-18T10:00:00Z"
  }
}

2. Send Email with Template

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]"],"template_id":"019a83de-2fc2-7b5f-bfbc-c951fe1200f7","params":{"userName":"John Doe","companyName":"Keplars"}}'
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]'],
    template_id: '019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
    params: { userName: 'John Doe', companyName: 'Keplars' },
  }),
  },
);
const { data } = await res.json();
import requests, os
res = requests.post(
    'https://api.keplars.com/api/v1/send-email/instant',
    json={
        'to': ['[email protected]'],
        'template_id': '019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
        'params': {'userName': 'John Doe', 'companyName': 'Keplars'},
    },
    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]"],"template_id":"019a83de-2fc2-7b5f-bfbc-c951fe1200f7","params":{"userName":"John Doe","companyName":"Keplars"}}`)
    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]'],
        'template_id' => '019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
        'params' => ['userName' => 'John Doe', 'companyName' => 'Keplars'],
    ]),
    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]" },
    template_id = "019a83de-2fc2-7b5f-bfbc-c951fe1200f7",
    params = new { userName = "John Doe", companyName = "Keplars" }
}
);
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]"
    ],
    "template_id": "019a83de-2fc2-7b5f-bfbc-c951fe1200f7",
    "params": {
        "userName": "John Doe",
        "companyName": "Keplars"
    }
}))
        .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]\"],\"template_id\":\"019a83de-2fc2-7b5f-bfbc-c951fe1200f7\",\"params\":{\"userName\":\"John Doe\",\"companyName\":\"Keplars\"}}";
    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]\"],\"template_id\":\"019a83de-2fc2-7b5f-bfbc-c951fe1200f7\",\"params\":{\"userName\":\"John Doe\",\"companyName\":\"Keplars\"}}";
    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;
}

Important: When using templates, do NOT provide subject, body, or html fields. These come from the template itself.

Template Structure

Visual Blocks

Templates are composed of visual blocks that support Handlebars variables:

Available Block Types

Block TypeDescriptionUse Case
headerCompany name/logoEmail branding
heroHeadline + CTAMain message
textParagraph contentBody text
imageImages with captionsVisual content
buttonCall-to-action buttonsLinks
columns2Two-column layoutSide-by-side content
columns3Three-column layoutProduct grids
socialSocial media linksFooter
footerUnsubscribe linksCompliance
videoVideo thumbnailsMedia content
testimonialCustomer quotesSocial proof
eventEvent detailsInvitations
dividerHorizontal lineSection separator
spacerVertical spacingLayout

Block Example

{
  "type": "text",
  "content": {
    "text": "Dear {{userName}}, your order #{{orderNumber}} has been confirmed!"
  },
  "styles": {
    "padding": "20px",
    "fontSize": "16px",
    "color": "#333333"
  }
}

Handlebars Syntax

Variables

Use double curly braces for dynamic content:

Hello {{userName}}!
Your account expires on {{expiryDate}}.

Helpers

Built-in helpers for data formatting:

Comparison Helpers

{{#if (eq status "premium")}}
  Premium features unlocked!
{{/if}}

{{#if (gt credits 100)}}
  You have bonus credits!
{{/if}}

Text Formatting

{{uppercase companyName}}     → KEPLARS
{{lowercase email}}[email protected]
{{capitalize userName}}        → John Doe
{{truncate description 100}}  → First 100 chars...

Date Formatting

{{formatDate orderDate "short"}}    → 1/15/2026
{{formatDate orderDate "long"}}     → Wednesday, January 15, 2026
{{formatDate orderDate "time"}}     → 10:30:00 AM

Currency Formatting

{{currency amount "USD"}}  → $1,234.56
{{currency price "EUR"}}   → €999.00

Logic Helpers

{{#if (and isActive isPremium)}}
  Premium active user
{{/if}}

{{#if (or isAdmin isModerator)}}
  You have elevated permissions
{{/if}}

Complete Example

{
  "type": "text",
  "content": {
    "text": "{{#if isPremium}}Premium{{else}}Standard{{/if}} user {{capitalize userName}} - Account expires {{formatDate expiryDate 'long'}}"
  }
}

Template API Reference

Create Template

curl -X POST "https://api.keplars.com/api/v1/templates/save" \
  -H "Authorization: Bearer $KEPLARS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Template Name","description":"Template description","category":"marketing","workspace_id":"workspace-uuid"}'
const res = await fetch(
  'https://api.keplars.com/api/v1/templates/save',
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.KEPLARS_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
    name: 'Template Name',
    description: 'Template description',
    category: 'marketing',
    workspace_id: 'workspace-uuid',
  }),
  },
);
const { data } = await res.json();
import requests, os
res = requests.post(
    'https://api.keplars.com/api/v1/templates/save',
    json={
        'name': 'Template Name',
        'description': 'Template description',
        'category': 'marketing',
        'workspace_id': 'workspace-uuid',
    },
    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(`{"name":"Template Name","description":"Template description","category":"marketing","workspace_id":"workspace-uuid"}`)
    req, _ := http.NewRequest("POST",
        "https://api.keplars.com/api/v1/templates/save", 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/templates/save');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode([
        'name' => 'Template Name',
        'description' => 'Template description',
        'category' => 'marketing',
        'workspace_id' => 'workspace-uuid',
    ]),
    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/templates/save",
    new
{
    name = "Template Name",
    description = "Template description",
    category = "marketing",
    workspace_id = "workspace-uuid"
}
);
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/templates/save")
        .header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
        .json(&json!({
    "name": "Template Name",
    "description": "Template description",
    "category": "marketing",
    "workspace_id": "workspace-uuid"
}))
        .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 = "{\"name\":\"Template Name\",\"description\":\"Template description\",\"category\":\"marketing\",\"workspace_id\":\"workspace-uuid\"}";
    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/templates/save");
    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 = "{\"name\":\"Template Name\",\"description\":\"Template description\",\"category\":\"marketing\",\"workspace_id\":\"workspace-uuid\"}";
    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/templates/save");
    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;
}

List Templates

curl "https://api.keplars.com/api/v1/templates/list?workspace_id=workspace-uuid" \
  -H "Authorization: Bearer $KEPLARS_API_KEY"
const res = await fetch(
  'https://api.keplars.com/api/v1/templates/list?workspace_id=workspace-uuid',
  { headers: { Authorization: `Bearer ${process.env.KEPLARS_API_KEY}` } },
);
const { data } = await res.json();
import requests, os
res = requests.get(
    'https://api.keplars.com/api/v1/templates/list?workspace_id=workspace-uuid',
    headers={'Authorization': f'Bearer {os.environ["KEPLARS_API_KEY"]}'},
)
data = res.json()['data']
package main

import (
    "fmt"
    "io"
    "net/http"
    "os"
)

func main() {
    req, _ := http.NewRequest("GET",
        "https://api.keplars.com/api/v1/templates/list?workspace_id=workspace-uuid", nil)
    req.Header.Set("Authorization", "Bearer "+os.Getenv("KEPLARS_API_KEY"))
    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/templates/list?workspace_id=workspace-uuid');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('KEPLARS_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true)['data'];
curl_close($ch);
using System.Net.Http;

var client = new HttpClient();
client.DefaultRequestHeaders.Add(
    "Authorization", $"Bearer {Environment.GetEnvironmentVariable("KEPLARS_API_KEY")}"
);
var response = await client.GetAsync(
    "https://api.keplars.com/api/v1/templates/list?workspace_id=workspace-uuid"
);
var body = await response.Content.ReadAsStringAsync();
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let res = client
        .get("https://api.keplars.com/api/v1/templates/list?workspace_id=workspace-uuid")
        .header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
        .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");
    struct curl_slist* headers = nullptr;
    headers = curl_slist_append(headers, auth.c_str());
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/templates/list?workspace_id=workspace-uuid");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    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"));
    struct curl_slist* headers = NULL;
    headers = curl_slist_append(headers, auth);
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/templates/list?workspace_id=workspace-uuid");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_perform(curl);
    curl_slist_free_all(headers);
    curl_easy_cleanup(curl);
    return 0;
}

Response:

{
  "success": true,
  "data": [
    {
      "id": "template-uuid",
      "name": "Welcome Email",
      "category": "onboarding",
      "is_ai_generated": false,
      "usage_count": 42,
      "created_at": "2026-01-15T10:00:00Z"
    }
  ]
}

Get Template Details

curl "https://api.keplars.com/api/v1/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7" \
  -H "Authorization: Bearer $KEPLARS_API_KEY"
const res = await fetch(
  'https://api.keplars.com/api/v1/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
  { headers: { Authorization: `Bearer ${process.env.KEPLARS_API_KEY}` } },
);
const { data } = await res.json();
import requests, os
res = requests.get(
    'https://api.keplars.com/api/v1/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
    headers={'Authorization': f'Bearer {os.environ["KEPLARS_API_KEY"]}'},
)
data = res.json()['data']
package main

import (
    "fmt"
    "io"
    "net/http"
    "os"
)

func main() {
    req, _ := http.NewRequest("GET",
        "https://api.keplars.com/api/v1/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7", nil)
    req.Header.Set("Authorization", "Bearer "+os.Getenv("KEPLARS_API_KEY"))
    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/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('KEPLARS_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true)['data'];
curl_close($ch);
using System.Net.Http;

var client = new HttpClient();
client.DefaultRequestHeaders.Add(
    "Authorization", $"Bearer {Environment.GetEnvironmentVariable("KEPLARS_API_KEY")}"
);
var response = await client.GetAsync(
    "https://api.keplars.com/api/v1/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7"
);
var body = await response.Content.ReadAsStringAsync();
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let res = client
        .get("https://api.keplars.com/api/v1/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7")
        .header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
        .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");
    struct curl_slist* headers = nullptr;
    headers = curl_slist_append(headers, auth.c_str());
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    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"));
    struct curl_slist* headers = NULL;
    headers = curl_slist_append(headers, auth);
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/templates/details/019a83de-2fc2-7b5f-bfbc-c951fe1200f7");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_perform(curl);
    curl_slist_free_all(headers);
    curl_easy_cleanup(curl);
    return 0;
}

Update Template

curl -X PATCH "https://api.keplars.com/api/v1/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7" \
  -H "Authorization: Bearer $KEPLARS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Updated Template Name"}'
const res = await fetch(
  'https://api.keplars.com/api/v1/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
  {
    method: 'PATCH',
    headers: {
      Authorization: `Bearer ${process.env.KEPLARS_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
    name: 'Updated Template Name',
  }),
  },
);
const { data } = await res.json();
import requests, os
res = requests.patch(
    'https://api.keplars.com/api/v1/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
    json={
        'name': 'Updated Template Name',
    },
    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(`{"name":"Updated Template Name"}`)
    req, _ := http.NewRequest("PATCH",
        "https://api.keplars.com/api/v1/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7", 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/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'PATCH',
    CURLOPT_POSTFIELDS     => json_encode([
        'name' => 'Updated Template Name',
    ]),
    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.PatchAsJsonAsync(
    "https://api.keplars.com/api/v1/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7",
    new
{
    name = "Updated Template Name"
}
);
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
        .patch("https://api.keplars.com/api/v1/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7")
        .header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
        .json(&json!({
    "name": "Updated Template Name"
}))
        .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 = "{\"name\":\"Updated Template Name\"}";
    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/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7");
    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 = "{\"name\":\"Updated Template Name\"}";
    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/templates/update/019a83de-2fc2-7b5f-bfbc-c951fe1200f7");
    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;
}

Delete Template

curl -X DELETE "https://api.keplars.com/api/v1/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7" \
  -H "Authorization: Bearer $KEPLARS_API_KEY"
const res = await fetch(
  'https://api.keplars.com/api/v1/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
  {
    method: 'DELETE',
    headers: {
      Authorization: `Bearer ${process.env.KEPLARS_API_KEY}`,
    },
  },
);
import requests, os
res = requests.delete(
    'https://api.keplars.com/api/v1/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
    headers={'Authorization': f'Bearer {os.environ["KEPLARS_API_KEY"]}'},
)
package main

import (
    "fmt"
    "io"
    "net/http"
    "os"
)

func main() {
    req, _ := http.NewRequest("DELETE",
        "https://api.keplars.com/api/v1/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7", nil)
    req.Header.Set("Authorization", "Bearer "+os.Getenv("KEPLARS_API_KEY"))
    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/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'DELETE',
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('KEPLARS_API_KEY'),
    ],
]);
curl_exec($ch);
curl_close($ch);
using System.Net.Http;

var client = new HttpClient();
client.DefaultRequestHeaders.Add(
    "Authorization", $"Bearer {Environment.GetEnvironmentVariable("KEPLARS_API_KEY")}"
);
var response = await client.DeleteAsync(
    "https://api.keplars.com/api/v1/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7"
);
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let res = client
        .delete("https://api.keplars.com/api/v1/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7")
        .header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
        .send()
        .await?;
    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");
    struct curl_slist* headers = nullptr;
    headers = curl_slist_append(headers, auth.c_str());
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
    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"));
    struct curl_slist* headers = NULL;
    headers = curl_slist_append(headers, auth);
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.keplars.com/api/v1/templates/delete/019a83de-2fc2-7b5f-bfbc-c951fe1200f7");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
    curl_easy_perform(curl);
    curl_slist_free_all(headers);
    curl_easy_cleanup(curl);
    return 0;
}

Sending Emails with Templates

Basic Template Email

const response = await fetch('https://api.keplars.com/api/v1/send-email/instant', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    to: ['[email protected]'],
    template_id: '019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
    params: {
      userName: 'John Doe',
      orderNumber: '12345',
      orderDate: '2026-01-18',
      amount: 99.99
    }
  })
});

Priority Levels with Templates

Templates work with all priority levels:

// Instant (0-5 seconds) - 2FA, OTP
POST /api/v1/send-email/instant

// High (0-30 seconds) - Alerts
POST /api/v1/send-email/high

// Normal (0-5 minutes) - Regular
POST /api/v1/send-email/async

// Low (when idle) - Marketing
POST /api/v1/send-email/bulk

Batch Emails with Templates

{
  "emails": [
    {
      "to": ["[email protected]"],
      "template_id": "welcome-template-id",
      "params": { "userName": "User 1" }
    },
    {
      "to": ["[email protected]"],
      "template_id": "welcome-template-id",
      "params": { "userName": "User 2" }
    }
  ],
  "priority": "normal"
}

Template Categories

Organize templates by category:

  • general - Miscellaneous emails
  • marketing - Promotional content
  • transactional - Orders, receipts
  • newsletter - Regular updates
  • onboarding - Welcome emails
  • support - Help emails
  • events - Invitations
  • ecommerce - Shopping

Best Practices

Design Guidelines

  1. Mobile-First: Templates are responsive by default
  2. Image Formats: Use JPG, PNG, GIF, WebP (NOT SVG)
  3. Width: Recommended 600px for email clients
  4. Colors: Use hex codes for consistency
  5. Fonts: Stick to web-safe fonts (Arial, Helvetica, sans-serif)

Variable Naming

// ✅ Good - Clear and descriptive
{
  "userName": "John",
  "orderNumber": "12345",
  "expiryDate": "2026-12-31"
}

// ❌ Bad - Unclear abbreviations
{
  "un": "John",
  "on": "12345",
  "ed": "2026-12-31"
}

Testing Templates

Always test templates before sending to customers:

curl -X POST "https://api.keplars.com/api/v1/templates/compile" \
  -H "Authorization: Bearer $KEPLARS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"template_id":"019a83de-2fc2-7b5f-bfbc-c951fe1200f7","params":{"userName":"Test User","orderNumber":"TEST-001"}}'
const res = await fetch(
  'https://api.keplars.com/api/v1/templates/compile',
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.KEPLARS_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
    template_id: '019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
    params: { userName: 'Test User', orderNumber: 'TEST-001' },
  }),
  },
);
const { data } = await res.json();
import requests, os
res = requests.post(
    'https://api.keplars.com/api/v1/templates/compile',
    json={
        'template_id': '019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
        'params': {'userName': 'Test User', 'orderNumber': 'TEST-001'},
    },
    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(`{"template_id":"019a83de-2fc2-7b5f-bfbc-c951fe1200f7","params":{"userName":"Test User","orderNumber":"TEST-001"}}`)
    req, _ := http.NewRequest("POST",
        "https://api.keplars.com/api/v1/templates/compile", 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/templates/compile');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode([
        'template_id' => '019a83de-2fc2-7b5f-bfbc-c951fe1200f7',
        'params' => ['userName' => 'Test User', 'orderNumber' => 'TEST-001'],
    ]),
    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/templates/compile",
    new
{
    template_id = "019a83de-2fc2-7b5f-bfbc-c951fe1200f7",
    params = new { userName = "Test User", orderNumber = "TEST-001" }
}
);
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/templates/compile")
        .header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
        .json(&json!({
    "template_id": "019a83de-2fc2-7b5f-bfbc-c951fe1200f7",
    "params": {
        "userName": "Test User",
        "orderNumber": "TEST-001"
    }
}))
        .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 = "{\"template_id\":\"019a83de-2fc2-7b5f-bfbc-c951fe1200f7\",\"params\":{\"userName\":\"Test User\",\"orderNumber\":\"TEST-001\"}}";
    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/templates/compile");
    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 = "{\"template_id\":\"019a83de-2fc2-7b5f-bfbc-c951fe1200f7\",\"params\":{\"userName\":\"Test User\",\"orderNumber\":\"TEST-001\"}}";
    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/templates/compile");
    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;
}

Response:

{
  "success": true,
  "data": {
    "subject": "Order Confirmation for Test User",
    "compiled_html": "<html>...</html>",
    "plain_text": "Order Confirmation..."
  }
}

Validation Rules

Template Email Rules

Validation Errors:

  • ❌ Cannot provide subject when using template_id
  • ❌ Cannot provide body when using template_id
  • ❌ Cannot provide html when using template_id
  • ❌ Must provide params when using template_id
// ❌ INVALID - Subject with template
{
  "to": ["[email protected]"],
  "template_id": "abc123",
  "subject": "Hello",  // ❌ ERROR: Subject comes from template
  "params": {}
}

// ✅ VALID - Template only
{
  "to": ["[email protected]"],
  "template_id": "abc123",
  "params": { "userName": "John" }
}

Troubleshooting

Common Issues

Template Not Found

{
  "error": "Template not found"
}

Solution: Verify template_id exists and is active

Missing Parameters

{
  "error": "Template params are required when using template_id"
}

Solution: Provide params object with required variables

Compilation Failed

{
  "error": "Template compilation failed: Not Found"
}

Solution: Check template engine is running and template exists

Invalid Image Format

[WARNING] Image format not supported in email clients

Solution: Convert SVG images to PNG/JPG

Advanced Features

AI Template Generation

Generate templates using AI:

curl -X POST "https://api.keplars.com/api/v1/templates/generate" \
  -H "Authorization: Bearer $KEPLARS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Create a professional order confirmation email with order summary, shipping details, and support contact","category":"transactional","workspace_id":"your-workspace-id"}'
const res = await fetch(
  'https://api.keplars.com/api/v1/templates/generate',
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.KEPLARS_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
    prompt: 'Create a professional order confirmation email with order summary, shipping details, and support contact',
    category: 'transactional',
    workspace_id: 'your-workspace-id',
  }),
  },
);
const { data } = await res.json();
import requests, os
res = requests.post(
    'https://api.keplars.com/api/v1/templates/generate',
    json={
        'prompt': 'Create a professional order confirmation email with order summary, shipping details, and support contact',
        'category': 'transactional',
        'workspace_id': 'your-workspace-id',
    },
    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(`{"prompt":"Create a professional order confirmation email with order summary, shipping details, and support contact","category":"transactional","workspace_id":"your-workspace-id"}`)
    req, _ := http.NewRequest("POST",
        "https://api.keplars.com/api/v1/templates/generate", 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/templates/generate');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode([
        'prompt' => 'Create a professional order confirmation email with order summary, shipping details, and support contact',
        'category' => 'transactional',
        'workspace_id' => 'your-workspace-id',
    ]),
    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/templates/generate",
    new
{
    prompt = "Create a professional order confirmation email with order summary, shipping details, and support contact",
    category = "transactional",
    workspace_id = "your-workspace-id"
}
);
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/templates/generate")
        .header("Authorization", format!("Bearer {}", std::env::var("KEPLARS_API_KEY")?))
        .json(&json!({
    "prompt": "Create a professional order confirmation email with order summary, shipping details, and support contact",
    "category": "transactional",
    "workspace_id": "your-workspace-id"
}))
        .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 = "{\"prompt\":\"Create a professional order confirmation email with order summary, shipping details, and support contact\",\"category\":\"transactional\",\"workspace_id\":\"your-workspace-id\"}";
    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/templates/generate");
    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 = "{\"prompt\":\"Create a professional order confirmation email with order summary, shipping details, and support contact\",\"category\":\"transactional\",\"workspace_id\":\"your-workspace-id\"}";
    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/templates/generate");
    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;
}

See AI Templates for more details.

Image Validation

The system validates image formats for email compatibility:

// Supported formats
JPG, JPEG, PNG, GIF, WebP

// Unsupported formats (will show warnings)
SVG, BMP, TIFF, ICO, HEIC, AVIF

Next Steps


Start creating professional email templates today with Keplars Mail Service!

On this page