Migrate from Mailgun
Replace Mailgun with Keplars: SDK swap, domain setup differences, EU region note
Migrate from Mailgun
API Comparison
| Mailgun | Keplars | |
|---|---|---|
| Send endpoint | POST /v3/{domain}/messages | POST /api/v1/send-email/instant |
| Auth | HTTP Basic with api:YOUR_API_KEY | Authorization: Bearer kms_xxx |
| Recipient field | to (string or array) | to (array of strings) |
| HTML body | html form field | html with is_html: true |
| Template | template + h:X-Mailgun-Variables | template_id + params |
| EU region | api.eu.mailgun.net | Single 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 keplarsAdd 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 Event | Keplars Event |
|---|---|
delivered | email.delivered |
failed (hard) | email.bounced |
opened | email.opened |
clicked | email.clicked |
unsubscribed | email.unsubscribed |
complained | email.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.