Filter all messages
- To gain access to the Email Activity Feed API, purchase additional email activity history.
- To purchase additional history, go to Account Details > Your Products > Add-ons in the Twilio SendGrid console.
- To query all of your stored messages, query individual messages, and download a CSV with data about the stored messages, use the Email Activity API.
- To learn how to build queries and use the API, see Getting Started with the Email Activity Feed API or go to Activity in the Twilio SendGrid console.
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, 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.
Property nameTypeRequiredDescription
Authorizationstring
required
Default:
Bearer <<YOUR_API_KEY_HERE>>Property nameTypeRequiredDescription
querystring
required
Use the query syntax to filter your email activity. Combine up to 160 filter conditions per request.
limitnumber
Optional
The number of messages returned. This parameter must be greater than 0 and less than or equal to 1000
Default:
10Minimum: 1Maximum: 1000200400429
SchemaExample
Property nameTypeRequiredDescriptionChild properties
messagesarray[Abbv. Message]
Optional
Show messages properties
1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const queryParams = {5limit: 10,6query: 'from_email="email@example.com"',7};89const request = {10url: `/v3/messages`,11method: "GET",12qs: queryParams,13};1415client16.request(request)17.then(([response, body]) => {18console.log(response.statusCode);19console.log(response.body);20})21.catch((error) => {22console.error(error);23});