Keplars

Migrate from Mailgun

Replace Mailgun with Keplars: SDK swap, domain setup differences, EU region note

Migrate from Mailgun

API Comparison

MailgunKeplars
Send endpointPOST /v3/{domain}/messagesPOST /api/v1/send-email/instant
AuthHTTP Basic with api:YOUR_API_KEYAuthorization: Bearer kms_xxx
Recipient fieldto (string or array)to (array of strings)
HTML bodyhtml form fieldhtml with is_html: true
Templatetemplate + h:X-Mailgun-Variablestemplate_id + params
EU regionapi.eu.mailgun.netSingle global endpoint

Migration Steps

Get your Keplars API key: go to dash.keplars.com → API Keys → Create Key

Install the Keplars SDK:

# JavaScript / TypeScript
bun add @keplars/sdk

# Python
pip install keplars

Add your sending domain: Dashboard → Custom Domains → Add Domain, then add the provided CNAME and TXT records to your DNS

Swap the send call: replace mg.messages.create() with the Keplars SDK (see code below)

Update webhook URLs: Mailgun webhooks use a different signature format; update your endpoint to verify Keplars webhook signatures

Test in sandbox mode before switching DNS MX records

Code Comparison

Before (Mailgun, JavaScript):

import Mailgun from 'mailgun.js';
import FormData from 'form-data';

const mg = new Mailgun(FormData).client({
  username: 'api',
  key: process.env.MAILGUN_API_KEY,
});

await mg.messages.create('yourdomain.com', {
  from: '[email protected]',
  to: ['[email protected]'],
  subject: 'Welcome!',
  html: '<h1>Welcome aboard</h1>',
});

After (Keplars, JavaScript):

import { Keplars } from '@keplars/sdk';

const keplars = new Keplars({ apiKey: process.env.KEPLARS_API_KEY });

await keplars.emails.sendInstant({
  to: ['[email protected]'],
  subject: 'Welcome!',
  html: '<h1>Welcome aboard</h1>',
  is_html: true,
});

Before (Mailgun, Python):

import mailgun2

client = mailgun2.Mailgun(
    domain='yourdomain.com',
    private_api_key=os.environ.get('MAILGUN_API_KEY'),
)
client.sendmail(
    ['[email protected]'],
    '[email protected]',
    subject='Welcome!',
    html='<h1>Welcome aboard</h1>',
)

After (Keplars, Python):

from keplars import Keplars

keplars = Keplars(api_key=os.environ.get('KEPLARS_API_KEY'))

keplars.emails.send_instant(
    to=['[email protected]'],
    subject='Welcome!',
    html='<h1>Welcome aboard</h1>',
    is_html=True,
)

Webhook Event Name Mapping

Mailgun EventKeplars Event
deliveredemail.delivered
failed (hard)email.bounced
openedemail.opened
clickedemail.clicked
unsubscribedemail.unsubscribed
complainedemail.complained

Mailgun EU region (api.eu.mailgun.net) is a separate API base URL. Keplars uses a single global endpoint: no region configuration needed. If you have separate EU sending domains in Mailgun, you can consolidate them under one Keplars workspace.

On this page