Menu

Expand
Rate this page:

Settings - Inbound Parse

Twilio SendGrid’s Inbound Parse Webhook allows you to receive emails as multipart/form-data at a URL of your choosing. SendGrid will grab the content, attachments, and the headers from any email it receives for your specified hostname.

See "Setting up the Inbound Parse Webhook" for help configuring the Webhook. You can also manage the Inbound Parse Webhook in the Twilio SendGrid App.

To begin processing email using SendGrid's Inbound Parse Webhook, you will have to setup MX Records, choose the hostname (or receiving domain) that will be receiving the emails you want to parse, and define the URL where you want to POST your parsed emails. If you do not have access to your domain's DNS records, you must work with someone in your organization who does.

Create a parse setting

POST /v3/user/webhooks/parse/settings

Base url: https://api.sendgrid.com

This endpoint allows you to create a new inbound parse setting.

Creating an Inbound Parse setting requires two pieces of information: a url and a hostname.

The hostname must correspond to a domain authenticated by Twilio SendGrid on your account. If you need to complete domain authentication, you can use the Twilio SendGrid App or the "Authenticate a domain" endpoint. See "How to Set Up Domain Authentication" for instructions.

Any email received by the hostname will be parsed when you complete this setup. You must also add a Twilio SendGrid MX record to this domain's DNS records. See "Setting up the Inbound Parse Webhook" for full instructions.

The url represents a location where the parsed message data will be delivered. Twilio SendGrid will make an HTTP POST request to this url with the message data. The url must be publicly reachable, and your application must return a 200 status code to signal that the message data has been received.

Authentication

  • API Key

Headers

Authorization
string
default: Bearer <<YOUR_API_KEY_HERE>>
required
on-behalf-of
string

The on-behalf-of header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be "account-id" followed by the customer account's ID (e.g., on-behalf-of: account-id <account-id>). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., on-behalf-of: <subuser-username>). See On Behalf Of for more information.

default: None

Request Body

object
url
string

The public URL where you would like SendGrid to POST the data parsed from your email. Any emails sent with the given hostname provided (whose MX records have been updated to point to SendGrid) will be parsed and POSTed to this URL.

hostname
string

A specific and unique domain or subdomain that you have created to use exclusively to parse your incoming email. For example, parse.yourdomain.com.

spam_check
boolean

Indicates if you would like SendGrid to check the content parsed from your emails for spam before POSTing them to your domain.

send_raw
boolean

Indicates if you would like SendGrid to post the original MIME-type content of your parsed email. When this parameter is set to true, SendGrid will send a JSON payload of the content of your email.

{
  "url": "http://email.myhostname.com",
  "hostname": "myhostname.com",
  "spam_check": false,
  "send_raw": true
}

Responses

object
url
string

The public URL where you would like SendGrid to POST the data parsed from your email. Any emails sent with the given hostname provided (whose MX records have been updated to point to SendGrid) will be parsed and POSTed to this URL.

hostname
string

A specific and unique domain or subdomain that you have created to use exclusively to parse your incoming email. For example, parse.yourdomain.com.

spam_check
boolean

Indicates if you would like SendGrid to check the content parsed from your emails for spam before POSTing them to your domain.

send_raw
boolean

Indicates if you would like SendGrid to post the original MIME-type content of your parsed email. When this parameter is set to true, SendGrid will send a JSON payload of the content of your email.

{
  "url": "http://email.myhostname.com",
  "hostname": "myhostname.com",
  "spam_check": false,
  "send_raw": true
}
object
errors
array[object]
message
string

the error message

required
field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string

the error message

required
field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string

the error message

required
field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string
Loading Code Sample...
        
        

        Create a parse setting

        Rate this page:

        Need some help?

        We all do sometimes. Get help now from the Twilio SendGrid Support Team.

        Running into a coding hurdle? Lean on the wisdom of the crowd by browsing the SendGrid tag on Stack Overflow or visiting Twilio's Stack Overflow Collective.

        Loading Code Sample...
              
              
              

              Thank you for your feedback!

              Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              thanks-feedback-gif