What we do
Tools
Industries
Department
How we workLet's talk →
Home/SendGrid
Twilio SendGrid

The SendGrid API: Key, First Send, and What Happens After the 202

SendGrid, which Twilio owns, is the email API behind a lot of receipts, password resets and notifications. Getting a first message out takes four things: a key, a verified sender, one POST request and a way to hear what happened next. Most of the problems come from skipping the last one.

Where SendGrid stops

A failed send or a rising bounce rate sits unnoticed until a customer complains.

Stuck on SendGrid? Let's solve it →
The short version

Key: create one with only the access your app needs, and copy it right away. SendGrid shows it once.

Settings API Keys Create API Key

Sender: authenticate your sending domain (or, for testing, verify a single sender address). Mail from an unverified From address is refused.

Settings Sender Authentication

Send: POST to https://api.sendgrid.com/v3/mail/send with Authorization: Bearer <key> and a JSON body. A 202 Accepted means SendGrid queued it, not that it was delivered.

Results: turn on the Event Webhook so delivered, bounced, dropped and spam-report events reach your app.

Settings Mail Settings Event Webhook

Setting up the SendGrid API properly

  1. 1

    Create a key per app, with Custom Access

    Settings API Keys Create API Key

    Choose Full Access, Custom Access or Billing Access. For an app that only sends, Custom Access with Mail Send is enough. Name it after the app so you know what breaks when you delete it. An account can hold up to 100 keys.

    Watch for: the key in a code repository or a front-end bundle. Keep it in an environment variable or secret store.

  2. 2

    Authenticate your domain

    Settings Sender Authentication Authenticate Your Domain

    SendGrid gives you DNS records to add at your DNS host. Once they verify, mail is signed for your own domain instead of SendGrid's, which is what inbox providers check. Add a DMARC record at your DNS host too if you don't have one.

  3. 3

    Send one message

    Post the sender, recipient, subject and content, or a template_id with dynamic_template_data if you use SendGrid dynamic templates. The official libraries for Node, Python, PHP, C#, Java, Go and Ruby build the same request.

  4. 4

    Turn on the Event Webhook

    Settings Mail Settings Event Webhook

    Give it a URL in your app and pick the events you want. Turn on signature verification so your endpoint can reject requests that didn't come from SendGrid. Our SendGrid webhooks page goes deeper on the payloads.

    Watch for: an endpoint that errors. SendGrid retries for up to 24 hours, then those events are gone.

202 Accepted, but the email never arrived

The address is on a suppression list

How you'll know: A dropped event in the activity feed, with no delivery attempt.

Fix: SendGrid won't send to addresses that bounced, unsubscribed or marked you as spam. Check the suppression lists. If the address is right, fix it in your own records, then remove it from the list.

It went to spam

How you'll know: Delivered according to SendGrid, missing according to the customer.

Fix: Finish domain authentication and a DMARC record, and send transactional mail separately from marketing so complaints about one don't drag down the other.

403 on every send

How you'll know: The request is refused before anything queues.

Fix: Usually the From address doesn't match a verified sender or authenticated domain, or the key lacks Mail Send access. A 401 instead means the key itself is wrong or deleted.

Your app thinks everything was sent

How you'll know: Your records say "email sent" for messages that bounced.

Fix: The 202 only covers acceptance. Store the message ID from the response and update the status from Event Webhook events.

What this looks like in practice

A membership group still emailing addresses that bounced months ago

Member emails sent through SendGrid, member records kept in a CRM.

The problem Hard bounces pile up in SendGrid and the CRM keeps emailing dead addresses, hurting deliverability.

A hard bounce marks the contact undeliverable in the CRM and billing system. The next campaign skips bad addresses.

What SendGrid leaves to your other systems

SendGrid already keeps its own suppression lists and reports every event. What it doesn't do is tell your CRM, billing system or app's user table. So the member record still shows a dead address, renewal notices go nowhere, and nobody notices until a customer asks where their receipt went.

n-frames builds the listener behind the Event Webhook: it verifies each request, marks bounced addresses undeliverable in the system that owns them, flags spam complaints on the account, and alerts your team when bounce or complaint rates climb. It also builds sends that depend on something SendGrid can't see, such as an approval or a status in another system, so the email only goes once that's true.

Questions people ask

How do I get a SendGrid API key?

Go to Settings, then API Keys, then Create API Key. Name it, choose Full Access, Custom Access or Billing Access, and click Create & View. Copy it then, because SendGrid won't show it again. Store it as an environment variable and send it in the Authorization header as a Bearer token.

How do I send an email using the SendGrid API?

POST to api.sendgrid.com/v3/mail/send with your key in the Authorization header and a JSON body with personalizations (recipients), from, subject and content, or a dynamic template ID with its data. A 202 means it was accepted. The official libraries wrap the same call.

Can I use SendGrid as an SMTP relay instead of the API?

Yes. Point your app at smtp.sendgrid.net, port 587 for TLS (465 for SSL), with the username apikey and an API key as the password. It's the quickest way to move an app that already sends over SMTP without rewriting it.

Where do I log into SendGrid?

At app.sendgrid.com, with your account login or your company's single sign-on. Because SendGrid is part of Twilio, some accounts are reached through a Twilio login instead.

How much does SendGrid cost?

Email API plans are priced by monthly volume. New accounts now start on a 60-day trial with a small daily sending limit rather than a permanent free plan, then move to a paid plan. Check SendGrid's pricing page for current tiers.

Does SendGrid validate email addresses before sending?

Not as part of a normal send. Email Address Validation is a separate API, with its own key permission, that scores an address before you use it. Putting it on a signup form keeps typos and fake addresses from becoming bounces.

Does SendGrid integrate with Salesforce?

SendGrid's focus is sending. Starting sends from Salesforce events and logging delivery and bounces back onto the contact is usually built against both APIs, or done through an AppExchange package, so check what a package records before relying on it. n-frames builds that link both ways.

Let's talk

Tell us the one thing your team does manually that eats up time. We read every message and reply within a day.