Keplars

Migrate from SendGrid

Replace SendGrid with Keplars: SDK swap, API comparison, and webhook event mapping

Migrate from SendGrid

API Comparison

SendGridKeplars
Send endpointPOST /v3/mail/sendPOST /api/v1/send-email/instant
Auth headerAuthorization: Bearer SG.xxxAuthorization: Bearer kms_xxx
Recipient fieldpersonalizations[].to[].emailto: ["email"]
HTML bodycontent[].value where type=text/htmlhtml with is_html: true
Templatetemplate_id + dynamic_template_datatemplate_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 keplars

Swap 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 EventKeplars Event
deliveredemail.delivered
bounceemail.bounced
openemail.opened
clickemail.clicked
unsubscribeemail.unsubscribed
spamreportemail.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.

On this page