How to hit the SendGrid API

SendGrid's v3 API lives at https://api.sendgrid.com/v3. Mail send returns 202 Accepted with an empty body on success — the email is queued, not yet delivered.

Authentication

Create a key under Settings → API Keys and send it as Authorization: Bearer <key>. In the examples it's written {{SENDGRID_API_KEY}}. The from address must be a verified sender.

Full reference: https://www.twilio.com/docs/sendgrid/api-reference

Send an email

Recipients go in personalizations; each entry can have its own to, cc, and substitutions.

curl -X POST https://api.sendgrid.com/v3/mail/send \
  -H "Authorization: Bearer {{SENDGRID_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
    "personalizations": [{"to": [{"email": "{{TO_EMAIL}}"}]}],
    "from": {"email": "{{FROM_EMAIL}}"},
    "subject": "Hello from PostTaco",
    "content": [{"type": "text/plain", "value": "It works."}]
  }'
Run in PostTaco

Send with a dynamic template

Template ids start with d-. dynamic_template_data fills the template's Handlebars fields.

curl -X POST https://api.sendgrid.com/v3/mail/send \
  -H "Authorization: Bearer {{SENDGRID_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
    "personalizations": [{"to": [{"email": "{{TO_EMAIL}}"}], "dynamic_template_data": {"first_name": "Jenny"}}],
    "from": {"email": "{{FROM_EMAIL}}"},
    "template_id": "{{TEMPLATE_ID}}"
  }'
Run in PostTaco

Check a key's permissions

Which scopes the key has — handy when a send fails with 403.

curl https://api.sendgrid.com/v3/scopes \
  -H "Authorization: Bearer {{SENDGRID_API_KEY}}"
Run in PostTaco

Get delivery stats

Requests, deliveries, opens, clicks, bounces per day.

curl "https://api.sendgrid.com/v3/stats?start_date=2026-09-01" \
  -H "Authorization: Bearer {{SENDGRID_API_KEY}}"
Run in PostTaco