Twilio Sendgrid Account Setup

by twilio8aba46fb65dcNo licenseListed Oct 8, 2026Updated Oct 8, 2026

Set up a SendGrid account for email delivery. Covers API key creation (SG.-prefix), domain authentication (DKIM/SPF via CNAME records), Single Sender Verification for testing, SDK installation, and the relationship between SendGrid and Twilio credentials. Use before any other SendGrid skill. This skill is for SendGrid only — not the Twilio Email API (comms.twilio.com).

Instructions only

Overview

SendGrid is Twilio's email delivery engine but uses a completely separate authentication system — SendGrid API keys (starting with SG.) are not Twilio API keys. You cannot use Account SID/Auth Token for SendGrid, and no Twilio MCP tools wrap SendGrid.


Quickstart

  1. Get your API key from SendGrid Console > Settings > API Keys
  2. Set environment variable:
bash
export SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  1. Install SDK:
LanguageInstallPackage
Pythonpip install sendgridsendgrid
Node.jsnpm install @sendgrid/mail@sendgrid/mail (v8.x)
JavaMavencom.sendgrid:sendgrid-java
C#dotnet add package SendGridSendGrid
Rubygem install sendgrid-rubysendgrid-ruby
PHPcomposer require sendgrid/sendgridsendgrid/sendgrid
Gogo get github.com/sendgrid/sendgrid-gosendgrid-go
  1. Authenticate your sending domain (see below)

API Key Scopes

ScopeUse forRisk
Full AccessDevelopment onlyCan do everything — never deploy with this
Restricted AccessProductionScope to only what your app needs (e.g., Mail Send only)
Billing AccessAccount managementSeparate from mail operations

A "Mail Send" restricted key can send email but cannot read suppressions, manage templates, or access stats. If you get 403 Forbidden, check key permissions.


SMTP Relay (Alternative to API)

SendGrid also supports SMTP for sending. Useful for frameworks with built-in SMTP support (e.g., Laravel, Django, Rails).

SettingValue
Serversmtp.sendgrid.net
Port587 (TLS) or 465 (SSL)
Usernameapikey (literal string, not your key name)
PasswordYour SendGrid API key (SG.xxx)

Domain Authentication (Required for Production)

Single Sender Verification is for testing only. Production requires domain authentication for deliverability.

Setup: SendGrid Console > Settings > Sender Authentication > Authenticate Your Domain

Create 3 CNAME DNS records:

  1. s1._domainkey.yourdomain.com → s1.domainkey.u1234.wl.sendgrid.net (DKIM)
  2. s2._domainkey.yourdomain.com → s2.domainkey.u1234.wl.sendgrid.net (DKIM)
  3. em1234.yourdomain.com → u1234.wl.sendgrid.net (return path)

Verify via API: GET /v3/whitelabel/domains/{id}/validate

DMARC: After setting up DKIM and SPF via domain authentication, configure a DMARC DNS record (_dmarc.yourdomain.com) to instruct receiving servers how to handle authentication failures. Start with p=none for monitoring before enforcing.

Dedicated IP (Pro+ plans): Isolates your sending reputation. Requires an IP warming schedule — start with low volume and increase over 30 days.


SendGrid and Twilio

Twilio productHow it uses SendGridSends email?
SendGrid (this skill)Direct email delivery via api.sendgrid.comYes
Twilio Email APIDirect email delivery via comms.twilio.com/v1/emails — uses Twilio creds, not SendGrid keysYes (separate product)
VerifyOTP via channel: 'email'Delegates to SendGrid via Mailer config
ConversationsTracks EMAIL as a channel typeNo — logs/tracks only
FlexEmail channel for agentsUses SendGrid for delivery

Servers:

  • Global: https://api.sendgrid.com
  • EU regional: https://api.eu.sendgrid.com

CANNOT

  • Cannot use Twilio credentials for SendGrid — Separate API keys (SG.-prefix), separate Console, separate billing.
  • Cannot access SendGrid via Twilio MCP tools — No MCP integration. Use SDK or direct REST.
  • Single Sender Verification requires re-verification on address change — Changing the sender email requires a new verification. Use Domain Authentication for production.
  • Domain Authentication requires DNS access — 3 CNAME records needed. If you can't modify DNS, you can't authenticate.
  • Domain Authentication API returns stale entries — GET /v3/whitelabel/domains includes old invalid entries. Filter by valid: true.
  • API Key Secret shown only at creation — Cannot retrieve afterward. Store immediately.

Security: Your API key is shown only once at creation. Never display, log, or repeat a user's API key in responses. If a user shares their key in conversation, advise them to rotate it immediately. Store keys in a secrets manager (AWS Secrets Manager, HashiCorp Vault, etc.), not in code or environment files committed to version control.


Next Steps

  • Send email: twilio-sendgrid-email-send
  • Domain settings and templates: twilio-sendgrid-email-settings
  • Delivery tracking: twilio-sendgrid-webhooks
  • Docs: SendGrid API Reference

Source and attribution

Source:twilio/aiinskills/sendgrid/twilio-sendgrid-account-setupat commit8aba46f

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal

More from twilio/ai

Twilio Voice Twiml

twilio

Builds Twilio voice call logic with TwiML, covering core verbs, SDK generation, and an IVR example.

Software DevelopmentOct 8, 2026

Twilio Isv Sms Best Practices

twilio

Guidance for ISVs building multi-tenant Twilio SMS features, covering A2P and toll-free onboarding, subaccounts and pitfalls.

Software DevelopmentOct 8, 2026

Twilio Security Compliance Hipaa

twilio

Guides configuring Twilio accounts for HIPAA compliance, covering BAAs, HIPAA project designation, eligible services and per-product rules.

SecurityOct 8, 2026

Twilio Reliability Patterns

twilio

Handle rate limits, retries, and failures when building on Twilio at scale. Covers 429 exponential backoff with jitter, per-number throughput limits, StatusCallback resilience, thin-receiver pattern, and fallback chains. Use this skill whenever sending messages or making calls at volume, or when building production-grade Twilio integrations.

Awaiting classificationOct 8, 2026

Twilio Organizations Setup

twilio

Set up and manage Twilio Organizations for centralized account and user governance. Covers the Organization > Account > Subaccount hierarchy, roles (Owner/Admin/Standard), managed vs independent accounts, domain registration, SSO enforcement, SCIM provisioning, and Organization merging. Use this skill when managing multiple Twilio accounts or users across teams.

Awaiting classificationOct 8, 2026

Twilio Numbers Senders

twilio

Guides choosing Twilio number types and senders before building, covering compliance programs, throughput, and availability.

CommunicationOct 8, 2026