An open envelope feeding a loop of rounded blocks that flow into a database stack, over soft layered circles

SendGrid Inbound Parse: Setup, Payload, and Limits

SendGrid Inbound Parse turns email sent to a hostname you own into an HTTP POST to your server. You point an MX record at SendGrid, give it a URL, and every message arrives at that URL as form data. It’s a pipe, not an inbox: SendGrid doesn’t keep the mail, thread it, or help you reply.

The quick answer: add an MX record for a dedicated subdomain pointing at mx.sendgrid.net (priority 10), then go to Settings → Inbound Parse → Add Host & URL and enter that hostname and your endpoint. Mail arrives as multipart/form-data with the headers, text and HTML bodies, attachments, and SPF and DKIM results, up to 30 MB per message. Return a 2xx fast; 5xx responses are retried for up to 3 days and then dropped without notice. If the mail is meant to be read and answered by an AI agent, CarlyEmail gives the agent a real inbox that stores, threads, and signs every message, with a one-call reply.

Details below are from Twilio SendGrid’s Inbound Parse documentation, read October 11, 2026.

How to set up SendGrid Inbound Parse

1. Pick a dedicated hostname

Use a subdomain that does nothing but receive parsed mail, such as parse.example.com. Every message sent to any address at that hostname goes to your webhook, so don’t use the domain your team’s real mailboxes live on. The local part can’t be abuse, postmaster, or unsubscribe.

2. Add the MX record

In your DNS provider, create:

TypeHostPriorityValue
MXparse10mx.sendgrid.net.

Include the trailing period if your provider expects a fully qualified name, or it may append your domain again. Once it’s live, don’t change it, or the hostname stops receiving.

If the receiving hostname is the same as a domain you’ve authenticated for sending, turn off Automatic Security on that domain, or messages bounce in a loop between its CNAME and MX records.

3. Add the host and URL in SendGrid

Go to Settings → Inbound Parse and click Add Host & URL. Enter the receiving hostname and the destination URL, which has to be reachable from the internet. Two options:

  • Check incoming emails for spam adds spam_score and spam_report fields, for messages 2.5 MB or smaller.
  • POST the raw, full MIME message sends the whole message in one email field instead of parsed fields.

Click Add.

4. Secure the endpoint

Attach a security policy to the Parse webhook so you can tell real deliveries from forged ones. SendGrid supports ECDSA signature verification, OAuth (SendGrid fetches a token from your OAuth server and sends it in the Authorization header), or both. SendGrid doesn’t publish static IP ranges for Inbound Parse, so IP allowlisting isn’t a reliable substitute.

What the Inbound Parse payload contains

By default you get multipart/form-data with these fields:

FieldWhat it holds
headersThe raw headers
from, to, subjectThe usual
text, htmlThe bodies, quoted reply chain included
envelopeJSON with the SMTP from and to
attachmentsThe number of attachments
attachment-infoJSON describing each attachment
attachment1, attachment2, …The files themselves
content-idsInline image mapping
charsetsCharacter set for each field
SPF, dkimAuthentication results, such as pass and {@example.com : pass}
sender_ipThe sending server
spam_score, spam_reportOnly with the spam check on

In raw mode, the bodies and attachments arrive together in the email field as the full MIME message, and you parse it yourself.

A minimal handler in Python:

from flask import Flask, request

app = Flask(__name__)

@app.post("/inbound")
def inbound():
    sender = request.form.get("from")
    subject = request.form.get("subject")
    body = request.form.get("text")
    files = list(request.files.values())  # attachment1, attachment2, ...
    enqueue(sender, subject, body, files)  # do the slow work elsewhere
    return "", 200

Inbound Parse limits and retry behavior

  • 30 MB per message, including every attachment.
  • Spam check only below 2.5 MB.
  • Retries on 5xx only. SendGrid queues and retries POSTs that get a 5xx. A 2xx stops the retries.
  • Dropped after 3 days, with no notification. If your endpoint is down for a long weekend, that mail is gone.
  • No redirects. The webhook won’t follow a 301 or 302, so the URL has to be exact.
  • No stored copy. Once your server has the POST, SendGrid has nothing to re-fetch.
  • No permanent free plan. SendGrid offers a 60-day trial, then a paid plan. See SendGrid pricing.

What Inbound Parse leaves for you to build

Inbound Parse is the first step. For a support desk or an AI agent that answers email, the rest is your code:

  1. Storage. Write every message somewhere before you return 200, or a crash loses it.
  2. Threading. Match In-Reply-To and References against messages you’ve stored to know which conversation a reply belongs to.
  3. Quote stripping. text includes the whole reply chain. You’ll need to cut it down to what the sender just wrote before handing it to a model.
  4. Spoof filtering. Read the SPF and dkim fields and decide what to drop. Forged mail that reaches an agent can carry instructions.
  5. Replies in the right thread. Send through the Mail Send API with the right In-Reply-To and References headers so the answer lands in the sender’s thread.
  6. Deduplication. Retries can deliver the same message twice.

That’s fine for a one-way pipe, like an order email becoming a database row. For mail an agent has to read and answer, it’s a sprint of plumbing. Email to webhook compares how SendGrid, Mailgun, Postmark, SES, Resend, and Cloudflare each handle these.

When an agent inbox fits better: CarlyEmail

CarlyEmail is an email API that gives each AI agent a real inbox, on carlyemail.com or your own domain, with SPF, DKIM, and DMARC set up for you. It covers the six items above:

  • Stored and threaded on arrival. Every message is kept and matched to its conversation, including replies Outlook rewrites on the way through.
  • A signed event when mail arrives. A message.received webhook (or WebSocket message) carries the message, its thread_id, and extracted_text with the quoted chain already stripped.
  • Spam and spoofs kept apart. Spam, blocked senders, and mail that fails authentication arrive as separate event types, so they never reach your agent’s handler.
  • One-call replies that land in the sender’s thread.
  • Attachments in and out, up to 25 MB.
import { CarlyEmail } from "carlyemail";

const carly = new CarlyEmail();
const inbox = await carly.inboxes.create({ username: "support" });

const { messages } = await carly.messages.list(inbox.email);
await carly.messages.reply(inbox.email, messages[0].message_id, { text: "On it." });

There’s a Python package, a CLI (npx carlyemail signup), a REST API, and an MCP server at https://api.carlyemail.com/mcp, so Claude, ChatGPT, or a coding agent can use the inbox as tools. It works with whatever you built the agent on: the Claude Agent SDK, the OpenAI Agents SDK, LangChain, Mastra, or your own runtime. It’s free to start with no card. More in how to give an AI agent email and the email API for AI agents rundown.

Common questions

Is SendGrid Inbound Parse free? It’s part of SendGrid’s plans, and SendGrid no longer has a permanent free plan, only a 60-day trial.

What’s the SendGrid Inbound Parse size limit? 30 MB per message including attachments. The spam check only runs on messages up to 2.5 MB.

Does SendGrid retry failed Inbound Parse POSTs? Yes, for 5xx responses, for up to 3 days. After that the message is dropped and you aren’t notified.

Can I use my main domain with Inbound Parse? SendGrid recommends a hostname used only for parsing, because every message sent to that hostname goes to your webhook.

What’s the best Inbound Parse alternative for an AI agent? CarlyEmail, because the agent gets a stored, threaded inbox and a signed event with the quoted chain already stripped, instead of a raw POST it has to persist and thread itself.

Related: SendGrid alternatives, SendGrid vs Mailgun, SendGrid MCP, and catch-all email.

Give your agent a real inbox

Your agent gets its own email address. People can email it, it answers in the same thread, and your personal inbox stays out of it. Start with 3 inboxes, no card needed.

Get started
See the prompt
Read https://docs.carlyemail.com/llms.txt and set yourself up with an email address.