Migrate from SendGrid
Replace SendGrid with Keplars: SDK swap, API comparison, and webhook event mapping
Migrate from SendGrid
API Comparison
| SendGrid | Keplars | |
|---|---|---|
| Send endpoint | POST /v3/mail/send | POST /api/v1/send-email/instant |
| Auth header | Authorization: Bearer SG.xxx | Authorization: Bearer kms_xxx |
| Recipient field | personalizations[].to[].email | to: ["email"] |
| HTML body | content[].value where type=text/html | html with is_html: true |
| Template | template_id + dynamic_template_data | template_id + params |
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 keplarsSwap the send call: replace the SendGrid client with the Keplars SDK (see code below)
Update webhook URLs: in your Keplars dashboard, add the same endpoint URL you used for SendGrid event webhooks
Test in sandbox mode: enable sandbox in the Keplars dashboard to send without delivering emails during verification
Code Comparison
Before (SendGrid, JavaScript):
import sgMail from '@sendgrid/mail';
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
await sgMail.send({
to: '[email protected]',
from: '[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 (SendGrid, Python):
import sendgrid
from sendgrid.helpers.mail import Mail
sg = sendgrid.SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY'))
message = Mail(
from_email='[email protected]',
to_emails='[email protected]',
subject='Welcome!',
html_content='<h1>Welcome aboard</h1>',
)
sg.send(message)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
| SendGrid Event | Keplars Event |
|---|---|
delivered | email.delivered |
bounce | email.bounced |
open | email.opened |
click | email.clicked |
unsubscribe | email.unsubscribed |
spamreport | email.complained |
Keplars supports dynamic templates the same way SendGrid does. Pass template_id and params (instead of dynamic_template_data) and the rest of your template logic works unchanged. Suppression lists and contact management are available in the Keplars dashboard under Contacts.