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 YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["[email protected]"],
    "subject": "Welcome!",
    "body": "Thank you for signing up!"
  }'

Send Instant Email

For critical emails like 2FA codes:

curl -X POST https://api.keplars.com/api/v1/send-email/instant \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["[email protected]"],
    "subject": "Your verification code",
    "body": "Your code: 123456"
  }'

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

JavaScript Example

async function sendEmail(emailData) {
  const response = await fetch('https://api.keplars.com/api/v1/send-email/async', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.KEPLERS_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(emailData)
  });

  return response.json();
}

// Send welcome email
await sendEmail({
  to: ['[email protected]'],
  subject: 'Welcome!',
  body: 'Welcome to our platform!'
});

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