Providers

SendGrid

Send email through SendGrid.
import { createClient } from '@nicogenz/emails-sdk';
import { sendgrid } from '@nicogenz/emails-sdk/sendgrid';

const email = createClient({
  provider: sendgrid({ apiKey: process.env.SENDGRID_API_KEY! }),
});

Options

OptionTypeRequiredDescription
apiKeystringYesYour SendGrid API key.
region'global' | 'eu'NoUse eu for accounts with EU data residency. Defaults to global.
fetchtypeof fetchNoA custom fetch implementation.

Notes

  • tags are sent as SendGrid custom_args.
  • idempotencyKey isn't supported. Passing one throws an EmailError with the code unsupported.
  • sendBatch sends the emails one by one, because SendGrid has no endpoint for sending different emails in one request.
  • The returned id is SendGrid's X-Message-Id. Webhook events use a longer sg_message_id that starts with this ID. raw is empty, because SendGrid doesn't return a response body.
Copyright © 2026