Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Filter all messages



API Overview

api-overview page anchor

You must purchase additional email activity history(link takes you to an external page) to gain access to the Email Activity Feed API.

The Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages.

Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them.

See "Getting Started with the Email Activity Feed API" for help building queries and working with the API.

You can also work with email activity in the Activity section of the Twilio SendGrid App(link takes you to an external page).


GET/v3/messages

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

Filter all messages to search your Email Activity. All queries must be URL encoded(link takes you to an external page), and use the following format:

query={query_type}="{query_content}"

Once URL encoded, the previous query will look like this:

query=type%3D%22query_content%22

For example, to filter by a specific email, use the following query:

query=to_email%3D%22example%40example.com%22

Visit our Query Reference section to see a full list of basic query types and examples.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
querystringrequired

Use the query syntax to filter your email activity.


limitnumberOptional

The number of messages returned. This parameter must be greater than 0 and less than or equal to 1000

Minimum: 1Maximum: 1000Default: 10
200400429
SchemaExample
Property nameTypeRequiredDescriptionChild properties
messagesarray[object]

Filter all messages

filter-all-messages page anchor

Filter Email Activity messages by from address

Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_22
const client = require('@sendgrid/client');
_22
client.setApiKey(process.env.SENDGRID_API_KEY);
_22
_22
const queryParams = {
_22
"query": "from_email=\"email@example.com\"",
_22
"limit": 10
_22
};
_22
_22
const request = {
_22
url: `/v3/messages`,
_22
method: 'GET',
_22
qs: queryParams
_22
}
_22
_22
client.request(request)
_22
.then(([response, body]) => {
_22
console.log(response.statusCode);
_22
console.log(response.body);
_22
})
_22
.catch(error => {
_22
console.error(error);
_22
});


Rate this page: