Skip to contentSkip to navigationSkip to topbar
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 (The Twilio SendGrid v3 API)

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 messagesLink to code sample: Filter all messages
1
const client = require('@sendgrid/client');
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const queryParams = {
5
"query": "from_email=\"email@example.com\"",
6
"limit": 10
7
};
8
9
const request = {
10
url: `/v3/messages`,
11
method: 'GET',
12
qs: queryParams
13
}
14
15
client.request(request)
16
.then(([response, body]) => {
17
console.log(response.statusCode);
18
console.log(response.body);
19
})
20
.catch(error => {
21
console.error(error);
22
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.