Menu

Expand
Rate this page:

Webhooks

The ​​SendGrid Event Webhook sends email event data as SendGrid processes it. This means you can receive data in nearly real-time, making it ideal to integrate with logging or monitoring systems.

Because the Event Webhook delivers data to your systems, it is also well-suited to backing up and storing event data within your infrastructure to meet your own data access and retention needs.

Event types

You can think about the types of events provided by the Event Webhook in two categories: deliverability events and engagement events.

  • Deliverability events such as "delivered," "bounced," and "processed" help you understand if your email is being delivered to your customers.
  • Engagement events such as "open," and "click" help you understand if customers are reading and interacting with your emails after they arrive.

Both types of events are important and should be monitored to understand the overall health of your email program. The Webhooks API allows you to configure your Event Webhook configurations.

Get All Event Webhooks

GET /v3/user/webhooks/event/settings/all

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

This endpoint allows you to retrieve all of your Event Webhooks.

Each webhook will be returned as an object in the webhooks array with the webhook's configuration details and ID. You can use a webhook's ID to update the webhook's settings, delete the webhook, enable or disable signature verification for the webhook, and, if signature verification is enabled, retrieve the webhook's public key when signature verification is enabled.

Event settings

Each webhook's settings determine which events will be included in the POST request by the webhook and the URL where the request will be sent. See the Event Webhook Reference for details about each event type.

Signature verification

The public_key property will be returned only for webhooks with signature verification enabled.

OAuth

You may share one OAuth configuration across all your webhooks or create unique credentials for each. The OAuth properties will be returned only for webhooks with OAuth configured.

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

Query String

include
string

Use this to include optional fields in the response payload. When this is set to include=account_status_change, the account_status_change field will be part of the response payload and set to false by default. See Update an event webhook for enabling this webhook notification which lets you subscribe to account status change events related to compliance action taken by SendGrid.

default: None

Responses

object
max_allowed
number

The maximum number of Event Webhooks you can have enabled under your current Twilio SendGrid plan. See the Twilio SendGrid pricing page for more information about the features available with each plan.

webhooks
array[object]

An array of Event Webhook objects. Each object represents one of your webhooks and contains its configuration settings, including which events it is set to send in the POST request, the URL where it will send those events, and the webhook's ID.

enabled
boolean

Indicates if the Event Webhook is enabled.

url
string

The URL where SendGrid will send event data.

account_status_change
boolean

Indicates if the webhook is configured to send account status change events related to compliance action taken by SendGrid.

group_resubscribe
boolean

Indicates if the webhook is configured to send group resubscribe events. Group resubscribes occur when recipients resubscribe to a specific unsubscribe group by updating their subscription preferences. You must enable Subscription Tracking to receive this type of event.

delivered
boolean

Indicates if the webhook is configured to send delivered events. Delivered events occur when a message has been successfully delivered to the receiving server.

group_unsubscribe
boolean

Indicates if the webhook is configured to send group unsubscribe events. Group unsubscribes occur when recipients unsubscribe from a specific unsubscribe group either by direct link or by updating their subscription preferences. You must enable Subscription Tracking to receive this type of event.

spam_report
boolean

Indicates if the webhook is configured to send spam report events. Spam reports occur when recipients mark a message as spam.

bounce
boolean

Indicates if the webhook is configured to send bounce events. A bounce occurs when a receiving server could not or would not accept a message.

deferred
boolean

Indicates if the webhook is configured to send deferred events. Deferred events occur when a recipient's email server temporarily rejects a message.

unsubscribe
boolean

Indicates if the webhook is configured to send unsubscribe events. Unsubscribes occur when recipients click on a message's subscription management link. You must enable Subscription Tracking to receive this type of event.

processed
boolean

Indicates if the webhook is configured to send processed events. Processed events occur when a message has been received by Twilio SendGrid and is ready to be delivered.

open
boolean

Indicates if the webhook is configured to send open events. Open events occur when a recipient has opened the HTML message. You must enable Open Tracking to receive this type of event.

click
boolean

Indicates if the webhook is configured to send click events. Click events occur when a recipient clicks on a link within the message. You must enable Click Tracking to receive this type of event.

dropped
boolean

Indicates if the webhook is configured to send dropped events. Dropped events occur when your message is not delivered by Twilio SendGrid. Dropped events are accomponied by a reason property, which indicates why the message was dropped. Reasons for a dropped message include: Invalid SMTPAPI header, Spam Content (if spam checker app enabled), Unsubscribed Address, Bounced Address, Spam Reporting Address, Invalid, Recipient List over Package Quota.

friendly_name
string or null

An optional friendly name assigned to the Event Webhook to help you differentiate it. The friendly name is for convenience only. You should use the webhook id property for any programmatic tasks.

id
string

A unique string used to identify the webhook. A webhook's ID is generated programmatically and cannot be changed after creation. You can assign a natural language identifier to your webhook using the friendly_name property.

created_date
string or null

An ISO 8601 timestamp in UTC timezone when the Event Webhook was created. If a Webhook's created_date is null, it is a legacy Event Webook, which means it is your oldest Webhook.

format: date-time
updated_date
string

An ISO 8601 timestamp in UTC timezone when the Event Webhook was last modified.

format: date-time
oauth_client_id
string or null

The OAuth client ID SendGrid sends to your OAuth server or service provider to generate an OAuth access token.

oauth_token_url
string or null

The URL where SendGrid sends the OAuth client ID and client secret to generate an access token. This should be your OAuth server or service provider.

public_key
string

The public key you can use to verify the SendGrid signature.

Loading Code Sample...
        
        

        Get All Event Webhooks

        Loading Code Sample...
              
              
              This will include the field in the response payload. See Update an Event Webhook (Subscribe to account status change notifications section) for subscribing to these notifications.

              Include account_status_change in the response payload

              This will include the field in the response payload. See Update an Event Webhook (Subscribe to account status change notifications section) for subscribing to these notifications.
              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